Skip to content

Commit

Permalink
Merge Remove from init-script.gradle specific logging #153
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfs committed Jun 8, 2022
2 parents 7483747 + 0afb00d commit 9c13977
Showing 1 changed file with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ initscript {
}
}

def BUILD_SCAN_PLUGIN_ID = 'com.gradle.build-scan'
def BUILD_SCAN_PLUGIN_CLASS = 'com.gradle.scan.plugin.BuildScanPlugin'

def GRADLE_ENTERPRISE_PLUGIN_ID = 'com.gradle.enterprise'
Expand Down Expand Up @@ -70,18 +69,6 @@ if (ccudPluginVersion && isNotAtLeast(ccudPluginVersion, '1.7')) {
return
}

// send a message to the server that the build has started
logger.quiet(generateBuildScanLifeCycleMessage('BUILD_STARTED'))

// define a buildScanPublished listener that captures the build scan URL and sends it in a message to the server
def buildScanPublishedAction = { def buildScan ->
if (buildScan.metaClass.respondsTo(buildScan, 'buildScanPublished', Action)) {
buildScan.buildScanPublished { scan ->
logger.quiet(generateBuildScanLifeCycleMessage("BUILD_SCAN_URL:${scan.buildScanUri.toString()}"))
}
}
}

// register buildScanPublished listener and optionally apply the GE / Build Scan plugin
if (GradleVersion.current() < GradleVersion.version('6.0')) {
rootProject {
Expand Down Expand Up @@ -112,10 +99,6 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
}
}
}

pluginManager.withPlugin(BUILD_SCAN_PLUGIN_ID) {
buildScanPublishedAction(buildScan)
}
}
} else {
gradle.settingsEvaluated { settings ->
Expand All @@ -138,21 +121,13 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
settings.pluginManager.apply(initscript.classLoader.loadClass(CCUD_PLUGIN_CLASS))
}
}

extensionsWithPublicType(settings, GRADLE_ENTERPRISE_EXTENSION_CLASS).collect { settings[it.name] }.each { ext ->
buildScanPublishedAction(ext.buildScan)
}
}
}

static def extensionsWithPublicType(def container, String publicType) {
container.extensions.extensionsSchema.elements.findAll { it.publicType.concreteClass.name == publicType }
}

static String generateBuildScanLifeCycleMessage(def attribute) {
return "##jenkins[hudson.plugins.gradle.injection.buildScanLifeCycle '${escape(attribute as String)}']" as String
}

static String escape(String value) {
return value?.toCharArray()?.collect { ch -> escapeChar(ch) }?.join()
}
Expand Down

0 comments on commit 9c13977

Please sign in to comment.