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

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