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 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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. }
  19. dependencies {
  20. classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.2'
  21. }
  22. }
  23. // For help converting an Ant build to a Gradle build, see
  24. // https://docs.gradle.org/current/userguide/ant.html
  25. ant.importBuild 'build.xml'
  26. /**
  27. Define properties for all projects, including this one
  28. */
  29. allprojects {
  30. apply plugin: 'eclipse'
  31. task wrapper(type: Wrapper) {
  32. gradleVersion = '2.14.1'
  33. }
  34. task adjustWrapperPropertiesFile << {
  35. ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
  36. fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
  37. }
  38. new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
  39. ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
  40. }
  41. wrapper.finalizedBy adjustWrapperPropertiesFile
  42. }
  43. /**
  44. Define things that are only necessary in sub-projects, but not in the master-project itself
  45. */
  46. subprojects {
  47. //Put instructions for each sub project, but not the master
  48. apply plugin: 'java'
  49. apply plugin: 'jacoco'
  50. // See https://github.com/melix/japicmp-gradle-plugin
  51. apply plugin: 'me.champeau.gradle.japicmp'
  52. version = '3.16-beta1'
  53. ext {
  54. japicmpversion = '3.15'
  55. }
  56. tasks.withType(JavaCompile) {
  57. options.encoding = 'UTF-8'
  58. }
  59. sourceCompatibility = 1.6
  60. repositories {
  61. mavenCentral()
  62. }
  63. jar {
  64. manifest {
  65. attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version
  66. }
  67. }
  68. test {
  69. // Exclude some tests that are not actually tests or do not run cleanly on purpose
  70. exclude '**/BaseTestBorderStyle.class'
  71. exclude '**/BaseTestCellUtil.class'
  72. exclude '**/TestUnfixedBugs.class'
  73. exclude '**/TestOneFile.class'
  74. systemProperties = System.properties
  75. // set heap size for the test JVM(s)
  76. minHeapSize = "128m"
  77. maxHeapSize = "768m"
  78. // show standard out and standard error of the test JVM(s) on the console
  79. //testLogging.showStandardStreams = true
  80. // http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build
  81. systemProperties['user.dir'] = workingDir
  82. systemProperties['POI.testdata.path'] = '../../test-data'
  83. //systemProperties['user.language'] = 'en'
  84. //systemProperties['user.country'] = 'US'
  85. }
  86. test.beforeSuite { TestDescriptor suite ->
  87. System.setProperty('user.language', 'en')
  88. System.setProperty('user.country', 'US')
  89. }
  90. jacoco {
  91. toolVersion = '0.7.7.201606060606'
  92. }
  93. // ensure the build-dir exists
  94. projectDir.mkdirs()
  95. }
  96. project('main') {
  97. sourceSets.main.java.srcDirs = ['../../src/java']
  98. sourceSets.main.resources.srcDirs = ['../../src/resources/main']
  99. sourceSets.test.java.srcDirs = ['../../src/testcases']
  100. dependencies {
  101. compile 'commons-codec:commons-codec:1.10'
  102. compile 'commons-logging:commons-logging:1.2'
  103. testCompile 'junit:junit:4.12'
  104. }
  105. // Create a separate jar for test-code to depend on it in other projects
  106. // See http://stackoverflow.com/questions/5144325/gradle-test-dependency
  107. task testJar(type: Jar, dependsOn: testClasses) {
  108. baseName = "test-${project.archivesBaseName}"
  109. from sourceSets.test.output
  110. }
  111. configurations {
  112. tests
  113. }
  114. artifacts {
  115. tests testJar
  116. }
  117. // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
  118. task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
  119. baseline = 'org.apache.poi:poi:' + japicmpversion + '@jar'
  120. to = jar.archivePath
  121. onlyModified = true
  122. onlyBinaryIncompatibleModified = true
  123. failOnModification = false
  124. txtOutputFile = file("$buildDir/reports/japi.txt")
  125. htmlOutputFile = file("$buildDir/reports/japi.html")
  126. }
  127. }
  128. project('ooxml') {
  129. sourceSets.main.java.srcDirs = ['../../src/ooxml/java']
  130. sourceSets.main.resources.srcDirs = ['../../src/ooxml/resources', '../../src/resources/ooxml']
  131. sourceSets.test.java.srcDirs = ['../../src/ooxml/testcases']
  132. // for now import the ant-task for building the jars from build.xml
  133. // we need to rename the tasks as e.g. task "jar" conflicts with :ooxml:jar
  134. ant.importBuild('../../build.xml') { antTargetName ->
  135. 'ant-' + antTargetName
  136. }
  137. compileJava.dependsOn 'ant-compile-ooxml-xsds'
  138. dependencies {
  139. compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
  140. compile 'org.apache.commons:commons-collections4:4.1'
  141. compile 'org.apache.santuario:xmlsec:2.0.6'
  142. compile 'org.bouncycastle:bcpkix-jdk15on:1.54'
  143. compile 'com.github.virtuald:curvesapi:1.04'
  144. // for ooxml-lite, should we move this somewhere else?
  145. compile 'junit:junit:4.12'
  146. compile project(':main')
  147. compile project(':scratchpad') // TODO: get rid of this dependency!
  148. compile files('../../ooxml-lib/ooxml-schemas-1.3.jar')
  149. compile files('../../ooxml-lib/ooxml-security-1.1.jar')
  150. testCompile 'junit:junit:4.12'
  151. testCompile project(path: ':main', configuration: 'tests')
  152. }
  153. // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
  154. task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
  155. baseline = 'org.apache.poi:poi-ooxml:' + japicmpversion + '@jar'
  156. to = jar.archivePath
  157. onlyModified = true
  158. onlyBinaryIncompatibleModified = true
  159. failOnModification = false
  160. txtOutputFile = file("$buildDir/reports/japi.txt")
  161. htmlOutputFile = file("$buildDir/reports/japi.html")
  162. }
  163. }
  164. project('examples') {
  165. sourceSets.main.java.srcDirs = ['../../src/examples/src']
  166. dependencies {
  167. compile project(':main')
  168. compile project(':ooxml')
  169. }
  170. }
  171. project('excelant') {
  172. sourceSets.main.java.srcDirs = ['../../src/excelant/java']
  173. sourceSets.main.resources.srcDirs = ['../../src/excelant/resources']
  174. sourceSets.test.java.srcDirs = ['../../src/excelant/testcases']
  175. dependencies {
  176. compile 'org.apache.ant:ant:1.9.4'
  177. compile project(':main')
  178. compile project(':ooxml')
  179. testCompile project(path: ':main', configuration: 'tests')
  180. }
  181. // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
  182. task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
  183. baseline = 'org.apache.poi:poi-excelant:' + japicmpversion + '@jar'
  184. to = jar.archivePath
  185. onlyModified = true
  186. onlyBinaryIncompatibleModified = true
  187. failOnModification = false
  188. txtOutputFile = file("$buildDir/reports/japi.txt")
  189. htmlOutputFile = file("$buildDir/reports/japi.html")
  190. }
  191. }
  192. project('integrationtest') {
  193. sourceSets.test.java.srcDirs = ['../../src/integrationtest']
  194. dependencies {
  195. compile 'org.apache.ant:ant:1.9.4'
  196. compile project(':main')
  197. compile project(':ooxml')
  198. compile project(':scratchpad')
  199. compile project(':examples')
  200. testCompile 'junit:junit:4.12'
  201. }
  202. test {
  203. // exclude these from the normal test-run
  204. exclude '**/TestAllFiles.class'
  205. exclude '**/*FileHandler.class'
  206. exclude '**/RecordsStresser.class'
  207. }
  208. task integrationTest(type: Test) {
  209. // these are just tests used during development of more test-code
  210. exclude '**/*FileHandler.class'
  211. exclude '**/RecordStresser.class'
  212. }
  213. }
  214. project('scratchpad') {
  215. sourceSets.main.java.srcDirs = ['../../src/scratchpad/src']
  216. sourceSets.main.resources.srcDirs = ['../../src/resources/scratchpad']
  217. sourceSets.test.java.srcDirs = ['../../src/scratchpad/testcases']
  218. dependencies {
  219. compile project(':main')
  220. // cyclic-dependency here: compile project(':ooxml')
  221. testCompile 'junit:junit:4.12'
  222. testCompile project(path: ':main', configuration: 'tests')
  223. }
  224. // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
  225. task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
  226. baseline = 'org.apache.poi:poi-scratchpad:' + japicmpversion + '@jar'
  227. to = jar.archivePath
  228. onlyModified = true
  229. onlyBinaryIncompatibleModified = true
  230. failOnModification = false
  231. txtOutputFile = file("$buildDir/reports/japi.txt")
  232. htmlOutputFile = file("$buildDir/reports/japi.html")
  233. }
  234. }