Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

build.gradle 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
  19. output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
  20. }
  21. }
  22. }
  23. dependencies {
  24. api project(':poi-ooxml')
  25. api project(':poi-scratchpad')
  26. implementation project(path: ':poi-ooxml', configuration: 'archives')
  27. implementation project(path: ':poi-ooxml-full', configuration: 'archives')
  28. implementation project(path: ':poi-scratchpad', configuration: 'archives')
  29. implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
  30. testImplementation project(path: ':poi-ooxml', configuration: 'tests')
  31. testImplementation project(path: ':poi', configuration: 'tests')
  32. }
  33. final String MODULE_NAME = 'org.apache.poi.examples'
  34. final Pattern MODULE_REGEX = ~'\\.jar$'
  35. final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
  36. task compileJava9(type: JavaCompile) {
  37. dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
  38. sourceCompatibility = 9
  39. targetCompatibility = 9
  40. destinationDirectory = file(JAVA9_OUT + VERSIONS9)
  41. source = file(JAVA9_SRC)
  42. classpath = files()
  43. options.compilerArgs = [
  44. '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
  45. '--module-path', files(MAIN_MODULE_PATH).asPath
  46. ]
  47. }
  48. task cacheJava9(type: Copy) {
  49. dependsOn 'compileJava9'
  50. from(file(JAVA9_OUT + VERSIONS9))
  51. into(JAVA9_SRC)
  52. }
  53. jar {
  54. dependsOn cacheJava9
  55. destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
  56. if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
  57. into('META-INF/versions/9') {
  58. from JAVA9_SRC include '*.class'
  59. }
  60. }
  61. manifest {
  62. attributes('Automatic-Module-Name': MODULE_NAME, 'Multi-Release': 'true')
  63. }
  64. }