Skip to content

Commit

Permalink
Try to remove outdated files from the "distribution" folder
Browse files Browse the repository at this point in the history
Clean directory and keep only the expected files with the current
version.

Otherwise we get strange errors about "duplicate modules" when
building after version was switched.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915368 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
centic9 committed Jan 23, 2024
1 parent c868af2 commit b010f9c
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,66 @@ subprojects {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

doLast {
// make sure we do not have distribution jar-files with different versions
// in the build-dir as those lead to strange errors about "duplicate modules"
// when building java9 JPMS class files ("java9")
ant.delete(failOnError: true, verbose: true) {
fileset(dir: "../build/dist/maven/${project.archivesBaseName}") {
include(name: '*.jar')
exclude(name: "*${version}.jar")
exclude(name: "*${version}-sources.jar")

include(name: '*.jar.asc')
exclude(name: "*${version}.jar.asc")
exclude(name: "*${version}-sources.jar.asc")

include(name: '*.jar.sha256')
exclude(name: "*${version}.jar.sha256")
exclude(name: "*${version}-sources.jar.sha256")

include(name: '*.jar.sha512')
exclude(name: "*${version}.jar.sha512")
exclude(name: "*${version}-sources.jar.sha512")

include(name: '*.pom')
exclude(name: "*${version}.pom")

include(name: '*.pom.asc')
exclude(name: "*${version}.pom.asc")
}
}
// use failOnError=false for -javadoc and -tests as not all modules create this directory
ant.delete(failOnError: false, verbose: true) {
fileset(dir: "../build/dist/maven/${project.archivesBaseName}-javadoc") {
include(name: '*-javadoc.jar')
exclude(name: "*${version}-javadoc.jar")

include(name: '*-javadoc.jar.asc')
exclude(name: "*${version}-javadoc.jar.asc")

include(name: '*-javadoc.jar.sha256')
exclude(name: "*${version}-javadoc.jar.sha256")

include(name: '*-javadoc.jar.sha512')
exclude(name: "*${version}-javadoc.jar.sha512")
}
}
ant.delete(failOnError: false, verbose: true) {
fileset(dir: "../build/dist/maven/${project.archivesBaseName}-tests") {
include(name: '*-tests.jar')
exclude(name: "*${version}-tests.jar")

include(name: '*-tests.jar.asc')
exclude(name: "*${version}-tests.jar.asc")

include(name: '*-tests.jar.sha256')
exclude(name: "*${version}-tests.jar.sha256")

include(name: '*-tests.jar.sha512')
exclude(name: "*${version}-tests.jar.sha512")
}
}

ant.checksum(file: it.archivePath, algorithm: 'SHA-256', fileext: '.sha256', format: 'MD5SUM')
ant.checksum(file: it.archivePath, algorithm: 'SHA-512', fileext: '.sha512', format: 'MD5SUM')
}
Expand Down

0 comments on commit b010f9c

Please sign in to comment.