mirror of
https://github.com/apache/poi.git
synced 2025-02-08 02:58:18 +00:00
Some changes to the Gradle build
Apply IDE suggestions for Gradle build files Remove obsolete sorting of gradle-wrapper.properties git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
045a37f9c1
commit
1dbcea46d5
77
build.gradle
77
build.gradle
@ -80,17 +80,6 @@ wrapper {
|
||||
gradleVersion = '8.12'
|
||||
}
|
||||
|
||||
task adjustWrapperPropertiesFile {
|
||||
doLast {
|
||||
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
|
||||
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
|
||||
}
|
||||
new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
|
||||
ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
|
||||
}
|
||||
}
|
||||
wrapper.finalizedBy adjustWrapperPropertiesFile
|
||||
|
||||
group = 'org.apache.poi'
|
||||
|
||||
/**
|
||||
@ -150,7 +139,7 @@ subprojects {
|
||||
}
|
||||
|
||||
configurations {
|
||||
all {
|
||||
configureEach {
|
||||
resolutionStrategy {
|
||||
force "commons-io:commons-io:${commonsIoVersion}"
|
||||
force 'org.slf4j:slf4j-api:2.0.16'
|
||||
@ -159,16 +148,16 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
options.compilerArgs += '-Xlint:unchecked'
|
||||
options.deprecation = true
|
||||
options.incremental = true
|
||||
}
|
||||
tasks.withType(Test) {
|
||||
tasks.withType(Test).configureEach {
|
||||
systemProperty "file.encoding", "UTF-8"
|
||||
}
|
||||
tasks.withType(Javadoc) {
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
tasks.withType(AbstractArchiveTask).configureEach {
|
||||
@ -227,13 +216,13 @@ subprojects {
|
||||
|
||||
// helper-target to get a directory with all third-party libraries
|
||||
// this is used for mass-regression-testing
|
||||
task getDeps(type: Copy) {
|
||||
tasks.register('getDeps', Copy) {
|
||||
from sourceSets.main.runtimeClasspath
|
||||
into 'build/runtime/'
|
||||
}
|
||||
|
||||
tasks.withType(Jar) {
|
||||
duplicatesStrategy = 'fail'
|
||||
tasks.withType(Jar).configureEach {
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
|
||||
|
||||
doLast {
|
||||
@ -375,10 +364,10 @@ subprojects {
|
||||
]
|
||||
|
||||
// detect if running on Jenkins/CI
|
||||
isCIBuild |= Boolean.valueOf(System.getenv("CI_BUILD"));
|
||||
isCIBuild |= Boolean.valueOf(System.getenv("CI_BUILD"))
|
||||
|
||||
if (isCIBuild) {
|
||||
System.out.println("Run with reduced parallelism for CI build");
|
||||
System.out.println("Run with reduced parallelism for CI build")
|
||||
|
||||
jvmArgs += [
|
||||
// Strictly serial
|
||||
@ -597,7 +586,7 @@ subprojects {
|
||||
|
||||
generatePomFileForPOIPublication.destination = "../build/dist/maven/${project.archivesBaseName}/${project.archivesBaseName}-${project.version}.pom"
|
||||
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
tasks.withType(GenerateModuleMetadata).configureEach {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
@ -625,14 +614,14 @@ subprojects {
|
||||
}
|
||||
|
||||
// initial try to provide a combined JavaDoc, grouping is still missing here, though!
|
||||
task allJavaDoc(type: Javadoc) {
|
||||
var prj = [ project(':poi'), project(':poi-excelant'), project(':poi-ooxml'), project(':poi-scratchpad') ]
|
||||
tasks.register('allJavaDoc', Javadoc) {
|
||||
var prj = [project(':poi'), project(':poi-excelant'), project(':poi-ooxml'), project(':poi-scratchpad')]
|
||||
source prj.collect { it.sourceSets.main.allJava }
|
||||
|
||||
// for possible settings see https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html
|
||||
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
|
||||
destinationDir = file("${buildDir}/docs/javadoc")
|
||||
maxMemory="2048M"
|
||||
maxMemory = "2048M"
|
||||
|
||||
// for possible options see https://docs.gradle.org/current/javadoc/org/gradle/external/javadoc/StandardJavadocDocletOptions.html
|
||||
options.use = true
|
||||
@ -647,7 +636,7 @@ task allJavaDoc(type: Javadoc) {
|
||||
options.group('SS - Common Spreadsheet Format', 'org.apache.poi.ss*')
|
||||
options.group('HSSF - Horrible Spreadsheet Format', 'org.apache.poi.hssf*')
|
||||
options.group('XSSF - Open Office XML Spreadsheet Format', 'org.apache.poi.xssf*')
|
||||
options.group('SL - Common Slideshow Format', 'org.apache.poi.sl*')
|
||||
options.group('SL - Common Slideshow Format', 'org.apache.poi.sl*')
|
||||
options.group('HSLF - Horrible Slideshow Format', 'org.apache.poi.hslf*', 'org.apache.poi.hwmf*', 'org.apache.poi.hemf*')
|
||||
options.group('XSLF - Open Office XML Slideshow Format', 'org.apache.poi.xslf*')
|
||||
options.group('HWPF - Horrible Word Processor Format', 'org.apache.poi.hwpf*')
|
||||
@ -725,21 +714,21 @@ rat {
|
||||
}
|
||||
|
||||
task jenkins(dependsOn: [
|
||||
'replaceVersion',
|
||||
subprojects.build,
|
||||
subprojects.check,
|
||||
subprojects.javadoc,
|
||||
subprojects.jacocoTestReport,
|
||||
subprojects.getDeps,
|
||||
'srcDistZip',
|
||||
'srcDistTar',
|
||||
rat
|
||||
'replaceVersion',
|
||||
subprojects.build,
|
||||
subprojects.check,
|
||||
subprojects.javadoc,
|
||||
subprojects.jacocoTestReport,
|
||||
subprojects.getDeps,
|
||||
'srcDistZip',
|
||||
'srcDistTar',
|
||||
rat
|
||||
]) {}
|
||||
|
||||
task jenkinsLite(dependsOn: [
|
||||
'replaceVersion',
|
||||
subprojects.build,
|
||||
subprojects.test
|
||||
'replaceVersion',
|
||||
subprojects.build,
|
||||
subprojects.test
|
||||
]) {}
|
||||
|
||||
/*task downloadJarsToLibs() {
|
||||
@ -753,14 +742,14 @@ task jenkinsLite(dependsOn: [
|
||||
|
||||
//compileJava.dependsOn 'downloadJarsToLibs'
|
||||
|
||||
task replaceVersion() {
|
||||
tasks.register('replaceVersion') {
|
||||
outputs.upToDateWhen { false }
|
||||
|
||||
var version = subprojects[0].version
|
||||
var tokens = [
|
||||
[ 'osgi', 'pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ],
|
||||
[ 'osgi', 'pom.xml', '(<poi.version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ]
|
||||
// [ '.', 'build.gradle', ' version = \'[0-9.]+(?:-SNAPSHOT)?\'', " version = '${version}'" ]
|
||||
['osgi', 'pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}"],
|
||||
['osgi', 'pom.xml', '(<poi.version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}"]
|
||||
// [ '.', 'build.gradle', ' version = \'[0-9.]+(?:-SNAPSHOT)?\'', " version = '${version}'" ]
|
||||
]
|
||||
|
||||
doLast {
|
||||
@ -784,7 +773,7 @@ task zipJavadocs(type: Zip, dependsOn: allJavaDoc) {
|
||||
archiveExtension = 'jar'
|
||||
}
|
||||
|
||||
tasks.withType(Tar) {
|
||||
tasks.withType(Tar).configureEach {
|
||||
compression = Compression.GZIP
|
||||
archiveExtension = 'tgz'
|
||||
}
|
||||
@ -843,7 +832,7 @@ distributions {
|
||||
}
|
||||
}
|
||||
|
||||
task soLinkCheck() {
|
||||
tasks.register('soLinkCheck') {
|
||||
doLast {
|
||||
def path = ant.path {
|
||||
fileset(dir: '.', includes: '**/*.java') {
|
||||
@ -887,7 +876,7 @@ srcDistZip.dependsOn srcDep
|
||||
soLinkCheck.dependsOn srcDep
|
||||
rat.dependsOn soLinkCheck
|
||||
|
||||
task fixDistDir {
|
||||
tasks.register('fixDistDir') {
|
||||
doLast {
|
||||
ant.mkdir(dir: 'build/dist')
|
||||
ant.move(todir: 'build/dist') {
|
||||
|
@ -49,7 +49,7 @@ final String MODULE_NAME = 'org.apache.poi.examples'
|
||||
final Pattern MODULE_REGEX = ~'\\.jar$'
|
||||
final List MODULE_COMPILE_PATH = sourceSets.main.compileClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -61,8 +61,8 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MODULE_COMPILE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MODULE_COMPILE_PATH).asPath
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@ sourceSets {
|
||||
}
|
||||
|
||||
// Run out read demo by default
|
||||
tasks.withType(JavaExec) {
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
task runScript(type: JavaExec) {
|
||||
tasks.register('runScript', JavaExec) {
|
||||
mainClass = "SpreadSheetDemo"
|
||||
args = ["../../../../test-data/spreadsheet/Simple.xls"]
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ final String OOXML_LITE_AGENT = "../build/dist/maven/poi-ooxml-lite-agent/poi-oo
|
||||
final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report'
|
||||
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -69,12 +69,12 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
]
|
||||
}
|
||||
|
||||
task compileTest9(type: JavaCompile) {
|
||||
tasks.register('compileTest9', JavaCompile) {
|
||||
dependsOn 'compileTestJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -85,8 +85,8 @@ task compileTest9(type: JavaCompile) {
|
||||
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
||||
source = file(TEST9_SRC)
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
]
|
||||
classpath = files()
|
||||
}
|
||||
@ -123,7 +123,7 @@ task testJar(type: Jar, dependsOn: [ testClasses, compileTest9 ] ) {
|
||||
|
||||
setArchiveClassifier 'tests'
|
||||
// ignore second module-info.class from main
|
||||
duplicatesStrategy = 'exclude'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from sourceSets.test.output + sourceSets.main.output
|
||||
|
||||
|
@ -90,7 +90,7 @@ final String OOXML_LITE_AGENT = "../build/dist/maven/poi-ooxml-lite-agent/poi-oo
|
||||
final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report'
|
||||
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"
|
||||
|
||||
task compileTest9(type: JavaCompile) {
|
||||
tasks.register('compileTest9', JavaCompile) {
|
||||
dependsOn 'compileTestJava', ':poi-ooxml:testJar', ':poi-scratchpad:testJar', ':poi-examples:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -101,8 +101,8 @@ task compileTest9(type: JavaCompile) {
|
||||
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
||||
source = file(TEST9_SRC)
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(MODULE_COMPILE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(MODULE_COMPILE_PATH).asPath
|
||||
]
|
||||
classpath = files()
|
||||
}
|
||||
@ -123,7 +123,7 @@ task testJar(type: Jar, dependsOn: [ testClasses, compileTest9 ] ) {
|
||||
|
||||
setArchiveClassifier 'tests'
|
||||
// ignore second module-info.class from main
|
||||
duplicatesStrategy = 'exclude'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from sourceSets.test.output + sourceSets.main.output
|
||||
|
||||
|
@ -54,7 +54,7 @@ compileJava {
|
||||
options.forkOptions.jvmArgs += '-Xmx2G'
|
||||
}
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -66,24 +66,24 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
]
|
||||
}
|
||||
|
||||
task copy_xsds(type: Copy) {
|
||||
from ('src/main/xmlschema/org/apache/poi/xdgf')
|
||||
from ('src/main/xmlschema/org/apache/poi/schemas') {
|
||||
tasks.register('copy_xsds', Copy) {
|
||||
from('src/main/xmlschema/org/apache/poi/xdgf')
|
||||
from('src/main/xmlschema/org/apache/poi/schemas') {
|
||||
include 'XAdES*.xsd', '*.xsdconfig', 'xmldsig*.xsd', 'ooxmlSchemas.xsdconfig', 'markup-compatibility.xsd',
|
||||
'vmlDrawing.xsd', 'word10.xsd', 'word12.xsd', 'xlThreaded*.xsd', 'dml-drawing.xsd', 'drawing-chart2012.xsd',
|
||||
'chartEx.xsd'
|
||||
exclude '*.zip'
|
||||
}
|
||||
from ('src/main/xmlschema/org/apache/poi/poifs/crypt') {
|
||||
from('src/main/xmlschema/org/apache/poi/poifs/crypt') {
|
||||
include 'signatureInfo.xsd'
|
||||
}
|
||||
from (zipTree('src/main/xmlschema/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip'))
|
||||
from (zipTree('src/main/xmlschema/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip')) {
|
||||
from(zipTree('src/main/xmlschema/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip'))
|
||||
from(zipTree('src/main/xmlschema/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip')) {
|
||||
include 'opc-digSig.xsd', 'opc-relationships.xsd'
|
||||
}
|
||||
into 'build/xsds'
|
||||
@ -95,30 +95,30 @@ task generate_beans(dependsOn: copy_xsds) {
|
||||
|
||||
doLast {
|
||||
ant.uptodate(
|
||||
property: 'xmlbeans_uptodate',
|
||||
targetfile: 'build/generated-resources/org/apache/poi/schemas/ooxml/system/ooxml/TypeSystemHolder.class'
|
||||
property: 'xmlbeans_uptodate',
|
||||
targetfile: 'build/generated-resources/org/apache/poi/schemas/ooxml/system/ooxml/TypeSystemHolder.class'
|
||||
) {
|
||||
srcFiles(dir: 'build/xsds', includes: '*.xsd')
|
||||
}
|
||||
|
||||
ant.taskdef(
|
||||
name: 'xmlbean',
|
||||
classname: 'org.apache.xmlbeans.impl.tool.XMLBean',
|
||||
classpath: sourceSets.main.runtimeClasspath.asPath
|
||||
name: 'xmlbean',
|
||||
classname: 'org.apache.xmlbeans.impl.tool.XMLBean',
|
||||
classpath: sourceSets.main.runtimeClasspath.asPath
|
||||
)
|
||||
|
||||
if (!ant.properties.xmlbeans_uptodate) {
|
||||
ant.xmlbean(
|
||||
schema: 'build/xsds',
|
||||
srcgendir: BEANS_SRC,
|
||||
classgendir: BEANS_RES,
|
||||
destfile: 'build/xsds.jar',
|
||||
srconly: true,
|
||||
failonerror: true,
|
||||
fork: true,
|
||||
memoryMaximumSize: '1536m',
|
||||
typesystemname: 'ooxml',
|
||||
repackage: 'org.apache.xmlbeans.metadata:org.apache.poi.schemas.ooxml'
|
||||
schema: 'build/xsds',
|
||||
srcgendir: BEANS_SRC,
|
||||
classgendir: BEANS_RES,
|
||||
destfile: 'build/xsds.jar',
|
||||
srconly: true,
|
||||
failonerror: true,
|
||||
fork: true,
|
||||
memoryMaximumSize: '1536m',
|
||||
typesystemname: 'ooxml',
|
||||
repackage: 'org.apache.xmlbeans.metadata:org.apache.poi.schemas.ooxml'
|
||||
) {
|
||||
classpath = sourceSets.main.runtimeClasspath.asPath
|
||||
}
|
||||
@ -126,7 +126,7 @@ task generate_beans(dependsOn: copy_xsds) {
|
||||
}
|
||||
}
|
||||
|
||||
task sourceJar(type: Jar) {
|
||||
tasks.register('sourceJar', Jar) {
|
||||
setArchiveClassifier 'sources'
|
||||
from sourceSets.main.allJava
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ java {
|
||||
}
|
||||
}
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -49,8 +49,8 @@ task compileJava9(type: JavaCompile) {
|
||||
classpath = files()
|
||||
doFirst {
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', sourceSets.main.compileClasspath.asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', sourceSets.main.compileClasspath.asPath
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ final Pattern MODULE_REGEX = ~'\\.jar$'
|
||||
final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
|
||||
final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report'
|
||||
|
||||
task generateModuleInfo() {
|
||||
tasks.register('generateModuleInfo') {
|
||||
File fileIn = file("${OOXML_LITE_REPORT}.clazz")
|
||||
File fileOut = file("src/main/java9/module-info.java")
|
||||
|
||||
@ -55,8 +55,8 @@ task generateModuleInfo() {
|
||||
|
||||
// generate module-info based on exported classes
|
||||
String exports = fileIn.
|
||||
collect { " exports ${it.replaceAll('[/\\\\][^/\\\\]+$', '').replaceAll('[/\\\\]', '.')};" }.
|
||||
findAll { !(it =~ /\.impl;$/) }.unique().sort().join('\n')
|
||||
collect { " exports ${it.replaceAll('[/\\\\][^/\\\\]+$', '').replaceAll('[/\\\\]', '.')};" }.
|
||||
findAll { !(it =~ /\.impl;$/) }.unique().sort().join('\n')
|
||||
|
||||
String content = header + '\n' + exports + '\n}'
|
||||
if (fileOut.text != content) {
|
||||
@ -65,7 +65,7 @@ task generateModuleInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
task compileOoxmlLite(type: Copy) {
|
||||
tasks.register('compileOoxmlLite', Copy) {
|
||||
dependsOn 'generateModuleInfo', ':poi-ooxml-full:generate_beans', ':poi-ooxml-full:compileJava'
|
||||
|
||||
// This task is currently always executed, because gradle thinks files with two dollar signs
|
||||
@ -100,8 +100,8 @@ task compileJava9(type: JavaCompile, dependsOn: 'compileJava') {
|
||||
classpath = files()
|
||||
doFirst {
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${project(':poi-ooxml-full').sourceSets.main.output.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${project(':poi-ooxml-full').sourceSets.main.output.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ jar {
|
||||
}
|
||||
|
||||
// ignore second module-info.class from poi-ooxml-full
|
||||
// duplicatesStrategy = 'exclude'
|
||||
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
includeEmptyDirs = false
|
||||
|
||||
manifest {
|
||||
|
@ -149,7 +149,7 @@ compileJava {
|
||||
dependsOn 'fixBatik', 'cleanupBatik'
|
||||
}
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava', ':poi:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -161,12 +161,12 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
]
|
||||
}
|
||||
|
||||
task compileTest9(type: JavaCompile) {
|
||||
tasks.register('compileTest9', JavaCompile) {
|
||||
dependsOn 'compileTestJava', ':poi:testJar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -177,8 +177,8 @@ task compileTest9(type: JavaCompile) {
|
||||
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
||||
source = file(TEST9_SRC)
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
]
|
||||
classpath = files()
|
||||
}
|
||||
@ -199,7 +199,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
|
||||
|
||||
setArchiveClassifier 'tests'
|
||||
// ignore second module-info.class from main
|
||||
duplicatesStrategy = 'exclude'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from sourceSets.test.output + sourceSets.main.output
|
||||
|
||||
@ -209,17 +209,17 @@ task testJar(type: Jar, dependsOn: testClasses) {
|
||||
}
|
||||
|
||||
// based on https://github.com/moditect/moditect-gradle-plugin/issues/12
|
||||
task fixBatik(type: Zip) {
|
||||
tasks.register('fixBatik', Zip) {
|
||||
ant.mkdir(dir: "${buildDir}/brokenJars")
|
||||
archiveFileName = "batik-script-${batikVersion}.jar"
|
||||
destinationDirectory = file("${buildDir}/brokenJars")
|
||||
from zipTree(configurations.broken.files.find{ f -> f.name.startsWith("batik-script") })
|
||||
from zipTree(configurations.broken.files.find { f -> f.name.startsWith("batik-script") })
|
||||
filesMatching("**/org.apache.batik.script.InterpreterFactory") {
|
||||
it.filter{ it2 -> it2.contains("Rhino") ? "#" + it2 : it2 }
|
||||
it.filter { it2 -> it2.contains("Rhino") ? "#" + it2 : it2 }
|
||||
}
|
||||
}
|
||||
|
||||
task cleanupBatik(type: Delete) {
|
||||
tasks.register('cleanupBatik', Delete) {
|
||||
// remove older files to avoid build failures because of duplicate modules
|
||||
delete fileTree("${buildDir}/brokenJars/").matching {
|
||||
include "*.jar"
|
||||
|
@ -53,7 +53,7 @@ final Pattern MODULE_REGEX = ~'\\.jar$'
|
||||
final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
|
||||
final List TEST_MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique()
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava', ':poi:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -65,12 +65,12 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', files(MAIN_MODULE_PATH).asPath
|
||||
]
|
||||
}
|
||||
|
||||
task compileTest9(type: JavaCompile) {
|
||||
tasks.register('compileTest9', JavaCompile) {
|
||||
dependsOn 'compileTestJava', ':poi:jar'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -81,8 +81,8 @@ task compileTest9(type: JavaCompile) {
|
||||
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
||||
source = file(TEST9_SRC)
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(TEST_MODULE_PATH).asPath
|
||||
]
|
||||
classpath = files()
|
||||
}
|
||||
@ -103,7 +103,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
|
||||
|
||||
setArchiveClassifier 'tests'
|
||||
// ignore second module-info.class from main
|
||||
duplicatesStrategy = 'exclude'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from sourceSets.test.output + sourceSets.main.output
|
||||
|
||||
|
@ -56,7 +56,7 @@ dependencies {
|
||||
}
|
||||
|
||||
// generate and compile the file Version.java file
|
||||
task generateVersionJava() {
|
||||
tasks.register('generateVersionJava') {
|
||||
//dependsOn ':poi-ooxml:build', ':poi-integration:build', ':poi-excelant:build'
|
||||
|
||||
File fileIn = file("src/main/version/Version.java.template")
|
||||
@ -80,7 +80,7 @@ final Pattern MODULE_NOT_REGEX = ~'(poi[/\\\\][^/\\\\]+$|batik-script)'
|
||||
final Pattern MODULE_REGEX = ~'\\.jar$'
|
||||
final List MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique()
|
||||
|
||||
task compileJava9(type: JavaCompile) {
|
||||
tasks.register('compileJava9', JavaCompile) {
|
||||
dependsOn 'compileJava'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -92,12 +92,12 @@ task compileJava9(type: JavaCompile) {
|
||||
source = file(JAVA9_SRC)
|
||||
classpath = files()
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', sourceSets.main.compileClasspath.asPath
|
||||
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
|
||||
'--module-path', sourceSets.main.compileClasspath.asPath
|
||||
]
|
||||
}
|
||||
|
||||
task compileTest9(type: JavaCompile) {
|
||||
tasks.register('compileTest9', JavaCompile) {
|
||||
dependsOn 'compileTestJava'
|
||||
|
||||
javaCompiler = javaToolchains.compilerFor {
|
||||
@ -108,8 +108,8 @@ task compileTest9(type: JavaCompile) {
|
||||
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
||||
source = file(TEST9_SRC)
|
||||
options.compilerArgs = [
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(MODULE_PATH).asPath
|
||||
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
||||
'--module-path', files(MODULE_PATH).asPath
|
||||
]
|
||||
classpath = files()
|
||||
}
|
||||
@ -129,7 +129,7 @@ task testJar(type: Jar, dependsOn: [ testClasses, compileTest9 ]) {
|
||||
|
||||
setArchiveClassifier 'tests'
|
||||
// ignore second module-info.class from main
|
||||
duplicatesStrategy = 'exclude'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from sourceSets.test.output + sourceSets.main.output
|
||||
|
||||
|
@ -30,7 +30,7 @@ wrapper {
|
||||
// Custom task to inject support for downloading the gradle wrapper jar if it doesn't exist.
|
||||
// This allows us to avoid checking in the jar to our repository.
|
||||
// Additionally adds a license header to the wrapper while editing the file contents.
|
||||
task bootstrapWrapper() {
|
||||
tasks.register('bootstrapWrapper') {
|
||||
// In the doLast block so this runs when the task is called and not during project configuration.
|
||||
doLast {
|
||||
def wrapperBasePath = "\$APP_HOME/gradle/wrapper"
|
||||
@ -79,7 +79,7 @@ task bootstrapWrapper() {
|
||||
wrapper.finalizedBy bootstrapWrapper
|
||||
|
||||
// Remove the generated batch file since we don't test building in the Windows environment.
|
||||
task removeWindowsScript(type: Delete) {
|
||||
tasks.register('removeWindowsScript', Delete) {
|
||||
delete "$rootDir/gradlew.bat"
|
||||
}
|
||||
wrapper.finalizedBy removeWindowsScript
|
||||
|
Loading…
x
Reference in New Issue
Block a user