Develocity updates (#101)

- Switch to use `com.gradle.develocity` for plugin ID
- Switch to use `v3.17` for plugin version
- Update for change documentation URLs
- Update for changes to `develocity` DSL
This commit is contained in:
Daz DeBoer 2024-04-03 21:09:16 -06:00 committed by GitHub
commit 5fe1aec3c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 90 additions and 119 deletions

View File

@ -1,13 +1,12 @@
plugins {
id "com.gradle.enterprise" version "3.16.2"
id "com.gradle.develocity" version "3.17"
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.13"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -1,14 +1,13 @@
plugins {
id("com.gradle.enterprise") version "3.16.2"
id("com.gradle.develocity") version "3.17"
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.13"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
isUploadInBackground = false
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -1,12 +1,11 @@
plugins {
id "com.gradle.build-scan" version "3.16.2"
id "com.gradle.develocity" version "3.17"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -1,12 +1,11 @@
plugins {
id "com.gradle.enterprise" version "3.16.2"
id "com.gradle.develocity" version "3.17"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -1,12 +1,11 @@
plugins {
id "com.gradle.enterprise" version "3.16.2"
id "com.gradle.develocity" version "3.17"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -31,10 +31,10 @@ jobs:
uses: ./setup-gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
# Add "enterprise" to main cache entry but omit "notifications"
# Add "application" to main cache entry but omit "notifications"
gradle-home-cache-includes: |
caches
enterprise
application
# Exclude build-cache from main cache entry
gradle-home-cache-excludes: |
caches/build-cache-*
@ -61,7 +61,7 @@ jobs:
# Use the same configuration as used in the seed build
gradle-home-cache-includes: |
caches
enterprise
application
gradle-home-cache-excludes: |
caches/build-cache-*
caches/*/executionHistory

View File

@ -139457,7 +139457,7 @@ function setup() {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
@ -141641,7 +141641,7 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);

File diff suppressed because one or more lines are too long

View File

@ -136910,7 +136910,7 @@ function setup() {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
@ -138960,7 +138960,7 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);

File diff suppressed because one or more lines are too long

View File

@ -647,7 +647,7 @@ name: Run build with Develocity injection
env:
DEVELOCITY_INJECTION_ENABLED: true
DEVELOCITY_URL: https://develocity.your-server.com
DEVELOCITY_PLUGIN_VERSION: 3.16.2
DEVELOCITY_PLUGIN_VERSION: 3.17
jobs:
build:
@ -660,11 +660,11 @@ jobs:
run: ./gradlew build
```
This configuration will automatically apply `v3.16.2` of the [Develocity Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/), and publish build scans to https://develocity.your-server.com.
This configuration will automatically apply `v3.17` of the [Develocity Gradle plugin](https://docs.gradle.com/develocity/gradle-plugin/), and publish build scans to https://develocity.your-server.com.
This example assumes that the `develocity.your-server.com` server allows anonymous publishing of build scans.
In the likely scenario that your Develocity server requires authentication, you will also need to configure an additional environment variable
with a valid [Develocity access key](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable).
with a valid [Develocity access key](https://docs.gradle.com/develocity/gradle-plugin/#via_environment_variable).
## Configuring Develocity injection
@ -677,7 +677,7 @@ The `init-script` supports several additional configuration parameters that you
| DEVELOCITY_ALLOW_UNTRUSTED_SERVER | | allow communication with an untrusted server; set to _true_ if your Develocity instance is using a self-signed certificate |
| DEVELOCITY_CAPTURE_FILE_FINGERPRINTS | | enables capturing the paths and content hashes of each individual input file |
| DEVELOCITY_ENFORCE_URL | | enforce the configured Develocity URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Develocity URL |
| DEVELOCITY_PLUGIN_VERSION | :white_check_mark: | the version of the [Develocity Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/) to apply |
| DEVELOCITY_PLUGIN_VERSION | :white_check_mark: | the version of the [Develocity Gradle plugin](https://docs.gradle.com/develocity/gradle-plugin/) to apply |
| DEVELOCITY_CCUD_PLUGIN_VERSION | | the version of the [Common Custom User Data Gradle plugin](https://github.com/gradle/common-custom-user-data-gradle-plugin) to apply, if any |
| GRADLE_PLUGIN_REPOSITORY_URL | | the URL of the repository to use when resolving the Develocity and CCUD plugins; the Gradle Plugin Portal is used by default |
| GRADLE_PLUGIN_REPOSITORY_USERNAME | | the username for the repository URL to use when resolving the Develocity and CCUD plugins |

View File

@ -6,7 +6,7 @@ export function setup(): void {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions')
if (getBuildScanPublishEnabled() && verifyTermsOfUseAgreement()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.16.2')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17')
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13')
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', getBuildScanTermsOfUseUrl())
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', getBuildScanTermsOfUseAgree())

View File

@ -113,7 +113,7 @@ function renderBuildScan(result: BuildResult): string {
return renderBuildScanBadge(
'PUBLISH_FAILED',
'orange',
'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting'
'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
)
}
if (result.buildScanUri) {

View File

@ -62,7 +62,7 @@ def captureUsingBuildScanPublished(buildScanExtension, rootProject, invocationId
if (githubOutput) {
new File(githubOutput) << "build-scan-url=${buildScan.buildScanUri}\n"
} else {
// Retained for compatibility with older GitHub Enterprise versions
// Retained for compatibility with older GHES versions
println("::set-output name=build-scan-url::${buildScan.buildScanUri}")
}
}

View File

@ -1,13 +1,12 @@
plugins {
id "com.gradle.enterprise" version "3.16.2"
id "com.gradle.develocity" version "3.17"
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.13"
}
gradleEnterprise {
develocity {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = false
}
}

View File

@ -130,30 +130,29 @@ class BaseInitScriptTest extends Specification {
}
def declareDevelocityPluginApplication(GradleVersion gradleVersion, URI serverUrl = mockScansServer.address) {
settingsFile.text = maybeAddPluginsToSettings(gradleVersion, null, serverUrl) + settingsFile.text
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, null, serverUrl) + buildFile.text
settingsFile.text = maybeAddPluginsToSettings(gradleVersion, false, null, serverUrl) + settingsFile.text
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, false, null, serverUrl) + buildFile.text
}
def declareLegacyGradleEnterprisePluginApplication(GradleVersion gradleVersion, URI serverUrl = mockScansServer.address) {
settingsFile.text = maybeAddPluginsToSettings(gradleVersion, true, null, serverUrl) + settingsFile.text
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, true, null, serverUrl) + buildFile.text
}
def declareDevelocityPluginAndCcudPluginApplication(GradleVersion gradleVersion, URI serverUrl = mockScansServer.address) {
settingsFile.text = maybeAddPluginsToSettings(gradleVersion, CCUD_PLUGIN_VERSION, serverUrl) + settingsFile.text
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, CCUD_PLUGIN_VERSION, serverUrl) + buildFile.text
settingsFile.text = maybeAddPluginsToSettings(gradleVersion, false, CCUD_PLUGIN_VERSION, serverUrl) + settingsFile.text
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, false, CCUD_PLUGIN_VERSION, serverUrl) + buildFile.text
}
String maybeAddPluginsToSettings(GradleVersion gradleVersion, String ccudPluginVersion, URI serverUri) {
String maybeAddPluginsToSettings(GradleVersion gradleVersion, boolean legacy, String ccudPluginVersion, URI serverUri) {
if (gradleVersion < GradleVersion.version('6.0')) {
'' // applied in build.gradle
} else {
"""
plugins {
id 'com.gradle.develocity' version '${DEVELOCITY_PLUGIN_VERSION}'
${ccudPluginVersion ? "id 'com.gradle.common-custom-user-data-gradle-plugin' version '$ccudPluginVersion'" : ""}
}
develocity.server = '$serverUri'
"""
configuredPlugin(gradleVersion, legacy, ccudPluginVersion, serverUri)
}
}
String maybeAddPluginsToRootProject(GradleVersion gradleVersion, String ccudPluginVersion, URI serverUrl) {
String maybeAddPluginsToRootProject(GradleVersion gradleVersion, boolean legacy, String ccudPluginVersion, URI serverUrl) {
if (gradleVersion < GradleVersion.version('5.0')) {
"""
plugins {
@ -166,18 +165,30 @@ class BaseInitScriptTest extends Specification {
}
"""
} else if (gradleVersion < GradleVersion.version('6.0')) {
"""
plugins {
id 'com.gradle.develocity' version '${DEVELOCITY_PLUGIN_VERSION}'
${ccudPluginVersion ? "id 'com.gradle.common-custom-user-data-gradle-plugin' version '$ccudPluginVersion'" : ""}
}
develocity.server = '$serverUrl'
"""
configuredPlugin(gradleVersion, legacy, ccudPluginVersion, serverUrl)
} else {
'' // applied in settings.gradle
}
}
String configuredPlugin(GradleVersion gradleVersion, boolean legacy, String ccudPluginVersion, URI serverUri) {
def pluginId = legacy
? (gradleVersion < GradleVersion.version('6.0') ? 'com.gradle.build-scan' : 'com.gradle.enterprise')
: 'com.gradle.develocity'
def pluginVersion = legacy ? "3.16.2" : DEVELOCITY_PLUGIN_VERSION
def configBlock = legacy ? 'gradleEnterprise' : 'develocity'
"""
plugins {
id '$pluginId' version '$pluginVersion'
${ccudPluginVersion ? "id 'com.gradle.common-custom-user-data-gradle-plugin' version '$ccudPluginVersion'" : ""}
}
$configBlock {
server = '$serverUri'
${legacy ? "buildScan { publishAlways() }" : ""}
}
"""
}
def addFailingTaskToBuild() {
buildFile << '''
task expectFailure {

View File

@ -68,6 +68,20 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
testGradleVersion << ALL_VERSIONS
}
def "produces build results file for #testGradleVersion with legacy enterprise plugin publishing build scan"() {
assumeTrue testGradleVersion.compatibleWithCurrentJvm
when:
declareLegacyGradleEnterprisePluginApplication(testGradleVersion.gradleVersion)
run(['help'], initScript, testGradleVersion.gradleVersion)
then:
assertResults('help', testGradleVersion, false, true)
where:
testGradleVersion << ALL_VERSIONS
}
def "produces build results file for #testGradleVersion with Develocity plugin and no build scan published"() {
assumeTrue testGradleVersion.compatibleWithCurrentJvm
@ -171,15 +185,12 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
when:
settingsFile.text = """
plugins {
id 'com.gradle.enterprise' version '3.16.2' apply(false)
id 'com.gradle.develocity' version '3.17' apply(false)
}
gradle.settingsEvaluated {
apply plugin: 'com.gradle.enterprise'
gradleEnterprise {
apply plugin: 'com.gradle.develocity'
develocity {
server = '$mockScansServer.address'
buildScan {
publishAlways()
}
}
}
""" + settingsFile.text

View File

@ -55,8 +55,7 @@ class TestDevelocityInjection extends BaseInitScriptTest {
assumeTrue testGradleVersion.compatibleWithCurrentJvm
given:
settingsFile.text = maybeAddGradleEnterprisePlugin(testGradleVersion.gradleVersion, '3.16.2')
buildFile.text = maybeAddBuildScanPlugin(testGradleVersion.gradleVersion, '3.16.2')
declareLegacyGradleEnterprisePluginApplication(testGradleVersion.gradleVersion)
when:
def result = run(testGradleVersion, testConfig())
@ -443,50 +442,6 @@ class TestDevelocityInjection extends BaseInitScriptTest {
}
}
private String maybeAddGradleEnterprisePlugin(GradleVersion gradleVersion, String gePluginVersion) {
if (gradleVersion < GradleVersion.version('6.0')) {
'' // applied in build.gradle
} else {
"""
plugins {
id 'com.gradle.enterprise' version '${gePluginVersion}'
}
gradleEnterprise {
server = '${mockScansServer.address}'
buildScan {
publishAlways()
}
}
"""
}
}
private String maybeAddBuildScanPlugin(GradleVersion gradleVersion, String buildScanPluginVersion) {
if (gradleVersion < GradleVersion.version('5.0')) {
"""
plugins {
id 'com.gradle.build-scan' version '1.16'
}
buildScan {
server = '${mockScansServer.address}'
publishAlways()
}
"""
} else if (gradleVersion < GradleVersion.version('6.0')) {
"""
plugins {
id 'com.gradle.build-scan' version '${buildScanPluginVersion}'
}
buildScan {
server = '${mockScansServer.address}'
publishAlways()
}
"""
} else {
'' // applied in settings.gradle
}
}
private TestConfig testConfig(String develocityPluginVersion = DEVELOCITY_PLUGIN_VERSION) {
new TestConfig(develocityPluginVersion)
}