Skip to content

Commit

Permalink
Develocity updates (#101)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
bigdaz authored Apr 4, 2024
2 parents 5a171ce + 7be6c56 commit 5fe1aec
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 118 deletions.
9 changes: 4 additions & 5 deletions .github/workflow-samples/groovy-dsl/settings.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflow-samples/kotlin-dsl/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
}
}

Expand Down
9 changes: 4 additions & 5 deletions .github/workflow-samples/no-wrapper-gradle-5/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
9 changes: 4 additions & 5 deletions .github/workflow-samples/no-wrapper/settings.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integ-test-caching-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-*
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dist/setup-gradle/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)());
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion dist/setup-gradle/main/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/setup-gradle/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)());
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion dist/setup-gradle/post/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions setup-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion sources/src/build-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion sources/src/job-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
}
Expand Down
9 changes: 4 additions & 5 deletions sources/test/init-scripts/settings.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -166,16 +165,28 @@ class BaseInitScriptTest extends Specification {
}
"""
} else if (gradleVersion < GradleVersion.version('6.0')) {
"""
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 'com.gradle.develocity' version '${DEVELOCITY_PLUGIN_VERSION}'
id '$pluginId' version '$pluginVersion'
${ccudPluginVersion ? "id 'com.gradle.common-custom-user-data-gradle-plugin' version '$ccudPluginVersion'" : ""}
}
develocity.server = '$serverUrl'
$configBlock {
server = '$serverUri'
${legacy ? "buildScan { publishAlways() }" : ""}
}
"""
} else {
'' // applied in settings.gradle
}
}

def addFailingTaskToBuild() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5fe1aec

Please sign in to comment.