mirror of
https://github.com/gradle/actions.git
synced 2025-04-23 03:09:20 +08:00
Align init script with other CI plugins by checking whether the init script name matches
This commit is contained in:
parent
e33d4754ca
commit
b9bc45cfbb
@ -3,6 +3,7 @@ import {getBuildScanPublishEnabled, getBuildScanTermsOfUseUrl, getBuildScanTerms
|
|||||||
|
|
||||||
export function setup(): void {
|
export function setup(): void {
|
||||||
if (getBuildScanPublishEnabled() && verifyTermsOfUseAgreement()) {
|
if (getBuildScanPublishEnabled() && verifyTermsOfUseAgreement()) {
|
||||||
|
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle')
|
||||||
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
|
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
|
||||||
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2')
|
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2')
|
||||||
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13')
|
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13')
|
||||||
|
@ -14,6 +14,12 @@ initscript {
|
|||||||
return System.getProperty(name) ?: System.getenv(envVarName)
|
return System.getProperty(name) ?: System.getenv(envVarName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def requestedInitScriptName = getInputParam('develocity.injection.init-script-name')
|
||||||
|
def initScriptName = buildscript.sourceFile.name
|
||||||
|
if (requestedInitScriptName != initScriptName) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// finish early if injection is disabled
|
// finish early if injection is disabled
|
||||||
def gradleInjectionEnabled = getInputParam("develocity.injection-enabled")
|
def gradleInjectionEnabled = getInputParam("develocity.injection-enabled")
|
||||||
if (gradleInjectionEnabled != "true") {
|
if (gradleInjectionEnabled != "true") {
|
||||||
@ -97,6 +103,13 @@ def getInputParam = { String name ->
|
|||||||
return System.getProperty(name) ?: System.getenv(envVarName)
|
return System.getProperty(name) ?: System.getenv(envVarName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def requestedInitScriptName = getInputParam('develocity.injection.init-script-name')
|
||||||
|
def initScriptName = buildscript.sourceFile.name
|
||||||
|
if (requestedInitScriptName != initScriptName) {
|
||||||
|
logger.quiet("Ignoring init script '${initScriptName}' as requested name '${requestedInitScriptName}' does not match")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// finish early if injection is disabled
|
// finish early if injection is disabled
|
||||||
def gradleInjectionEnabled = getInputParam("develocity.injection-enabled")
|
def gradleInjectionEnabled = getInputParam("develocity.injection-enabled")
|
||||||
if (gradleInjectionEnabled != "true") {
|
if (gradleInjectionEnabled != "true") {
|
||||||
|
@ -534,6 +534,7 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
|||||||
|
|
||||||
def getEnvVars() {
|
def getEnvVars() {
|
||||||
Map<String, String> envVars = [
|
Map<String, String> envVars = [
|
||||||
|
DEVELOCITY_INJECTION_INIT_SCRIPT_NAME : "gradle-actions.inject-develocity.init.gradle",
|
||||||
DEVELOCITY_INJECTION_ENABLED : "true",
|
DEVELOCITY_INJECTION_ENABLED : "true",
|
||||||
DEVELOCITY_URL : serverUrl,
|
DEVELOCITY_URL : serverUrl,
|
||||||
DEVELOCITY_ALLOW_UNTRUSTED_SERVER : "true",
|
DEVELOCITY_ALLOW_UNTRUSTED_SERVER : "true",
|
||||||
@ -552,6 +553,7 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
|||||||
|
|
||||||
def getJvmArgs() {
|
def getJvmArgs() {
|
||||||
List<String> jvmArgs = [
|
List<String> jvmArgs = [
|
||||||
|
"-Ddevelocity.injection.init-script-name=gradle-actions.inject-develocity.init.gradle",
|
||||||
"-Ddevelocity.injection-enabled=true",
|
"-Ddevelocity.injection-enabled=true",
|
||||||
"-Ddevelocity.url=$serverUrl",
|
"-Ddevelocity.url=$serverUrl",
|
||||||
"-Ddevelocity.allow-untrusted-server=true",
|
"-Ddevelocity.allow-untrusted-server=true",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user