Build: Added freemarker.allowUnsignedReleaseBuild Gradle property, and set it to true in the GitHub "CI" action
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9376121..ef7730d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -52,7 +52,7 @@
uses: gradle/wrapper-validation-action@v1.1.0
- name: Run Build
id: build_step
- run: './gradlew "-Pfreemarker.signMethod=none" --continue clean build'
+ run: './gradlew "-Pfreemarker.signMethod=none" "-Pfreemarker.allowUnsignedReleaseBuild=true" --continue clean build'
- name: Upload Failed Report
uses: actions/upload-artifact@v2.3.1
if: failure() && steps.build_step.outcome == 'failure'
diff --git a/README.md b/README.md
index d3424c2..5c23bd7 100644
--- a/README.md
+++ b/README.md
@@ -129,8 +129,10 @@
`./gradlew publishAllPublicationsToLocalRepository`,
and check the `build/local-deployment` directory.
-To also build the distribution artifacts (the `tgz`-s that people can download), run `./gradlew build`. However,
-for a stable version you will also need to set up signing; see `gradle.properties` in this project for pointers.
+To build the distribution artifacts (the `tgz`-s that people can download), run `./gradlew build`.However,
+
+For a stable (non-SNAPSHOT) version number, you will need to set up signing, or disable that verification;
+see `gradle.properties` in this project for those!
See `gradle.properties` for some Gradle properties that you may what to set,
especially if you are building a release.
diff --git a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
index dfdd9b3..c54c491 100644
--- a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
+++ b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
@@ -206,6 +206,11 @@
.map { SignatureConfiguration.valueOf(it.uppercase()) }
.get()
+ val allowUnsignedReleaseBuild = context.providers
+ .gradleProperty("allowUnsignedReleaseBuild")
+ .map { it.toBoolean() }
+ .getOrElse(false)
+
private val allConfiguredSourceSetNamesRef = project.objects.setProperty<String>()
val allConfiguredSourceSetNames: Provider<Set<String>> = allConfiguredSourceSetNamesRef
diff --git a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootPlugin.kt b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootPlugin.kt
index bbb2fb0..f30c5bf 100644
--- a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootPlugin.kt
+++ b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootPlugin.kt
@@ -28,11 +28,7 @@
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.bundling.Jar
import org.gradle.jvm.toolchain.JavaLanguageVersion
-import org.gradle.kotlin.dsl.configure
-import org.gradle.kotlin.dsl.filter
-import org.gradle.kotlin.dsl.named
-import org.gradle.kotlin.dsl.the
-import org.gradle.kotlin.dsl.withType
+import org.gradle.kotlin.dsl.*
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.language.jvm.tasks.ProcessResources
@@ -89,10 +85,11 @@
doLast {
if (ext.versionService.developmentBuild) {
- throw IllegalStateException("The development build configuration is active!")
+ throw IllegalStateException("The development build configuration is active, which is not allowed for release versions!")
}
- if (!ext.signMethod.needSignature()) {
- throw IllegalStateException("Package signing is disabled!")
+ if (!ext.signMethod.needSignature() && !ext.allowUnsignedReleaseBuild) {
+ throw IllegalStateException("Package signing is disabled, which is not allowed for release versions! "
+ + "(For testing purposes only, you may set the Gradle property to false)")
}
}
}
diff --git a/gradle.properties b/gradle.properties
index 874f1fd..6e773bf 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -30,6 +30,9 @@
# signing.secretKeyRingFile=...
# - For gpg_command, you need GNU Privacy Guard installed, and you don't have to set anything if it's on the path.
+# To allow building for a releasable version number when freemarker.signMethod=none. Only use for CI, and local testing!
+#freemarker.allowUnsignedReleaseBuild=false
+
# To publish to the Apache Maven repo (for staging), somewhere you have to set these:
#freemarker.deploy.apache.user=<your user name at the ASF>
#freemarker.deploy.apache.password=<your regular ASF password>