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.

build.gradle 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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. buildscript {
  16. repositories {
  17. maven { url 'https://plugins.gradle.org/m2/' }
  18. mavenCentral()
  19. }
  20. dependencies {
  21. classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1'
  22. classpath 'de.thetaphi:forbiddenapis:3.1'
  23. }
  24. }
  25. plugins {
  26. id 'base'
  27. id('org.nosphere.apache.rat') version '0.7.0'
  28. id 'distribution'
  29. }
  30. repositories {
  31. mavenCentral()
  32. }
  33. // Only add the plugin for Sonar if enabled
  34. if (project.hasProperty('enableSonar')) {
  35. println 'Enabling Sonar support'
  36. apply plugin: 'org.sonarqube'
  37. }
  38. // For help converting an Ant build to a Gradle build, see
  39. // https://docs.gradle.org/current/userguide/ant.html
  40. configurations {
  41. antLibs {
  42. attributes {
  43. attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
  44. }
  45. }
  46. }
  47. dependencies {
  48. antLibs("org.junit.jupiter:junit-jupiter:5.7.1")
  49. antLibs("org.apache.ant:ant-junitlauncher:1.10.9")
  50. }
  51. ant.taskdef(name: "junit",
  52. classname: "org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask",
  53. classpath: configurations.antLibs.asPath)
  54. wrapper {
  55. // https://stackoverflow.com/a/54741656/2066598
  56. gradleVersion = '7.1'
  57. }
  58. task adjustWrapperPropertiesFile {
  59. doLast {
  60. ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
  61. fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
  62. }
  63. new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
  64. ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
  65. }
  66. }
  67. wrapper.finalizedBy adjustWrapperPropertiesFile
  68. /**
  69. Define properties for all projects, including this one
  70. */
  71. allprojects {
  72. // apply plugin: 'eclipse'
  73. apply plugin: 'idea'
  74. }
  75. /**
  76. Define things that are only necessary in sub-projects, but not in the master-project itself
  77. */
  78. subprojects {
  79. //Put instructions for each sub project, but not the master
  80. apply plugin: 'java-library'
  81. apply plugin: 'jacoco'
  82. apply plugin: 'maven-publish'
  83. apply plugin: 'signing'
  84. apply plugin: 'de.thetaphi.forbiddenapis'
  85. version = '5.0.1-SNAPSHOT'
  86. ext {
  87. bouncyCastleVersion = '1.69'
  88. commonsCodecVersion = '1.15'
  89. commonsCompressVersion = '1.21'
  90. commonsIoVersion = '2.11.0'
  91. commonsMathVersion = '3.6.1'
  92. junitVersion = '5.7.1'
  93. log4jVersion = '2.14.0'
  94. mockitoVersion = '3.6.0'
  95. hamcrestVersion = '2.2'
  96. xmlbeansVersion = '5.0.1'
  97. batikVersion = '1.14'
  98. JAVA9_SRC = 'src/main/java9'
  99. JAVA9_OUT = "${buildDir}/classes/java9/main/"
  100. TEST9_SRC = 'src/test/java9'
  101. TEST9_OUT = "${buildDir}/classes/java9/test/"
  102. VERSIONS9 = 'META-INF/versions/9'
  103. }
  104. tasks.withType(JavaCompile) {
  105. options.encoding = 'UTF-8'
  106. options.compilerArgs << '-Xlint:unchecked'
  107. options.deprecation = true
  108. }
  109. sourceCompatibility = JavaVersion.VERSION_1_8
  110. targetCompatibility = JavaVersion.VERSION_1_8
  111. repositories {
  112. mavenCentral()
  113. maven {
  114. url 'https://repository.apache.org/content/repositories/releases'
  115. }
  116. }
  117. dependencies {
  118. testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
  119. testImplementation "org.mockito:mockito-core:${mockitoVersion}"
  120. testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
  121. testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
  122. }
  123. task wrapper(type: Wrapper){
  124. // https://stackoverflow.com/a/65701523/2066598
  125. gradleVersion = '7.0.1'
  126. }
  127. java {
  128. withJavadocJar()
  129. withSourcesJar()
  130. }
  131. javadoc {
  132. failOnError = true
  133. maxMemory = "1024M"
  134. doFirst {
  135. options {
  136. if (JavaVersion.current().isJava9Compatible()) {
  137. addBooleanOption('html5', true)
  138. }
  139. addBooleanOption('Xdoclint:all,-missing', true)
  140. links 'https://poi.apache.org/apidocs/dev/'
  141. links 'https://docs.oracle.com/javase/8/docs/api/'
  142. links 'https://xmlbeans.apache.org/docs/5.0.0/'
  143. use = true
  144. splitIndex = true
  145. source = "1.8"
  146. }
  147. }
  148. }
  149. tasks.withType(Jar) {
  150. duplicatesStrategy = 'fail'
  151. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  152. doLast {
  153. ant.checksum(file: it.archivePath, algorithm: 'SHA-256', fileext: '.sha256', format: 'MD5SUM')
  154. ant.checksum(file: it.archivePath, algorithm: 'SHA-512', fileext: '.sha512', format: 'MD5SUM')
  155. }
  156. }
  157. jar {
  158. manifest {
  159. attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': project.version
  160. }
  161. }
  162. javadocJar {
  163. // if javadocs and binaries are in the same directory, JPMS complaints about duplicated modules
  164. // in the module-path
  165. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}-javadoc")
  166. }
  167. sourcesJar {
  168. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  169. exclude 'META-INF/services/**'
  170. }
  171. test {
  172. // make XML test-results available for Jenkins CI
  173. useJUnitPlatform()
  174. reports {
  175. junitXml.enabled = true
  176. }
  177. // Exclude some tests that are not actually tests or do not run cleanly on purpose
  178. exclude '**/BaseTestBorderStyle.class'
  179. exclude '**/BaseTestCellUtil.class'
  180. exclude '**/TestUnfixedBugs.class'
  181. exclude '**/TestOneFile.class'
  182. // Exclude Test Suites
  183. exclude '**/All*Tests.class'
  184. exclude '**/HSSFTests.class'
  185. // set heap size for the test JVM(s)
  186. minHeapSize = "128m"
  187. maxHeapSize = "768m"
  188. // Specifying the local via system properties did not work, so we set them this way
  189. jvmArgs << [
  190. '-Djava.io.tmpdir=build',
  191. '-DPOI.testdata.path=../test-data',
  192. '-Djava.awt.headless=true',
  193. '-Djava.locale.providers=JRE,CLDR',
  194. '-Duser.language=en',
  195. '-Duser.country=US',
  196. '-Djavax.xml.stream.XMLInputFactory=com.sun.xml.internal.stream.XMLInputFactoryImpl',
  197. "-Dversion.id=${project.version}",
  198. '-ea',
  199. '-Djunit.jupiter.execution.parallel.enabled=true',
  200. '-Djunit.jupiter.execution.parallel.config.strategy=fixed',
  201. '-Djunit.jupiter.execution.parallel.config.fixed.parallelism=3'
  202. // -Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock} ... if ${isIBMVM}
  203. ]
  204. // show standard out and standard error of the test JVM(s) on the console
  205. //testLogging.showStandardStreams = true
  206. // http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build
  207. systemProperties['user.dir'] = workingDir
  208. systemProperties['POI.testdata.path'] = '../test-data'
  209. // this is necessary for JDK 9+ to keep formatting dates the same way as in previous JDK-versions
  210. systemProperties['java.locale.providers'] = 'JRE,CLDR'
  211. systemProperties['junit.jupiter.execution.parallel.enabled'] = 'false'
  212. doFirst {
  213. if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
  214. jvmArgs += [
  215. '-Dsun.reflect.debugModuleAccessChecks=true',
  216. '-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
  217. '--illegal-access=warn',
  218. // see https://github.com/java9-modularity/gradle-modules-plugin/issues/97
  219. // opposed to the recommendation there, it doesn't work to add ... to the dependencies
  220. // testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.1'
  221. // gradles gradle-worker.jar is still not a JPMS module and thus runs as unnamed module
  222. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=org.apache.poi.poi',
  223. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
  224. '--add-exports','org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED',
  225. ]
  226. }
  227. }
  228. }
  229. jacoco {
  230. toolVersion = '0.8.6'
  231. }
  232. jacocoTestReport {
  233. reports {
  234. xml.enabled true
  235. }
  236. }
  237. // ensure the build-dir exists
  238. projectDir.mkdirs()
  239. if (project.hasProperty('enableSonar')) {
  240. // See https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/ and
  241. // https://docs.sonarqube.org/display/SONARQUBE52/Analyzing+with+SonarQube+Scanner+for+Gradle
  242. // for documentation of properties.
  243. //
  244. // Some additional properties are currently set in the Jenkins-DSL, see jenksin/create_jobs.groovy
  245. //
  246. sonarqube {
  247. properties {
  248. // as we currently use build/<module>/ as project-basedir, we need to tell Sonar to use
  249. // the root-folder as "basedir" for the projects
  250. property "sonar.projectBaseDir", "$projectDir"
  251. // currently supported providers on Jenkins: "hg,git": property "sonar.scm.provider", "svn"
  252. // the plugin seems to not detect our non-standard build-layout
  253. property "sonar.junit.reportPaths", "$projectDir/build/test-results/test"
  254. // the Gradle run will report an invalid directory for 'ooxml-schema', but it seems to still work fine
  255. property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/test/jacocoTestReport.xml"
  256. // somehow the version was not use properly
  257. property "sonar.projectVersion", version
  258. }
  259. }
  260. }
  261. forbiddenApis {
  262. bundledSignatures = [ 'jdk-unsafe', 'jdk-deprecated', 'jdk-internal', 'jdk-non-portable', 'jdk-reflection' ]
  263. signaturesFiles = files('../src/resources/devtools/forbidden-signatures.txt')
  264. ignoreFailures = false
  265. suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ]
  266. // forbiddenapis bundled signatures max supported version is 14
  267. targetCompatibility = (JavaVersion.VERSION_14.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_14)
  268. }
  269. forbiddenApisMain {
  270. signaturesFiles = files('../src/resources/devtools/forbidden-signatures-prod.txt')
  271. }
  272. task jenkins
  273. jenkins.dependsOn build
  274. jenkins.dependsOn check
  275. jenkins.dependsOn javadoc
  276. jenkins.dependsOn jacocoTestReport
  277. jenkins.dependsOn rat
  278. publishing {
  279. publications {
  280. POI(MavenPublication) {
  281. groupId 'org.apache.poi'
  282. artifactId project.archivesBaseName
  283. from components.java
  284. pom {
  285. packaging = 'jar'
  286. url = 'https://poi.apache.org/'
  287. name = 'Apache POI'
  288. description = 'Apache POI - Java API To Access Microsoft Format Files'
  289. mailingLists {
  290. mailingList {
  291. name = 'POI Users List'
  292. subscribe = 'user-subscribe@poi.apache.org'
  293. unsubscribe = 'user-unsubscribe@poi.apache.org'
  294. archive = 'http://mail-archives.apache.org/mod_mbox/poi-user/'
  295. }
  296. mailingList {
  297. name = 'POI Developer List'
  298. subscribe = 'dev-subscribe@poi.apache.org'
  299. unsubscribe = 'dev-unsubscribe@poi.apache.org'
  300. archive = 'http://mail-archives.apache.org/mod_mbox/poi-dev/'
  301. }
  302. }
  303. licenses {
  304. license {
  305. name = 'Apache License, Version 2.0'
  306. url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  307. distribution = 'repo'
  308. }
  309. }
  310. organization {
  311. name = 'Apache Software Foundation'
  312. url = 'http://www.apache.org/'
  313. }
  314. withXml {
  315. def r = asElement()
  316. def doc = r.getOwnerDocument()
  317. def hdr = new File('../legal/HEADER')
  318. if (!hdr.exists()) hdr = new File('legal/HEADER')
  319. def asl = doc.createComment(hdr.text)
  320. // adding ASF header before root node is ignored
  321. // doc.insertBefore(asl, doc.getDocumentElement())
  322. r.insertBefore(asl, r.getFirstChild())
  323. }
  324. }
  325. }
  326. }
  327. }
  328. generatePomFileForPOIPublication.destination = "../build/dist/maven/${project.archivesBaseName}/${project.archivesBaseName}-${project.version}.pom"
  329. signing {
  330. sign publishing.publications.POI
  331. }
  332. }
  333. // initial try to provide a combined JavaDoc, grouping is still missing here, though!
  334. task allJavaDoc(type: Javadoc) {
  335. var prj = [ project(':poi'), project(':poi-excelant'), project(':poi-ooxml'), project(':poi-scratchpad') ]
  336. source prj.collect { it.sourceSets.main.allJava }
  337. // for possible settings see https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html
  338. classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
  339. destinationDir = file("${buildDir}/docs/javadoc")
  340. maxMemory="2048M"
  341. // for possible options see https://docs.gradle.org/current/javadoc/org/gradle/external/javadoc/StandardJavadocDocletOptions.html
  342. options.use = true
  343. options.splitIndex = true
  344. options.addBooleanOption('Xdoclint:all,-missing', true)
  345. title = 'POI API Documentation'
  346. options.bottom = '<![CDATA[<i>Copyright ' + new Date().format('yyyy') + ' The Apache Software Foundation or\n' +
  347. 'its licensors, as applicable.</i>]]>'
  348. options.group('DDF - Dreadful Drawing Format', 'org.apache.poi.ddf*')
  349. options.group('HPSF - Horrible Property Set Format', 'org.apache.poi.hpsf*')
  350. options.group('SS - Common Spreadsheet Format', 'org.apache.poi.ss*')
  351. options.group('HSSF - Horrible Spreadsheet Format', 'org.apache.poi.hssf*')
  352. options.group('XSSF - Open Office XML Spreadsheet Format', 'org.apache.poi.xssf*')
  353. options.group('SL - Common Slideshow Format', 'org.apache.poi.sl*')
  354. options.group('HSLF - Horrible Slideshow Format', 'org.apache.poi.hslf*', 'org.apache.poi.hwmf*', 'org.apache.poi.hemf*')
  355. options.group('XSLF - Open Office XML Slideshow Format', 'org.apache.poi.xslf*')
  356. options.group('HWPF - Horrible Word Processor Format', 'org.apache.poi.hwpf*')
  357. options.group('XWPF - Open Office XML Word Processor Format', 'org.apache.poi.xwpf*')
  358. options.group('HDGF - Horrible Diagram Format', 'org.apache.poi.hdgf*')
  359. options.group('XDGF - Open Office XML Diagram Format', 'org.apache.poi.xdgf*')
  360. options.group('HMEF - Transport Neutral Encoding Files (TNEF)', 'org.apache.poi.hmef*')
  361. options.group('HSMF Outlook message file format', 'org.apache.poi.hsmf*')
  362. options.group('HPBF - Publisher Format Files', 'org.apache.poi.hpbf*')
  363. options.group('POIFS - POI File System', 'org.apache.poi.poifs*')
  364. options.group('Utilities', 'org.apache.poi.util*')
  365. options.group('Excelant', 'org.apache.poi.ss.excelant**')
  366. // options.group('Examples', 'org.apache.poi.examples*')
  367. }
  368. task jenkins(dependsOn: ['replaceVersion', subprojects.build, 'binDistZip','binDistTar','srcDistZip','srcDistTar']) {}
  369. clean {
  370. delete "${rootDir}/build/dist"
  371. }
  372. rat {
  373. // Input directory, defaults to '.'
  374. inputDir.set(file("."))
  375. // include all directories which contain files that are included in releases
  376. includes = [
  377. "poi-examples/**",
  378. "poi-excelant/**",
  379. "poi-integration/**",
  380. "legal/**",
  381. "poi/**",
  382. "maven/**",
  383. "poi-ooxml/**",
  384. "poi-ooxml-full/**",
  385. "poi-ooxml-lite/**",
  386. "poi-ooxml-lite-agent/**",
  387. "osgi/**",
  388. "poi-scratchpad/**",
  389. "src/**",
  390. // "sonar/**",
  391. "build.*"
  392. ]
  393. // List of Gradle exclude directives, defaults to ['**/.gradle/**']
  394. //excludes.add("main/java/org/apache/poi/**/*-chart-data.txt")
  395. excludes = [
  396. "build.javacheck.xml",
  397. "**/build/**",
  398. "**/out/**",
  399. "**/*.iml",
  400. "**/*.log",
  401. "**/gradle-wrapper.properties",
  402. "**/main/java/org/apache/poi/**/*-chart-data.txt",
  403. "poi/src/main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml",
  404. "poi-ooxml/src/main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml",
  405. "poi-ooxml/src/main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml",
  406. "poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/XAdES*.xsd",
  407. "poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/xmldsig-core-schema.xsd",
  408. "poi-ooxml-full/src/main/xmlschema/org/apache/poi/xdgf/visio.xsd",
  409. "osgi/README.md"
  410. ]
  411. /*
  412. <exclude name="documentation/*.txt" />
  413. <exclude name="documentation/content/xdocs/dtd/" />
  414. <exclude name="documentation/content/xdocs/entity/" />
  415. <exclude name="documentation/resources/images/pb-poi.cdr"/>
  416. */
  417. // Prints the list of files with unapproved licences to the console, defaults to false
  418. verbose.set(true)
  419. }
  420. /*task downloadJarsToLibs() {
  421. def f = new File("$projectDir/../lib/ooxml/xmlbeans-5.0.0.jar")
  422. if (!f.exists()) {
  423. println 'writing file ' + f.getAbsolutePath()
  424. f.getParentFile().mkdirs()
  425. 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 }}
  426. }
  427. }*/
  428. //compileJava.dependsOn 'downloadJarsToLibs'
  429. task replaceVersion() {
  430. outputs.upToDateWhen { false }
  431. var version = subprojects[0].version
  432. var tokens = [
  433. [ 'sonar', '**/pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT)?', "\\1${version}" ],
  434. [ 'sonar', '**/pom.xml', '(poi-parent&lt;/artifactId>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT)?', "\1${version}" ],
  435. [ 'osgi', 'pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT)?', "\\1${version}" ]
  436. // [ '.', 'build.gradle', ' version = \'[0-9.]+(?:-SNAPSHOT)?\'', " version = '${version}'" ]
  437. ]
  438. doLast {
  439. tokens.forEach {
  440. var dir = it[0], name = it[1], match = it[2], replace = it[3]
  441. ant.replaceregexp(match: match, replace: replace) {
  442. fileset(dir: dir) {
  443. include(name: name)
  444. }
  445. }
  446. }
  447. }
  448. }
  449. task zipJavadocs(type: Zip, dependsOn: allJavaDoc) {
  450. from('build/docs/javadoc/')
  451. destinationDir = file('build/dist')
  452. archiveBaseName = 'poi'
  453. archiveVersion = subprojects[0].version
  454. archiveAppendix = 'javadoc'
  455. archiveExtension = 'jar'
  456. }
  457. tasks.withType(Tar) {
  458. compression = Compression.GZIP
  459. archiveExtension = 'tgz'
  460. }
  461. distributions {
  462. var version = subprojects[0].version
  463. var date = new Date().format('yyyyMMdd')
  464. var poiDep = project(':poi').configurations.getAt('compileClasspath')
  465. var ooxmlImp = project(':poi-ooxml').configurations.getAt('compileClasspath')
  466. bin {
  467. distributionBaseName = "poi-bin-${version}-${date}"
  468. contents {
  469. from('build/dist/maven') {
  470. include "**/*${version}.jar"
  471. exclude "**/*lite-agent*.jar"
  472. exclude "**/*integration*.jar"
  473. }
  474. from('build/dist') { include 'poi-javadoc*.jar'}
  475. from('legal') { exclude 'HEADER' }
  476. from(poiDep) { include "**/*.jar" }
  477. from(ooxmlImp) { include "**/*.jar" }
  478. includeEmptyDirs = false
  479. duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  480. eachFile {
  481. var root = "poi-bin-${version}/"
  482. if (name.startsWith('poi')) {
  483. path = root + name
  484. } else if (poiDep.contains(file)) {
  485. path = root + 'lib/' + name
  486. } else if (name =~ /^(batik|bc|fontbox|graphics|pdfbox|xml-apis|xmlgraphics|xmlsec)/) {
  487. path = root + 'auxiliary/' + name
  488. } else if (ooxmlImp.contains(file)) {
  489. path = root + 'ooxml-lib/' + name
  490. } else {
  491. path = root + name
  492. }
  493. }
  494. }
  495. }
  496. src {
  497. distributionBaseName = "poi-src-${version}-${date}"
  498. contents {
  499. from('.') {
  500. exclude '*/build/**'
  501. exclude 'build/**'
  502. exclude 'dist*/**'
  503. exclude 'lib/**'
  504. exclude 'lib.stored/**'
  505. exclude 'bin/**'
  506. exclude 'out/**'
  507. exclude 'tmp/**'
  508. exclude 'gradle/**'
  509. exclude 'sonar/**/target/**'
  510. exclude 'sonar/*/src/**'
  511. exclude 'compile-lib/**'
  512. exclude 'ooxml-lib/**'
  513. exclude 'ooxml-testlib/**'
  514. exclude 'scripts/**'
  515. exclude '.gradle/**'
  516. exclude '.idea/**'
  517. exclude '.classpath'
  518. exclude '.settings/**'
  519. exclude '.project'
  520. exclude 'TEST*'
  521. exclude 'gradlew'
  522. exclude 'gradlew.bat'
  523. exclude '**/*.iml'
  524. exclude '*.ipr'
  525. exclude '*.iws'
  526. exclude '*.rdf'
  527. exclude '*.png'
  528. exclude '*.gif'
  529. exclude '*.jpg'
  530. exclude '*.jpeg'
  531. exclude '*.swp'
  532. exclude '*.lnk'
  533. exclude '*.log'
  534. exclude '*.launch'
  535. exclude '*.docx'
  536. exclude '*.pptx'
  537. exclude '*.xlsx'
  538. }
  539. from('legal') { exclude 'HEADER' }
  540. }
  541. }
  542. }
  543. binDistZip.dependsOn 'zipJavadocs'
  544. binDistTar.dependsOn 'zipJavadocs'
  545. var srcDep = [
  546. ':poi:cacheJava9',
  547. ':poi:cacheTest9',
  548. ':poi-ooxml-full:cacheJava9',
  549. ':poi-ooxml-lite-agent:cacheJava9',
  550. ':poi-ooxml:cacheJava9',
  551. ':poi-ooxml:cacheTest9',
  552. ':poi-scratchpad:cacheJava9',
  553. ':poi-scratchpad:cacheTest9',
  554. ':poi-excelant:cacheJava9',
  555. ':poi-excelant:cacheTest9',
  556. ':poi-examples:cacheJava9',
  557. ':poi-integration:cacheTest9',
  558. ':poi-ooxml-lite:cacheJava9',
  559. ':poi-ooxml-lite:generateModuleInfo'
  560. ]
  561. srcDistTar.dependsOn srcDep
  562. srcDistZip.dependsOn srcDep
  563. rat.dependsOn srcDep