Allow -DcommitId flag when building Pkl (#954)

This is to allow building Pkl in environments that don't have access
to git.
This commit is contained in:
Daniel Chao
2025-02-14 09:36:47 -08:00
committed by GitHub
parent 1a4f9ee72e
commit eabfcdd333

View File

@@ -350,6 +350,8 @@ open class BuildInfo(private val project: Project) {
// could be `commitId: Provider<String> = project.provider { ... }`
val commitId: String by lazy {
// allow -DcommitId=abc123 for build environments that don't have git.
System.getProperty("commitId").let { if (it != null) return@lazy it }
// only run command once per build invocation
if (project === project.rootProject) {
val process =