Skip to content

Commit

Permalink
Rely on Develocity injection script to configure server URL
Browse files Browse the repository at this point in the history
  • Loading branch information
erichaagdev committed Dec 9, 2024
1 parent a5b5df7 commit 578d494
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def GRADLE_ENTERPRISE_PLUGIN_ID = 'com.gradle.enterprise'
def DEVELOCITY_PLUGIN_ID = 'com.gradle.develocity'
def CCUD_PLUGIN_ID = 'com.gradle.common-custom-user-data-gradle-plugin'

def develocityUrl = getInputParam('develocity.build-validation.url')
def develocityAllowUntrustedServer = Boolean.parseBoolean(getInputParam('develocity.build-validation.allow-untrusted-server'))

def expDir = getInputParam('develocity.build-validation.expDir')
def expId = getInputParam('develocity.build-validation.expId')
def runId = getInputParam('develocity.build-validation.runId')
Expand Down Expand Up @@ -113,12 +110,6 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
pluginManager.withPlugin(BUILD_SCAN_PLUGIN_ID) {
// only execute if Develocity plugin isn't applied
if (pluginManager.hasPlugin(DEVELOCITY_PLUGIN_ID)) return

if (develocityUrl) {
buildScan.server = develocityUrl
buildScan.allowUntrustedServer = develocityAllowUntrustedServer
}

if (!buildScan.server) {
failMissingDevelocityServerURL('https://docs.gradle.com/develocity/gradle-plugin/legacy#gradle_5_x_2')
}
Expand All @@ -129,11 +120,6 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
}

pluginManager.withPlugin(DEVELOCITY_PLUGIN_ID) {
if (develocityUrl) {
develocity.server = develocityUrl
develocity.allowUntrustedServer = develocityAllowUntrustedServer
}

if (!develocity.server.present) {
develocity.buildScan.publishing.onlyIf { false } // prevent publishing to scans.gradle.com
failMissingDevelocityServerURL('https://docs.gradle.com/develocity/gradle-plugin/current/#connecting_to_develocity')
Expand All @@ -157,12 +143,6 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
settings.pluginManager.withPlugin(GRADLE_ENTERPRISE_PLUGIN_ID) {
// only execute if Develocity plugin isn't applied
if (settings.pluginManager.hasPlugin(DEVELOCITY_PLUGIN_ID)) return

if (develocityUrl) {
settings.gradleEnterprise.server = develocityUrl
settings.gradleEnterprise.allowUntrustedServer = develocityAllowUntrustedServer
}

if (!settings.gradleEnterprise.server) {
failMissingDevelocityServerURL('https://docs.gradle.com/develocity/gradle-plugin/legacy/#gradle_6_x_and_later_2')
}
Expand All @@ -173,11 +153,6 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
}

settings.pluginManager.withPlugin(DEVELOCITY_PLUGIN_ID) {
if (develocityUrl) {
settings.develocity.server = develocityUrl
settings.develocity.allowUntrustedServer = develocityAllowUntrustedServer
}

if (!settings.develocity.server.present) {
settings.develocity.buildScan.publishing.onlyIf { false } // prevent publishing to scans.gradle.com
failMissingDevelocityServerURL('https://docs.gradle.com/develocity/gradle-plugin/current/#connecting_to_develocity')
Expand Down
5 changes: 3 additions & 2 deletions components/scripts/lib/gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ invoke_gradle() {

if [ -n "${ge_server}" ]; then
args+=(
-Ddevelocity.build-validation.url="${ge_server}"
-Ddevelocity.build-validation.allow-untrusted-server=false
-Ddevelocity.url="${ge_server}"
-Ddevelocity.enforce-url=true
-Ddevelocity.allow-untrusted-server=false
)
fi

Expand Down

0 comments on commit 578d494

Please sign in to comment.