Skip to content

Commit

Permalink
Update develocity-injection init script to v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz authored and github-actions[bot] committed May 14, 2024
1 parent eb13cf7 commit 4c0a108
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -360,4 +367,4 @@ static boolean isAtLeast(String versionUnderTest, String referenceVersion) {

static boolean isNotAtLeast(String versionUnderTest, String referenceVersion) {
!isAtLeast(versionUnderTest, referenceVersion)
}
}

0 comments on commit 4c0a108

Please sign in to comment.