mirror of
https://github.com/gradle/actions.git
synced 2025-11-26 17:09:10 +08:00
Add an ability to capture task input files (#58)
This PR adds an ability to enable/disable [capturing task input files](https://docs.gradle.com/enterprise/gradle-plugin/#capturing_task_input_files) in a build scan. --------- Co-authored-by: Eric Haag <eah0592@gmail.com>
This commit is contained in:
@@ -94,11 +94,13 @@ def geUrl = getInputParam('develocity.url')
|
||||
def geAllowUntrustedServer = Boolean.parseBoolean(getInputParam('develocity.allow-untrusted-server'))
|
||||
def geEnforceUrl = Boolean.parseBoolean(getInputParam('develocity.enforce-url'))
|
||||
def buildScanUploadInBackground = Boolean.parseBoolean(getInputParam('develocity.build-scan.upload-in-background'))
|
||||
def geCaptureFileFingerprints = Boolean.parseBoolean(getInputParam('develocity.capture-file-fingerprints'))
|
||||
def gePluginVersion = getInputParam('develocity.plugin.version')
|
||||
def ccudPluginVersion = getInputParam('develocity.ccud-plugin.version')
|
||||
def buildScanTermsOfServiceUrl = getInputParam('build-scan.terms-of-service.url')
|
||||
def buildScanTermsOfServiceAgree = getInputParam('build-scan.terms-of-service.agree')
|
||||
|
||||
def atLeastGradle5 = GradleVersion.current() >= GradleVersion.version('5.0')
|
||||
def atLeastGradle4 = GradleVersion.current() >= GradleVersion.version('4.0')
|
||||
|
||||
// finish early if configuration parameters passed in via system properties are not valid/supported
|
||||
@@ -121,11 +123,18 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
|
||||
logger.lifecycle("Applying $BUILD_SCAN_PLUGIN_CLASS via init script")
|
||||
applyPluginExternally(pluginManager, BUILD_SCAN_PLUGIN_CLASS)
|
||||
if (geUrl) {
|
||||
logger.lifecycle("Connection to Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer")
|
||||
logger.lifecycle("Connection to Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer, captureFileFingerprints: $geCaptureFileFingerprints")
|
||||
buildScan.server = geUrl
|
||||
buildScan.allowUntrustedServer = geAllowUntrustedServer
|
||||
}
|
||||
buildScan.publishAlways()
|
||||
if (isAtLeast(gePluginVersion, '2.1') && atLeastGradle5) {
|
||||
if (isAtLeast(gePluginVersion, '3.7')) {
|
||||
buildScan.capture.taskInputFiles = geCaptureFileFingerprints
|
||||
} else {
|
||||
buildScan.captureTaskInputFiles = geCaptureFileFingerprints
|
||||
}
|
||||
}
|
||||
if (buildScan.metaClass.respondsTo(buildScan, 'setUploadInBackground', Boolean)) buildScan.uploadInBackground = buildScanUploadInBackground // uploadInBackground not available for build-scan-plugin 1.16
|
||||
buildScan.value CI_AUTO_INJECTION_CUSTOM_VALUE_NAME, CI_AUTO_INJECTION_CUSTOM_VALUE_VALUE
|
||||
}
|
||||
@@ -133,10 +142,17 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
|
||||
if (geUrl && geEnforceUrl) {
|
||||
pluginManager.withPlugin(BUILD_SCAN_PLUGIN_ID) {
|
||||
afterEvaluate {
|
||||
logger.lifecycle("Enforcing Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer")
|
||||
logger.lifecycle("Enforcing Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer, captureFileFingerprints: $geCaptureFileFingerprints")
|
||||
buildScan.server = geUrl
|
||||
buildScan.allowUntrustedServer = geAllowUntrustedServer
|
||||
}
|
||||
if (isAtLeast(gePluginVersion, '2.1') && atLeastGradle5) {
|
||||
if (isAtLeast(gePluginVersion, '3.7')) {
|
||||
buildScan.capture.taskInputFiles = geCaptureFileFingerprints
|
||||
} else {
|
||||
buildScan.captureTaskInputFiles = geCaptureFileFingerprints
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,21 +181,35 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
|
||||
applyPluginExternally(settings.pluginManager, DEVELOCITY_PLUGIN_CLASS)
|
||||
eachDevelocityExtension(settings, DEVELOCITY_EXTENSION_CLASS) { ext ->
|
||||
if (geUrl) {
|
||||
logger.lifecycle("Connection to Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer")
|
||||
logger.lifecycle("Connection to Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer, captureFileFingerprints: $geCaptureFileFingerprints")
|
||||
ext.server = geUrl
|
||||
ext.allowUntrustedServer = geAllowUntrustedServer
|
||||
}
|
||||
ext.buildScan.publishAlways()
|
||||
ext.buildScan.uploadInBackground = buildScanUploadInBackground
|
||||
if (isAtLeast(gePluginVersion, '2.1')) {
|
||||
if (isAtLeast(gePluginVersion, '3.7')) {
|
||||
ext.buildScan.capture.taskInputFiles = geCaptureFileFingerprints
|
||||
} else {
|
||||
ext.buildScan.captureTaskInputFiles = geCaptureFileFingerprints
|
||||
}
|
||||
}
|
||||
ext.buildScan.value CI_AUTO_INJECTION_CUSTOM_VALUE_NAME, CI_AUTO_INJECTION_CUSTOM_VALUE_VALUE
|
||||
}
|
||||
}
|
||||
|
||||
if (geUrl && geEnforceUrl) {
|
||||
eachDevelocityExtension(settings, DEVELOCITY_EXTENSION_CLASS) { ext ->
|
||||
logger.lifecycle("Enforcing Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer")
|
||||
logger.lifecycle("Enforcing Develocity: $geUrl, allowUntrustedServer: $geAllowUntrustedServer, captureFileFingerprints: $geCaptureFileFingerprints")
|
||||
ext.server = geUrl
|
||||
ext.allowUntrustedServer = geAllowUntrustedServer
|
||||
if (isAtLeast(gePluginVersion, '2.1')) {
|
||||
if (isAtLeast(gePluginVersion, '3.7')) {
|
||||
ext.buildScan.capture.taskInputFiles = geCaptureFileFingerprints
|
||||
} else {
|
||||
ext.buildScan.captureTaskInputFiles = geCaptureFileFingerprints
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,5 +251,9 @@ static def eachDevelocityExtension(def settings, def publicType, def action) {
|
||||
}
|
||||
|
||||
static boolean isNotAtLeast(String versionUnderTest, String referenceVersion) {
|
||||
GradleVersion.version(versionUnderTest) < GradleVersion.version(referenceVersion)
|
||||
!isAtLeast(versionUnderTest, referenceVersion)
|
||||
}
|
||||
|
||||
static boolean isAtLeast(String versionUnderTest, String referenceVersion) {
|
||||
GradleVersion.version(versionUnderTest) >= GradleVersion.version(referenceVersion)
|
||||
}
|
||||
Reference in New Issue
Block a user