From eabfcdd3333e8a9a6afa281b1ccadc0db1dcf251 Mon Sep 17 00:00:00 2001 From: Daniel Chao Date: Fri, 14 Feb 2025 09:36:47 -0800 Subject: [PATCH] Allow -DcommitId flag when building Pkl (#954) This is to allow building Pkl in environments that don't have access to git. --- buildSrc/src/main/kotlin/BuildInfo.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildSrc/src/main/kotlin/BuildInfo.kt b/buildSrc/src/main/kotlin/BuildInfo.kt index 06b4aea5..3020857b 100644 --- a/buildSrc/src/main/kotlin/BuildInfo.kt +++ b/buildSrc/src/main/kotlin/BuildInfo.kt @@ -350,6 +350,8 @@ open class BuildInfo(private val project: Project) { // could be `commitId: Provider = 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 =