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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 java.util.regex.Pattern
  16. sourceSets {
  17. main {
  18. output.dir(JAVA9_OUT, builtBy: 'compileJava9')
  19. }
  20. }
  21. dependencies {
  22. api project(':poi-ooxml')
  23. implementation project(path: ':poi', configuration: 'archives')
  24. compileOnly project(path: ':poi-ooxml', configuration: 'archives')
  25. compileOnly project(path: ':poi-ooxml-full', configuration: 'archives')
  26. if (NO_SCRATCHPAD) {
  27. compileOnly project(path: ':poi-scratchpad', configuration: 'archives')
  28. } else {
  29. implementation project(path: ':poi-scratchpad', configuration: 'archives')
  30. }
  31. implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
  32. testImplementation(project(path: ':poi-ooxml', configuration: 'tests')) {
  33. if (NO_SCRATCHPAD) {
  34. exclude group: 'org.apache.poi', module: 'poi-scratchpad'
  35. }
  36. }
  37. testImplementation project(path: ':poi', configuration: 'tests')
  38. }
  39. final String MODULE_NAME = 'org.apache.poi.examples'
  40. final Pattern MODULE_REGEX = ~'\\.jar$'
  41. final List MODULE_COMPILE_PATH = sourceSets.main.compileClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
  42. task compileJava9(type: JavaCompile) {
  43. dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
  44. javaCompiler = javaToolchains.compilerFor {
  45. languageVersion = JavaLanguageVersion.of(Math.max(11, jdkVersion))
  46. }
  47. sourceCompatibility = 1.9
  48. targetCompatibility = 1.9
  49. destinationDirectory = file(JAVA9_OUT + VERSIONS9)
  50. source = file(JAVA9_SRC)
  51. classpath = files()
  52. options.compilerArgs = [
  53. '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
  54. '--module-path', files(MODULE_COMPILE_PATH).asPath
  55. ]
  56. }
  57. jar {
  58. dependsOn compileJava9
  59. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  60. manifest {
  61. attributes('Automatic-Module-Name': MODULE_NAME, 'Multi-Release': 'true')
  62. }
  63. }
  64. javadocJar {
  65. metaInf {
  66. from("$projectDir/../legal/LICENSE")
  67. from("$projectDir/../legal/NOTICE")
  68. }
  69. }
  70. sourcesJar {
  71. metaInf {
  72. from("$projectDir/../legal/LICENSE")
  73. from("$projectDir/../legal/NOTICE")
  74. }
  75. }
  76. cyclonedxBom {
  77. // includeConfigs is the list of configuration names to include when generating the BOM (leave empty to include every configuration)
  78. includeConfigs = ["runtimeClasspath"]
  79. // skipConfigs is a list of configuration names to exclude when generating the BOM
  80. //skipConfigs = ["compileClasspath", "testCompileClasspath"]
  81. // Specified the type of project being built. Defaults to 'library'
  82. projectType = "library"
  83. // Specified the version of the CycloneDX specification to use. Defaults to 1.4.
  84. schemaVersion = "1.4"
  85. // Boms destination directory (defaults to build/reports)
  86. destination = file("build/reports")
  87. // The file name for the generated BOMs (before the file format suffix). Defaults to 'bom'
  88. outputName = "poi-examples-${project.version}.bom"
  89. // The file format generated, can be xml, json or all for generating both
  90. outputFormat = "all"
  91. // Exclude BOM Serial Number
  92. includeBomSerialNumber = true
  93. }