You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. import org.w3c.dom.Node
  16. import org.w3c.dom.NodeList
  17. import javax.xml.xpath.XPath
  18. import javax.xml.xpath.XPathConstants
  19. import javax.xml.xpath.XPathFactory
  20. buildscript {
  21. repositories {
  22. maven { url 'https://plugins.gradle.org/m2/' }
  23. mavenCentral()
  24. }
  25. }
  26. plugins {
  27. id 'base'
  28. id 'com.dorongold.task-tree' version '2.1.0'
  29. id 'org.nosphere.apache.rat' version '0.8.0'
  30. id 'distribution'
  31. id "com.github.spotbugs" version '5.0.14'
  32. id 'de.thetaphi.forbiddenapis' version '3.5.1'
  33. id 'org.sonarqube' version '4.0.0.2929'
  34. id 'org.cyclonedx.bom' version '1.7.4'
  35. id 'com.adarshr.test-logger' version '3.2.0'
  36. }
  37. repositories {
  38. mavenCentral()
  39. //maven { url 'https://repository.apache.org/content/repositories/staging' }
  40. }
  41. // Only add the plugin for Sonar if enabled
  42. if (project.hasProperty('enableSonar')) {
  43. println 'Enabling Sonar support'
  44. apply plugin: 'org.sonarqube'
  45. }
  46. boolean isCIBuild = false;
  47. // For help converting an Ant build to a Gradle build, see
  48. // https://docs.gradle.org/current/userguide/ant.html
  49. configurations {
  50. antLibs {
  51. attributes {
  52. attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
  53. }
  54. }
  55. }
  56. dependencies {
  57. antLibs("org.junit.jupiter:junit-jupiter:5.9.3")
  58. antLibs("org.apache.ant:ant-junitlauncher:1.10.12")
  59. }
  60. ant.taskdef(name: "junit",
  61. classname: "org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask",
  62. classpath: configurations.antLibs.asPath)
  63. wrapper {
  64. gradleVersion = '8.1.1'
  65. }
  66. task adjustWrapperPropertiesFile {
  67. doLast {
  68. ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
  69. fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
  70. }
  71. new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
  72. ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
  73. }
  74. }
  75. wrapper.finalizedBy adjustWrapperPropertiesFile
  76. group = 'org.apache.poi'
  77. /**
  78. Define properties for all projects, including this one
  79. */
  80. allprojects {
  81. // apply plugin: 'eclipse'
  82. apply plugin: 'idea'
  83. version = '5.2.4-SNAPSHOT'
  84. }
  85. /**
  86. Define things that are only necessary in sub-projects, but not in the master-project itself
  87. */
  88. subprojects {
  89. //Put instructions for each sub project, but not the master
  90. apply plugin: 'java-library'
  91. apply plugin: 'jacoco'
  92. apply plugin: 'maven-publish'
  93. apply plugin: 'signing'
  94. apply plugin: 'de.thetaphi.forbiddenapis'
  95. apply plugin: 'com.github.spotbugs'
  96. apply plugin: 'org.cyclonedx.bom'
  97. apply plugin: 'com.adarshr.test-logger'
  98. ext {
  99. bouncyCastleVersion = '1.75'
  100. commonsCodecVersion = '1.16.0'
  101. commonsCompressVersion = '1.23.0'
  102. commonsIoVersion = '2.13.0'
  103. commonsMathVersion = '3.6.1'
  104. junitVersion = '5.9.3'
  105. log4jVersion = '2.20.0'
  106. mockitoVersion = '4.11.0'
  107. hamcrestVersion = '2.2'
  108. xmlbeansVersion = '5.1.1'
  109. batikVersion = '1.16'
  110. graphics2dVersion = '0.43'
  111. pdfboxVersion = '2.0.28'
  112. saxonVersion = '11.5'
  113. apiGuardianVersion = '1.1.2'
  114. jdkVersion = (project.properties['jdkVersion'] ?: '8') as int
  115. // see https://github.com/gradle/gradle/blob/master/subprojects/jvm-services/src/main/java/org/gradle/internal/jvm/inspection/JvmVendor.java
  116. jdkVendor = (project.properties['jdkVendor'] ?: '') as String
  117. JAVA9_SRC = 'src/main/java9'
  118. JAVA9_OUT = "${buildDir}/classes/java9/main/"
  119. TEST9_SRC = 'src/test/java9'
  120. TEST9_OUT = "${buildDir}/classes/java9/test/"
  121. VERSIONS9 = 'META-INF/versions/9'
  122. NO_SCRATCHPAD = (findProperty("scratchpad.ignore") == "true")
  123. SAXON_TEST = (findProperty("saxon.test") == "true")
  124. }
  125. configurations {
  126. all {
  127. resolutionStrategy {
  128. force "commons-io:commons-io:${commonsIoVersion}"
  129. force 'org.slf4j:slf4j-api:2.0.7'
  130. force 'com.fasterxml.woodstox:woodstox-core:6.5.1'
  131. }
  132. }
  133. }
  134. tasks.withType(JavaCompile) {
  135. options.encoding = 'UTF-8'
  136. options.compilerArgs += '-Xlint:unchecked'
  137. options.deprecation = true
  138. options.incremental = true
  139. }
  140. tasks.withType(Test) {
  141. systemProperty "file.encoding", "UTF-8"
  142. }
  143. tasks.withType(Javadoc) {
  144. options.encoding = 'UTF-8'
  145. }
  146. tasks.withType(AbstractArchiveTask).configureEach {
  147. preserveFileTimestamps = false
  148. reproducibleFileOrder = true
  149. }
  150. repositories {
  151. mavenCentral()
  152. //maven { url 'https://repository.apache.org/content/repositories/staging' }
  153. }
  154. dependencies {
  155. testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
  156. testImplementation "org.mockito:mockito-core:${mockitoVersion}"
  157. testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
  158. testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
  159. if (SAXON_TEST) {
  160. testRuntimeOnly("net.sf.saxon:Saxon-HE:${saxonVersion}") {
  161. exclude group: 'xml-apis', module: 'xml-apis'
  162. }
  163. }
  164. }
  165. java {
  166. toolchain {
  167. languageVersion = JavaLanguageVersion.of(jdkVersion)
  168. if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
  169. }
  170. withJavadocJar()
  171. withSourcesJar()
  172. }
  173. javadoc {
  174. failOnError = true
  175. maxMemory = "1024M"
  176. javadocTool = javaToolchains.javadocToolFor {
  177. languageVersion = JavaLanguageVersion.of(jdkVersion)
  178. }
  179. doFirst {
  180. options {
  181. if (jdkVersion > 8) addBooleanOption('html5', true)
  182. addBooleanOption('Xdoclint:all,-missing', true)
  183. links 'https://poi.apache.org/apidocs/dev/'
  184. links 'https://docs.oracle.com/javase/8/docs/api/'
  185. links 'https://xmlbeans.apache.org/docs/5.0.0/'
  186. links 'https://commons.apache.org/proper/commons-compress/apidocs/'
  187. use = true
  188. splitIndex = true
  189. source = "1.8"
  190. }
  191. }
  192. }
  193. // helper-target to get a directory with all third-party libraries
  194. // this is used for mass-regression-testing
  195. task getDeps(type: Copy) {
  196. from sourceSets.main.runtimeClasspath
  197. into 'build/runtime/'
  198. }
  199. tasks.withType(Jar) {
  200. duplicatesStrategy = 'fail'
  201. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  202. doLast {
  203. ant.checksum(file: it.archivePath, algorithm: 'SHA-256', fileext: '.sha256', format: 'MD5SUM')
  204. ant.checksum(file: it.archivePath, algorithm: 'SHA-512', fileext: '.sha512', format: 'MD5SUM')
  205. }
  206. }
  207. jar {
  208. from("../legal") {
  209. include "NOTICE"
  210. include "LICENSE"
  211. }
  212. rename('^(NOTICE|LICENSE)', 'META-INF/$1')
  213. manifest {
  214. attributes(
  215. 'Specification-Title': 'Apache POI',
  216. 'Specification-Version': project.version,
  217. 'Specification-Vendor': 'The Apache Software Foundation',
  218. 'Implementation-Title': 'Apache POI',
  219. 'Implementation-Version': project.version,
  220. 'Implementation-Vendor': 'org.apache.poi',
  221. 'Implementation-Vendor-Id': 'The Apache Software Foundation'
  222. )
  223. }
  224. }
  225. javadocJar {
  226. // if javadocs and binaries are in the same directory, JPMS complaints about duplicated modules
  227. // in the module-path
  228. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}-javadoc")
  229. }
  230. sourcesJar {
  231. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  232. exclude 'META-INF/services/**'
  233. }
  234. test {
  235. // make XML test-results available for Jenkins CI
  236. useJUnitPlatform()
  237. reports {
  238. junitXml.required = true
  239. }
  240. javaLauncher = javaToolchains.launcherFor {
  241. languageVersion = JavaLanguageVersion.of(jdkVersion)
  242. if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
  243. }
  244. // Exclude some tests that are not actually tests or do not run cleanly on purpose
  245. exclude '**/BaseTestBorderStyle.class'
  246. exclude '**/BaseTestCellUtil.class'
  247. exclude '**/TestUnfixedBugs.class'
  248. exclude '**/TestOneFile.class'
  249. // Exclude Test Suites
  250. exclude '**/All*Tests.class'
  251. exclude '**/HSSFTests.class'
  252. // set heap size for the test JVM(s)
  253. minHeapSize = "128m"
  254. maxHeapSize = "2g"
  255. // Specifying the local via system properties did not work, so we set them this way
  256. jvmArgs += [
  257. '-Djava.awt.headless=true',
  258. '-Djavax.xml.stream.XMLInputFactory=com.sun.xml.internal.stream.XMLInputFactoryImpl',
  259. "-Dversion.id=${project.version}",
  260. '-ea',
  261. // -Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock} ... if ${isIBMVM}
  262. ]
  263. // detect if running on Jenkins/CI
  264. isCIBuild |= Boolean.valueOf(System.getenv("CI_BUILD"));
  265. if (isCIBuild) {
  266. System.out.println("Run with reduced parallelism for CI build");
  267. jvmArgs += [
  268. // Strictly serial
  269. '-Djunit.jupiter.execution.parallel.enabled=false',
  270. // OR parallel on 2 threads
  271. //'-Djunit.jupiter.execution.parallel.config.strategy=fixed',
  272. //'-Djunit.jupiter.execution.parallel.config.fixed.parallelism=2'
  273. ]
  274. maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
  275. } else {
  276. jvmArgs += [
  277. '-Djunit.jupiter.execution.parallel.enabled=true',
  278. '-Djunit.jupiter.execution.parallel.config.strategy=dynamic',
  279. // this setting breaks the test builds, do not use it!
  280. //'-Djunit.jupiter.execution.parallel.mode.default=concurrent'
  281. ]
  282. // Explicitly defining the maxParallelForks was always slower than not setting it
  283. // So we leave this to Gradle itself, which seems to be very smart
  284. // maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
  285. // maxParallelForks = Math.max( Runtime.runtime.availableProcessors() - 1, 1 )
  286. }
  287. // show standard out and standard error of the test JVM(s) on the console
  288. //testLogging.showStandardStreams = true
  289. // http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build
  290. systemProperties['user.dir'] = workingDir
  291. systemProperties['java.io.tmpdir'] = 'build'
  292. systemProperties['POI.testdata.path'] = '../test-data'
  293. // define the locale to not have failing tests when the locale is set differently on the current machine
  294. systemProperties['user.language'] = 'en'
  295. systemProperties['user.country'] = 'US'
  296. // this is necessary for JDK 9+ to keep formatting dates the same way as in previous JDK-versions
  297. systemProperties['java.locale.providers'] = 'JRE,CLDR'
  298. doFirst {
  299. if (jdkVersion > 8) {
  300. // some options were removed in JDK 18
  301. if (jdkVersion < 18) {
  302. jvmArgs += [
  303. '--illegal-access=warn',
  304. ]
  305. }
  306. jvmArgs += [
  307. // see https://github.com/java9-modularity/gradle-modules-plugin/issues/97
  308. // opposed to the recommendation there, it doesn't work to add ... to the dependencies
  309. // testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.1'
  310. // gradles gradle-worker.jar is still not a JPMS module and thus runs as unnamed module
  311. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=org.apache.poi.poi',
  312. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
  313. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED',
  314. '-Dsun.reflect.debugModuleAccessChecks=true',
  315. '-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
  316. ]
  317. }
  318. }
  319. jacoco {
  320. excludes = [
  321. // this is necessary to make JaCoCo work with JDK 18 for now
  322. 'sun/**',
  323. 'javax/**',
  324. ]
  325. }
  326. }
  327. jacoco {
  328. toolVersion = '0.8.10'
  329. }
  330. jacocoTestReport {
  331. reports {
  332. xml.required = true
  333. }
  334. }
  335. // ensure the build-dir exists
  336. projectDir.mkdirs()
  337. if (project.hasProperty('enableSonar')) {
  338. // See https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/ and
  339. // https://docs.sonarqube.org/display/SONARQUBE52/Analyzing+with+SonarQube+Scanner+for+Gradle
  340. // for documentation of properties.
  341. //
  342. // Some additional properties are currently set in the Jenkins-DSL, see jenkins/create_jobs.groovy
  343. //
  344. sonarqube {
  345. properties {
  346. // as we currently use build/<module>/ as project-basedir, we need to tell Sonar to use
  347. // the root-folder as "basedir" for the projects
  348. property "sonar.projectBaseDir", "$projectDir"
  349. // currently supported providers on Jenkins: "hg,git": property "sonar.scm.provider", "svn"
  350. // the plugin seems to not detect our non-standard build-layout
  351. property "sonar.junit.reportPaths", "$projectDir/build/test-results/test"
  352. // the Gradle run will report an invalid directory for 'ooxml-schema', but it seems to still work fine
  353. property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/test/jacocoTestReport.xml"
  354. // somehow the version was not use properly
  355. property "sonar.projectVersion", version
  356. }
  357. }
  358. }
  359. forbiddenApis {
  360. bundledSignatures = [ 'jdk-unsafe', 'jdk-deprecated', 'jdk-internal', 'jdk-non-portable', 'jdk-reflection' ]
  361. signaturesFiles = files('../src/resources/devtools/forbidden-signatures.txt')
  362. ignoreFailures = false
  363. suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ]
  364. }
  365. forbiddenApisTest {
  366. // forbiddenapis bundled signatures max supported version is 17
  367. // also see https://github.com/policeman-tools/forbidden-apis/issues/191
  368. targetCompatibility = (JavaVersion.VERSION_17.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_17)
  369. }
  370. forbiddenApisMain {
  371. signaturesFiles += files('../src/resources/devtools/forbidden-signatures-prod.txt')
  372. targetCompatibility = (JavaVersion.VERSION_17.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_17)
  373. }
  374. task jenkins
  375. jenkins.dependsOn build
  376. jenkins.dependsOn check
  377. jenkins.dependsOn javadoc
  378. jenkins.dependsOn jacocoTestReport
  379. jenkins.dependsOn rat
  380. jenkins.dependsOn getDeps
  381. task jenkinsLite
  382. jenkins.dependsOn build
  383. jenkins.dependsOn test
  384. publishing {
  385. publications {
  386. POI(MavenPublication) {
  387. groupId 'org.apache.poi'
  388. artifactId project.archivesBaseName
  389. from components.java
  390. pom {
  391. packaging = 'jar'
  392. url = 'https://poi.apache.org/'
  393. name = 'Apache POI'
  394. description = 'Apache POI - Java API To Access Microsoft Format Files'
  395. mailingLists {
  396. mailingList {
  397. name = 'POI Users List'
  398. subscribe = 'user-subscribe@poi.apache.org'
  399. unsubscribe = 'user-unsubscribe@poi.apache.org'
  400. archive = 'https://lists.apache.org/list.html?user@poi.apache.org'
  401. }
  402. mailingList {
  403. name = 'POI Developer List'
  404. subscribe = 'dev-subscribe@poi.apache.org'
  405. unsubscribe = 'dev-unsubscribe@poi.apache.org'
  406. archive = 'https://lists.apache.org/list.html?dev@poi.apache.org'
  407. }
  408. }
  409. licenses {
  410. license {
  411. name = 'Apache License, Version 2.0'
  412. url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  413. distribution = 'repo'
  414. }
  415. }
  416. organization {
  417. name = 'Apache Software Foundation'
  418. url = 'http://www.apache.org/'
  419. }
  420. issueManagement {
  421. system = 'bugzilla'
  422. url = 'https://bz.apache.org/bugzilla'
  423. }
  424. developers {
  425. developer {
  426. name = 'POI Team'
  427. id = 'poi'
  428. email = 'user@poi.apache.org'
  429. organization = 'Apache POI'
  430. }
  431. }
  432. withXml {
  433. def r = asElement()
  434. def doc = r.getOwnerDocument()
  435. def hdr = new File('../legal/HEADER')
  436. if (!hdr.exists()) hdr = new File('legal/HEADER')
  437. def asl = doc.createComment(hdr.text)
  438. // adding ASF header before root node is ignored
  439. // doc.insertBefore(asl, doc.getDocumentElement())
  440. r.insertBefore(asl, r.getFirstChild())
  441. // Replace ooxml-full with ooxml-lite
  442. XPath xpath = XPathFactory.newInstance().newXPath()
  443. NodeList res = (NodeList)xpath.evaluate("//dependency/artifactId[text() = 'poi-ooxml-full']", doc, XPathConstants.NODESET)
  444. for (int i=res.getLength()-1; i>=0; i--) {
  445. res.item(i).setTextContent('poi-ooxml-lite')
  446. }
  447. // remove duplicate entries
  448. res = (NodeList)xpath.evaluate("//dependency[artifactId = ./preceding-sibling::dependency/artifactId]", doc, XPathConstants.NODESET)
  449. for (int i=res.getLength()-1; i>=0; i--) {
  450. Node n = res.item(i)
  451. n.getParentNode().removeChild(n)
  452. }
  453. }
  454. }
  455. }
  456. }
  457. }
  458. generatePomFileForPOIPublication.destination = "../build/dist/maven/${project.archivesBaseName}/${project.archivesBaseName}-${project.version}.pom"
  459. tasks.withType(GenerateModuleMetadata) {
  460. enabled = false
  461. }
  462. signing {
  463. setRequired {
  464. // signing is only required if this is a release version
  465. // and the artifacts are to be published
  466. gradle.taskGraph.allTasks.any { it instanceof PublishToMavenRepository }
  467. }
  468. sign publishing.publications.POI
  469. }
  470. signPOIPublication.dependsOn('generatePomFileForPOIPublication')
  471. spotbugs {
  472. ignoreFailures = true
  473. showStackTraces = false
  474. maxHeapSize = '2g'
  475. }
  476. build {
  477. if (project.hasProperty('signing.keyId')) {
  478. dependsOn 'signPOIPublication'
  479. }
  480. }
  481. }
  482. // initial try to provide a combined JavaDoc, grouping is still missing here, though!
  483. task allJavaDoc(type: Javadoc) {
  484. var prj = [ project(':poi'), project(':poi-excelant'), project(':poi-ooxml'), project(':poi-scratchpad') ]
  485. source prj.collect { it.sourceSets.main.allJava }
  486. // for possible settings see https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html
  487. classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
  488. destinationDir = file("${buildDir}/docs/javadoc")
  489. maxMemory="2048M"
  490. // for possible options see https://docs.gradle.org/current/javadoc/org/gradle/external/javadoc/StandardJavadocDocletOptions.html
  491. options.use = true
  492. options.splitIndex = true
  493. options.addBooleanOption('Xdoclint:all,-missing', true)
  494. title = 'POI API Documentation'
  495. options.bottom = '<![CDATA[<i>Copyright ' + new Date().format('yyyy') + ' The Apache Software Foundation or its licensors, as applicable.</i>]]>'
  496. options.group('DDF - Dreadful Drawing Format', 'org.apache.poi.ddf*')
  497. options.group('HPSF - Horrible Property Set Format', 'org.apache.poi.hpsf*')
  498. options.group('SS - Common Spreadsheet Format', 'org.apache.poi.ss*')
  499. options.group('HSSF - Horrible Spreadsheet Format', 'org.apache.poi.hssf*')
  500. options.group('XSSF - Open Office XML Spreadsheet Format', 'org.apache.poi.xssf*')
  501. options.group('SL - Common Slideshow Format', 'org.apache.poi.sl*')
  502. options.group('HSLF - Horrible Slideshow Format', 'org.apache.poi.hslf*', 'org.apache.poi.hwmf*', 'org.apache.poi.hemf*')
  503. options.group('XSLF - Open Office XML Slideshow Format', 'org.apache.poi.xslf*')
  504. options.group('HWPF - Horrible Word Processor Format', 'org.apache.poi.hwpf*')
  505. options.group('XWPF - Open Office XML Word Processor Format', 'org.apache.poi.xwpf*')
  506. options.group('HDGF - Horrible Diagram Format', 'org.apache.poi.hdgf*')
  507. options.group('XDGF - Open Office XML Diagram Format', 'org.apache.poi.xdgf*')
  508. options.group('HMEF - Transport Neutral Encoding Files (TNEF)', 'org.apache.poi.hmef*')
  509. options.group('HSMF Outlook message file format', 'org.apache.poi.hsmf*')
  510. options.group('HPBF - Publisher Format Files', 'org.apache.poi.hpbf*')
  511. options.group('POIFS - POI File System', 'org.apache.poi.poifs*')
  512. options.group('Utilities', 'org.apache.poi.util*')
  513. options.group('Excelant', 'org.apache.poi.ss.excelant**')
  514. // options.group('Examples', 'org.apache.poi.examples*')
  515. }
  516. task jenkins(dependsOn: ['replaceVersion', subprojects.build, 'srcDistZip', 'srcDistTar']) {}
  517. task jenkinsLite(dependsOn: ['replaceVersion', subprojects.build]) {}
  518. clean {
  519. delete "${rootDir}/build/dist"
  520. }
  521. rat {
  522. // Input directory, defaults to '.'
  523. inputDir.set(file("."))
  524. // include all directories which contain files that are included in releases
  525. includes = [
  526. "poi-examples/**",
  527. "poi-excelant/**",
  528. "poi-integration/**",
  529. "legal/**",
  530. "poi/**",
  531. "maven/**",
  532. "poi-ooxml/**",
  533. "poi-ooxml-full/**",
  534. "poi-ooxml-lite/**",
  535. "poi-ooxml-lite-agent/**",
  536. "osgi/**",
  537. "poi-scratchpad/**",
  538. "src/**",
  539. // "sonar/**",
  540. "build.*"
  541. ]
  542. // List of Gradle exclude directives, defaults to ['**/.gradle/**']
  543. //excludes.add("main/java/org/apache/poi/**/*-chart-data.txt")
  544. excludes = [
  545. "build.javacheck.xml",
  546. "**/build/**",
  547. "**/out/**",
  548. "**/*.iml",
  549. "**/*.log",
  550. "**/gradle-wrapper.properties",
  551. "**/main/java/org/apache/poi/**/*-chart-data.txt",
  552. "poi/src/main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml",
  553. "poi-ooxml/src/main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml",
  554. "poi-ooxml/src/main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml",
  555. "poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/*.xsd",
  556. "poi-ooxml-full/src/main/xmlschema/org/apache/poi/xdgf/visio.xsd",
  557. "osgi/README.md",
  558. "src/resources/ooxml-lite-report.*",
  559. // ignore svn conflict artifacts
  560. "**/module-info.*"
  561. ]
  562. /*
  563. <exclude name="documentation/*.txt" />
  564. <exclude name="documentation/content/xdocs/dtd/" />
  565. <exclude name="documentation/content/xdocs/entity/" />
  566. <exclude name="documentation/resources/images/pb-poi.cdr"/>
  567. */
  568. // Prints the list of files with unapproved licences to the console, defaults to false
  569. verbose.set(true)
  570. }
  571. /*task downloadJarsToLibs() {
  572. def f = new File("$projectDir/../lib/ooxml/xmlbeans-5.0.0.jar")
  573. if (!f.exists()) {
  574. println 'writing file ' + f.getAbsolutePath()
  575. f.getParentFile().mkdirs()
  576. new URL('https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/lastSuccessfulBuild/artifact/build/xmlbeans-5.0.0.jar').withInputStream{ i -> f.withOutputStream{ it << i }}
  577. }
  578. }*/
  579. //compileJava.dependsOn 'downloadJarsToLibs'
  580. task replaceVersion() {
  581. outputs.upToDateWhen { false }
  582. var version = subprojects[0].version
  583. var tokens = [
  584. [ 'osgi', 'pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ],
  585. [ 'osgi', 'pom.xml', '(<poi.version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ]
  586. // [ '.', 'build.gradle', ' version = \'[0-9.]+(?:-SNAPSHOT)?\'', " version = '${version}'" ]
  587. ]
  588. doLast {
  589. tokens.forEach {
  590. var dir = it[0], name = it[1], match = it[2], replace = it[3]
  591. ant.replaceregexp(match: match, replace: replace) {
  592. fileset(dir: dir) {
  593. include(name: name)
  594. }
  595. }
  596. }
  597. }
  598. }
  599. task zipJavadocs(type: Zip, dependsOn: allJavaDoc) {
  600. from('build/docs/javadoc/')
  601. destinationDirectory = file('build/dist')
  602. archiveBaseName = 'poi'
  603. archiveVersion = subprojects[0].version
  604. archiveAppendix = 'javadoc'
  605. archiveExtension = 'jar'
  606. }
  607. tasks.withType(Tar) {
  608. compression = Compression.GZIP
  609. archiveExtension = 'tgz'
  610. }
  611. distributions {
  612. var version = subprojects[0].version
  613. var date = new Date().format('yyyyMMdd')
  614. var poiDep = project(':poi').configurations.getAt('compileClasspath')
  615. var ooxmlImp = project(':poi-ooxml').configurations.getAt('compileClasspath')
  616. src {
  617. distributionBaseName = "poi-src-${version}-${date}"
  618. contents {
  619. from('.') {
  620. exclude '*/build/**'
  621. exclude 'build/**'
  622. exclude 'dist*/**'
  623. exclude 'lib/**'
  624. exclude 'lib.stored/**'
  625. exclude 'bin/**'
  626. exclude 'out/**'
  627. exclude 'tmp/**'
  628. exclude 'gradle/**'
  629. exclude 'sonar/**/target/**'
  630. exclude 'sonar/*/src/**'
  631. exclude 'compile-lib/**'
  632. exclude 'ooxml-lib/**'
  633. exclude 'ooxml-testlib/**'
  634. exclude 'scripts/**'
  635. exclude '.gradle/**'
  636. exclude '.idea/**'
  637. exclude '.classpath'
  638. exclude '.settings/**'
  639. exclude '.project'
  640. exclude 'TEST*'
  641. exclude 'gradlew'
  642. exclude 'gradlew.bat'
  643. exclude '**/*.iml'
  644. exclude '*.ipr'
  645. exclude '*.iws'
  646. exclude '*.rdf'
  647. exclude '*.png'
  648. exclude '*.gif'
  649. exclude '*.jpg'
  650. exclude '*.jpeg'
  651. exclude '*.swp'
  652. exclude '*.lnk'
  653. exclude '*.log'
  654. exclude '*.launch'
  655. exclude '*.docx'
  656. exclude '*.pptx'
  657. exclude '*.xlsx'
  658. // exclude intermediate files
  659. exclude '**/*-saved.xls'
  660. }
  661. from('legal') { exclude 'HEADER' }
  662. includeEmptyDirs = false
  663. duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  664. }
  665. }
  666. }
  667. task soLinkCheck() {
  668. doLast {
  669. def path = ant.path {
  670. fileset(dir: '.', includes: '**/*.java') {
  671. exclude(name: 'build.gradle')
  672. contains(text: 'stackoverflow.com')
  673. }
  674. }
  675. path.list().each {
  676. println it
  677. }
  678. if (path.size() > 0) {
  679. // #65796 - minimize notifications about non-asf open source
  680. throw new GradleException('License issue found - conceal the link and contradict any findings m(')
  681. }
  682. }
  683. }
  684. var srcDep = [
  685. ':poi:compileJava9',
  686. ':poi:compileTest9',
  687. ':poi-ooxml-full:compileJava9',
  688. ':poi-ooxml-lite-agent:compileJava9',
  689. ':poi-ooxml:compileJava9',
  690. ':poi-ooxml:compileTest9',
  691. ':poi-scratchpad:compileJava9',
  692. ':poi-scratchpad:compileTest9',
  693. ':poi-excelant:compileJava9',
  694. ':poi-excelant:compileTest9',
  695. ':poi-examples:compileJava9',
  696. ':poi-integration:compileTest9',
  697. ':poi-ooxml-lite:compileJava9',
  698. ':poi-ooxml-lite:generateModuleInfo'
  699. ]
  700. srcDistTar.dependsOn srcDep
  701. srcDistZip.dependsOn srcDep
  702. soLinkCheck.dependsOn srcDep
  703. rat.dependsOn soLinkCheck
  704. task fixDistDir {
  705. doLast {
  706. ant.mkdir(dir: 'build/dist')
  707. ant.move(todir: 'build/dist') {
  708. fileset(dir: 'build/distributions', includes: '*')
  709. }
  710. }
  711. }
  712. srcDistZip.finalizedBy fixDistDir
  713. srcDistTar.finalizedBy fixDistDir