build: 为项目支持可重现构建.

为确保项目的使用者(无论是开发者, 还是最终用户)可以完全重现构建, 确保安全, 故调整相关配置, 以实现"可重现构建".
有关可重现构建, 可以看这个: https://reproducible-builds.org/
This commit is contained in:
LamGC 2022-08-06 03:23:35 +08:00
parent d586ca378e
commit 673c6d8392
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
3 changed files with 15 additions and 0 deletions

View File

@ -56,3 +56,8 @@ application {
tasks.jar.configure {
exclude("**/logback-test.xml")
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}

View File

@ -31,6 +31,11 @@ tasks.test {
useJUnitPlatform()
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
publishing {
repositories {
if (project.version.toString().endsWith("-SNAPSHOT")) {

View File

@ -36,6 +36,11 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}