diff --git a/sources/src/resources/init-scripts/gradle-actions.inject-develocity.init.gradle b/sources/src/resources/init-scripts/gradle-actions.inject-develocity.init.gradle index cddf0122..e3474d98 100644 --- a/sources/src/resources/init-scripts/gradle-actions.inject-develocity.init.gradle +++ b/sources/src/resources/init-scripts/gradle-actions.inject-develocity.init.gradle @@ -1,3 +1,8 @@ +/* + * Initscript for injection of Develocity into Gradle builds. + * Version: v0.3.0 + */ + import org.gradle.util.GradleVersion // note that there is no mechanism to share code between the initscript{} block and the main script, so some logic is duplicated @@ -9,8 +14,9 @@ initscript { return } + def ENV_VAR_PREFIX = '' def getInputParam = { String name -> - def envVarName = name.toUpperCase().replace('.', '_').replace('-', '_') + def envVarName = ENV_VAR_PREFIX + name.toUpperCase().replace('.', '_').replace('-', '_') return System.getProperty(name) ?: System.getenv(envVarName) } @@ -93,8 +99,9 @@ if (!isTopLevelBuild) { return } +def ENV_VAR_PREFIX = '' def getInputParam = { String name -> - def envVarName = name.toUpperCase().replace('.', '_').replace('-', '_') + def envVarName = ENV_VAR_PREFIX + name.toUpperCase().replace('.', '_').replace('-', '_') return System.getProperty(name) ?: System.getenv(envVarName) } @@ -154,12 +161,12 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) { logger.lifecycle("Applying $pluginClass via init script") applyPluginExternally(pluginManager, pluginClass) def rootExtension = dvOrGe( - { develocity }, - { buildScan } + { develocity }, + { buildScan } ) def buildScanExtension = dvOrGe( - { rootExtension.buildScan }, - { rootExtension } + { rootExtension.buildScan }, + { rootExtension } ) if (develocityUrl) { logger.lifecycle("Connection to Develocity: $develocityUrl, allowUntrustedServer: $develocityAllowUntrustedServer, captureFileFingerprints: $develocityCaptureFileFingerprints") @@ -360,4 +367,4 @@ static boolean isAtLeast(String versionUnderTest, String referenceVersion) { static boolean isNotAtLeast(String versionUnderTest, String referenceVersion) { !isAtLeast(versionUnderTest, referenceVersion) -} \ No newline at end of file +}