aboutsummaryrefslogtreecommitdiffstats
path: root/poi/build.gradle
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-09-16 19:25:43 +0000
committerDominik Stadler <centic@apache.org>2021-09-16 19:25:43 +0000
commit5813b1aef26d66203c3e042e5238b767f503dc22 (patch)
tree91561f25e5df0d8f6c6cf4ce0308861c740bc6f0 /poi/build.gradle
parent914614f7a895dc811615cb7884cfa78eb9c20897 (diff)
downloadpoi-5813b1aef26d66203c3e042e5238b767f503dc22.tar.gz
poi-5813b1aef26d66203c3e042e5238b767f503dc22.zip
Generate, compile and include class 'org.apache.poi.Version' in Gradle build
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893384 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/build.gradle')
-rw-r--r--poi/build.gradle27
1 files changed, 26 insertions, 1 deletions
diff --git a/poi/build.gradle b/poi/build.gradle
index d71e86bc51..da8eeb9ff1 100644
--- a/poi/build.gradle
+++ b/poi/build.gradle
@@ -27,6 +27,10 @@ sourceSets {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
+ java {
+ // also include the generated Version.java
+ srcDirs += 'build/generated-sources'
+ }
}
test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
@@ -55,6 +59,27 @@ dependencies {
javadocs project(':poi-scratchpad')
}
+// generate and compile the file Version.java file
+task generateVersionJava() {
+ //dependsOn ':poi-ooxml:build', ':poi-integration:build', ':poi-excelant:build'
+
+ File fileIn = file("src/main/version/Version.java.template")
+ File fileOut = file("build/generated-sources/org/apache/poi/Version.java")
+
+ inputs.file fileIn
+ outputs.file fileOut
+
+ doLast {
+ String content = fileIn.text
+
+ content = content.replace("@VERSION@", version)
+ content = content.replace("@DSTAMP@", new Date().format('yyyyMMdd'))
+
+ fileOut.write content
+ }
+}
+compileJava.dependsOn 'generateVersionJava'
+
final String MODULE_NAME = 'org.apache.poi.poi'
final Pattern MODULE_NOT_REGEX = ~'(poi[/\\\\][^/\\\\]+$|batik-script)'
final Pattern MODULE_REGEX = ~'\\.jar$'
@@ -177,4 +202,4 @@ publishing {
}
}
}
-} \ No newline at end of file
+}