mirror of
https://github.com/gradle/actions.git
synced 2026-11-21 21:42:10 +00:00
Configure the build cache through Develocity injection
Add setup-gradle inputs that configure the remote and local build cache through Develocity injection. Each input is passed to the init script as a DEVELOCITY_INJECTION_* environment variable. The remote build cache uses the Develocity Build Cache connector. The develocity-enforce-url description also explains how the enforced URL applies to a Build Cache connector.
This commit is contained in:
7 files changed
+322
-14
No files matched your search
+80
-13
@@ -431,6 +431,8 @@ As well as reducing the content that needs to be saved to the GitHub Actions cac
|
||||
this setup will ensure that your CI builds populate the remote cache and keep the cache entries fresh by reading these entries.
|
||||
Local builds can then benefit from the remote cache.
|
||||
|
||||
If your build uses Develocity, `setup-gradle` can apply this setup for you with [Develocity injection](#configuring-the-build-cache-with-develocity-injection).
|
||||
|
||||
## Basic Caching
|
||||
|
||||
Basic Caching is an open-source (MIT) alternative that uses `@actions/cache` to provide straightforward, path-based caching of Gradle dependencies. It uses the same caching strategy as `actions/setup-java` with `cache: gradle`.
|
||||
@@ -979,20 +981,20 @@ This access key will be used during the action execution to get a short-lived to
|
||||
|
||||
### Configuring Develocity injection
|
||||
|
||||
The `init-script` supports several additional configuration parameters that you may find useful. All configuration options (required and optional) are detailed below:
|
||||
The `init-script` supports several additional configuration parameters that you may find useful. These configuration options (required and optional) are detailed below:
|
||||
|
||||
| Variable | Required | Description |
|
||||
|--------------------------------------| :---: |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| develocity-injection-enabled | :white_check_mark: | enables Develocity injection |
|
||||
| develocity-url | :white_check_mark: | the URL of the Develocity server |
|
||||
| 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/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 |
|
||||
| gradle-plugin-repository-password | | the password for the repository URL to use when resolving the Develocity and CCUD plugins; Consider using secrets to pass the value to this variable |
|
||||
| Variable | Required | Description |
|
||||
|--------------------------------------| :---: |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| develocity-injection-enabled | :white_check_mark: | enables Develocity injection |
|
||||
| develocity-url | :white_check_mark: | the URL of the Develocity server |
|
||||
| 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; a Develocity Build Cache connector without a server defined follows the enforced URL, but a server explicitly configured in the project's build is not changed |
|
||||
| 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 |
|
||||
| gradle-plugin-repository-password | | the password for the repository URL to use when resolving the Develocity and CCUD plugins; Consider using secrets to pass the value to this variable |
|
||||
|
||||
The input parameters can be expressed as environment variables following the relationships outlined in the table below:
|
||||
|
||||
@@ -1026,6 +1028,71 @@ Here's an example using the env vars:
|
||||
DEVELOCITY_INJECTION_CCUD_PLUGIN_VERSION: '2.2.1'
|
||||
```
|
||||
|
||||
### Configuring the build cache with Develocity injection
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Develocity injection can configure the local and remote build caches, but it cannot enable
|
||||
> the [Gradle build cache](https://docs.gradle.org/current/userguide/build_cache.html) feature
|
||||
> itself. Enable it with `org.gradle.caching=true` in `gradle.properties` or with the
|
||||
> `--build-cache` command line option. Without it, the `setup-gradle` build cache configuration
|
||||
> has no effect.
|
||||
|
||||
Develocity injection can also configure the build cache of your build.
|
||||
The remote build cache is configured with the [Develocity Build Cache connector](https://docs.gradle.com/develocity/gradle-plugin/current/#using_build_caching), which uses the Develocity server unless another server is configured.
|
||||
The connector authenticates with the same access key the Develocity Gradle plugin uses to publish Build Scans.
|
||||
|
||||
| Input | Description |
|
||||
|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| develocity-enforce-build-cache | set to _true_ to replace a remote build cache configured in the project's build with the Develocity Build Cache connector |
|
||||
| develocity-remote-build-cache-enabled | enable the remote build cache |
|
||||
| develocity-remote-build-cache-push | store task outputs in the remote build cache |
|
||||
| develocity-remote-build-cache-server | the URL of the remote build cache server; the Develocity server is used by default |
|
||||
| develocity-remote-build-cache-path | the path of the remote build cache on the server |
|
||||
| develocity-remote-build-cache-allow-insecure-protocol | allow communication with the remote build cache over plain HTTP |
|
||||
| develocity-remote-build-cache-allow-untrusted-server | allow communication with an untrusted remote build cache server |
|
||||
| develocity-local-build-cache-enabled | enable the local build cache |
|
||||
| develocity-local-build-cache-push | store task outputs in the local build cache |
|
||||
|
||||
The input parameters can be expressed as environment variables following the relationships outlined in the table below:
|
||||
|
||||
| Input | Environment Variable |
|
||||
|-------------------------------------------------------|-----------------------------------------------------------------|
|
||||
| develocity-enforce-build-cache | DEVELOCITY_INJECTION_ENFORCE_BUILD_CACHE |
|
||||
| develocity-remote-build-cache-enabled | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ENABLED |
|
||||
| develocity-remote-build-cache-push | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PUSH |
|
||||
| develocity-remote-build-cache-server | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_SERVER |
|
||||
| develocity-remote-build-cache-path | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PATH |
|
||||
| develocity-remote-build-cache-allow-insecure-protocol | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ALLOW_INSECURE_PROTOCOL |
|
||||
| develocity-remote-build-cache-allow-untrusted-server | DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ALLOW_UNTRUSTED_SERVER |
|
||||
| develocity-local-build-cache-enabled | DEVELOCITY_INJECTION_LOCAL_BUILD_CACHE_ENABLED |
|
||||
| develocity-local-build-cache-push | DEVELOCITY_INJECTION_LOCAL_BUILD_CACHE_PUSH |
|
||||
|
||||
The remote build cache is only configured when `develocity-remote-build-cache-enabled` is set, and the local build cache only when `develocity-local-build-cache-enabled` is set.
|
||||
If the project's build already configures a remote build cache, the existing build cache configuration is not modified unless `develocity-enforce-build-cache` is set to _true_.
|
||||
If the remote build cache cannot be configured, the local build cache is not configured either, so a build is never left with a partial build cache configuration.
|
||||
|
||||
Build cache configuration requires Gradle 6.0 or later and the Develocity Gradle plugin 3.11 or later.
|
||||
With the configuration cache enabled, it requires Gradle 7.5.1 or later.
|
||||
Builds that do not meet these requirements keep their own build cache configuration.
|
||||
|
||||
Here's an example that has CI builds populate the remote build cache on the Develocity server and disables the local build cache:
|
||||
|
||||
```yaml
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
with:
|
||||
develocity-access-key: ${{ secrets.MY_DEVELOCITY_ACCESS_KEY }}
|
||||
develocity-injection-enabled: true
|
||||
develocity-url: 'https://develocity.your-server.com'
|
||||
develocity-plugin-version: '4.0'
|
||||
develocity-remote-build-cache-enabled: true
|
||||
develocity-remote-build-cache-push: true
|
||||
develocity-local-build-cache-enabled: false
|
||||
|
||||
- name: Run a Gradle build with the Develocity remote build cache
|
||||
run: ./gradlew build --build-cache
|
||||
```
|
||||
|
||||
# Dependency verification
|
||||
|
||||
Develocity injection, Build Scan publishing and Dependency Graph generation all work by applying external plugins to your build.
|
||||
|
||||
@@ -136,6 +136,33 @@ inputs:
|
||||
develocity-ccud-plugin-version:
|
||||
type: string
|
||||
|
||||
develocity-enforce-build-cache:
|
||||
type: boolean
|
||||
|
||||
develocity-remote-build-cache-enabled:
|
||||
type: boolean
|
||||
|
||||
develocity-remote-build-cache-push:
|
||||
type: boolean
|
||||
|
||||
develocity-remote-build-cache-server:
|
||||
type: string
|
||||
|
||||
develocity-remote-build-cache-path:
|
||||
type: string
|
||||
|
||||
develocity-remote-build-cache-allow-insecure-protocol:
|
||||
type: boolean
|
||||
|
||||
develocity-remote-build-cache-allow-untrusted-server:
|
||||
type: boolean
|
||||
|
||||
develocity-local-build-cache-enabled:
|
||||
type: boolean
|
||||
|
||||
develocity-local-build-cache-push:
|
||||
type: boolean
|
||||
|
||||
gradle-plugin-repository-url:
|
||||
type: string
|
||||
|
||||
|
||||
+37
-1
@@ -174,7 +174,7 @@ inputs:
|
||||
required: false
|
||||
|
||||
develocity-enforce-url:
|
||||
description: 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.
|
||||
description: 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; a Develocity Build Cache connector without a server defined follows the enforced URL, but a server explicitly configured in the project's build is not changed.
|
||||
required: false
|
||||
|
||||
develocity-plugin-version:
|
||||
@@ -185,6 +185,42 @@ inputs:
|
||||
description: The version of the Common Custom User Data Gradle plugin to apply, if any.
|
||||
required: false
|
||||
|
||||
develocity-enforce-build-cache:
|
||||
description: Replace a remote build cache configured in the project's build with the Develocity Build Cache connector.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-enabled:
|
||||
description: Enables the remote build cache.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-push:
|
||||
description: Store task outputs in the remote build cache.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-server:
|
||||
description: The URL of the remote build cache server; the Develocity server is used by default.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-path:
|
||||
description: The path of the remote build cache on the server.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-allow-insecure-protocol:
|
||||
description: Allow communication with the remote build cache over plain HTTP.
|
||||
required: false
|
||||
|
||||
develocity-remote-build-cache-allow-untrusted-server:
|
||||
description: Allow communication with an untrusted remote build cache server.
|
||||
required: false
|
||||
|
||||
develocity-local-build-cache-enabled:
|
||||
description: Enables the local build cache.
|
||||
required: false
|
||||
|
||||
develocity-local-build-cache-push:
|
||||
description: Store task outputs in the local build cache.
|
||||
required: false
|
||||
|
||||
gradle-plugin-repository-url:
|
||||
description: The URL of the repository to use when resolving the Develocity and CCUD plugins; the Gradle Plugin Portal is used by default.
|
||||
required: false
|
||||
|
||||
@@ -312,6 +312,42 @@ export class DevelocityConfig {
|
||||
return core.getInput('develocity-ccud-plugin-version')
|
||||
}
|
||||
|
||||
getDevelocityEnforceBuildCache(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-enforce-build-cache')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCacheEnabled(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-remote-build-cache-enabled')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCachePush(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-remote-build-cache-push')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCacheServer(): string {
|
||||
return core.getInput('develocity-remote-build-cache-server')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCachePath(): string {
|
||||
return core.getInput('develocity-remote-build-cache-path')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCacheAllowInsecureProtocol(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-remote-build-cache-allow-insecure-protocol')
|
||||
}
|
||||
|
||||
getDevelocityRemoteBuildCacheAllowUntrustedServer(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-remote-build-cache-allow-untrusted-server')
|
||||
}
|
||||
|
||||
getDevelocityLocalBuildCacheEnabled(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-local-build-cache-enabled')
|
||||
}
|
||||
|
||||
getDevelocityLocalBuildCachePush(): boolean | undefined {
|
||||
return getOptionalBooleanInput('develocity-local-build-cache-push')
|
||||
}
|
||||
|
||||
getPluginRepository(): PluginRepositoryConfig {
|
||||
return new PluginRepositoryConfig()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,39 @@ export function setup(config: DevelocityConfig): void {
|
||||
'DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_PASSWORD',
|
||||
config.getPluginRepository().getPassword()
|
||||
)
|
||||
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_ENFORCE_BUILD_CACHE', config.getDevelocityEnforceBuildCache())
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ENABLED',
|
||||
config.getDevelocityRemoteBuildCacheEnabled()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PUSH',
|
||||
config.getDevelocityRemoteBuildCachePush()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_SERVER',
|
||||
config.getDevelocityRemoteBuildCacheServer()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PATH',
|
||||
config.getDevelocityRemoteBuildCachePath()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ALLOW_INSECURE_PROTOCOL',
|
||||
config.getDevelocityRemoteBuildCacheAllowInsecureProtocol()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ALLOW_UNTRUSTED_SERVER',
|
||||
config.getDevelocityRemoteBuildCacheAllowUntrustedServer()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_LOCAL_BUILD_CACHE_ENABLED',
|
||||
config.getDevelocityLocalBuildCacheEnabled()
|
||||
)
|
||||
maybeExportVariableNotEmpty(
|
||||
'DEVELOCITY_INJECTION_LOCAL_BUILD_CACHE_PUSH',
|
||||
config.getDevelocityLocalBuildCachePush()
|
||||
)
|
||||
|
||||
// If build-scan-publish is enabled, ensure the environment variables are set
|
||||
// The DEVELOCITY_PLUGIN_VERSION and DEVELOCITY_CCUD_PLUGIN_VERSION are set to the latest versions
|
||||
|
||||
+10
@@ -147,6 +147,16 @@ class BaseInitScriptTest extends Specification {
|
||||
buildFile.text = maybeAddPluginsToRootProject(gradleVersion, false, CCUD_PLUGIN_VERSION, serverUrl) + buildFile.text
|
||||
}
|
||||
|
||||
def declareHttpBuildCache() {
|
||||
settingsFile << """
|
||||
buildCache {
|
||||
remote(HttpBuildCache) {
|
||||
url = 'https://build-cache-server.invalid/cache/'
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
String maybeAddPluginsToSettings(GradleVersion gradleVersion, boolean legacy, String ccudPluginVersion, URI serverUri) {
|
||||
if (gradleVersion < GradleVersion.version('6.0')) {
|
||||
'' // applied in build.gradle
|
||||
|
||||
+99
@@ -354,6 +354,47 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
testGradleVersion << CONFIGURATION_CACHE_VERSIONS
|
||||
}
|
||||
|
||||
def "configures remote and local build cache when Develocity plugin is applied by the init script"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
def config = testConfig().withRemoteBuildCache().withLocalBuildCache(false)
|
||||
def result = run(testGradleVersion, config)
|
||||
|
||||
then:
|
||||
outputContainsDevelocityPluginApplicationViaInitScript(result, testGradleVersion.gradleVersion)
|
||||
outputContainsRemoteBuildCacheConfiguration(result, 'Develocity server', '<default>', true, true)
|
||||
outputContainsLocalBuildCacheConfiguration(result, false, true)
|
||||
|
||||
and:
|
||||
outputContainsBuildScanUrl(result)
|
||||
|
||||
where:
|
||||
testGradleVersion << SETTINGS_PLUGIN_VERSIONS
|
||||
}
|
||||
|
||||
def "enforces remote build cache in project if enforce build cache parameter is enabled"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
given:
|
||||
declareHttpBuildCache()
|
||||
|
||||
when:
|
||||
def config = testConfig().withRemoteBuildCache().withRemoteBuildCacheLocation('https://build-cache-server.invalid', 'cache').withEnforceBuildCache()
|
||||
def result = run(testGradleVersion, config)
|
||||
|
||||
then:
|
||||
outputContainsDevelocityPluginApplicationViaInitScript(result, testGradleVersion.gradleVersion)
|
||||
outputReplacesRemoteBuildCache(result)
|
||||
outputContainsRemoteBuildCacheConfiguration(result, 'https://build-cache-server.invalid', 'cache', true, true)
|
||||
|
||||
and:
|
||||
outputContainsBuildScanUrl(result)
|
||||
|
||||
where:
|
||||
testGradleVersion << SETTINGS_PLUGIN_VERSIONS
|
||||
}
|
||||
|
||||
void outputContainsBuildScanUrl(BuildResult result) {
|
||||
def opt = ['Publishing build scan...', 'Publishing Build Scan...', 'Publishing Build Scan to Develocity...'].stream()
|
||||
.filter { result.output.contains("${it}\n${mockScansServer.address}s/$PUBLIC_BUILD_SCAN_ID") }.findFirst()
|
||||
@@ -441,6 +482,24 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
assert 1 == result.output.count(enforceUrl)
|
||||
}
|
||||
|
||||
void outputContainsRemoteBuildCacheConfiguration(BuildResult result, String server, String path, boolean enabled, boolean push) {
|
||||
def remoteBuildCacheInfo = "Configuring the remote build cache: $server, path: $path, enabled: $enabled, push: $push, allowInsecureProtocol: false, allowUntrustedServer: <default>"
|
||||
assert result.output.contains(remoteBuildCacheInfo)
|
||||
assert 1 == result.output.count(remoteBuildCacheInfo)
|
||||
}
|
||||
|
||||
void outputContainsLocalBuildCacheConfiguration(BuildResult result, boolean enabled, boolean push) {
|
||||
def localBuildCacheInfo = "Configuring the local build cache: enabled: $enabled, push: $push"
|
||||
assert result.output.contains(localBuildCacheInfo)
|
||||
assert 1 == result.output.count(localBuildCacheInfo)
|
||||
}
|
||||
|
||||
void outputReplacesRemoteBuildCache(BuildResult result) {
|
||||
def replaceRemoteBuildCache = "Replacing the existing remote build cache with the Develocity Build Cache connector"
|
||||
assert result.output.contains(replaceRemoteBuildCache)
|
||||
assert 1 == result.output.count(replaceRemoteBuildCache)
|
||||
}
|
||||
|
||||
private BuildResult run(TestGradleVersion testGradleVersion, TestConfig config, List<String> args = ["help"]) {
|
||||
return run(args, initScript, testGradleVersion.gradleVersion, config.jvmArgs, config.envVars)
|
||||
}
|
||||
@@ -457,6 +516,12 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
String pluginRepositoryUsername = null
|
||||
String pluginRepositoryPassword = null
|
||||
boolean captureFileFingerprints = false
|
||||
boolean enforceBuildCache = false
|
||||
Boolean remoteBuildCacheEnabled = null
|
||||
Boolean remoteBuildCachePush = null
|
||||
String remoteBuildCacheServer = null
|
||||
String remoteBuildCachePath = null
|
||||
Boolean localBuildCacheEnabled = null
|
||||
String develocityPluginVersion
|
||||
|
||||
TestConfig(String develocityPluginVersion) {
|
||||
@@ -490,6 +555,28 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
return this
|
||||
}
|
||||
|
||||
TestConfig withRemoteBuildCache(boolean enabled = true, boolean push = true) {
|
||||
this.remoteBuildCacheEnabled = enabled
|
||||
this.remoteBuildCachePush = push
|
||||
return this
|
||||
}
|
||||
|
||||
TestConfig withRemoteBuildCacheLocation(String server, String path) {
|
||||
this.remoteBuildCacheServer = server
|
||||
this.remoteBuildCachePath = path
|
||||
return this
|
||||
}
|
||||
|
||||
TestConfig withLocalBuildCache(boolean enabled = true) {
|
||||
this.localBuildCacheEnabled = enabled
|
||||
return this
|
||||
}
|
||||
|
||||
TestConfig withEnforceBuildCache() {
|
||||
this.enforceBuildCache = true
|
||||
return this
|
||||
}
|
||||
|
||||
def getEnvVars() {
|
||||
Map<String, String> envVars = [
|
||||
DEVELOCITY_INJECTION_INIT_SCRIPT_NAME : "gradle-actions.inject-develocity.init.gradle",
|
||||
@@ -507,6 +594,12 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
if (pluginRepositoryUrl != null) envVars.put("DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_URL", pluginRepositoryUrl)
|
||||
if (pluginRepositoryUsername != null) envVars.put("DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_USERNAME", pluginRepositoryUsername)
|
||||
if (pluginRepositoryPassword != null) envVars.put("DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_PASSWORD", pluginRepositoryPassword)
|
||||
if (enforceBuildCache) envVars.put("DEVELOCITY_INJECTION_ENFORCE_BUILD_CACHE", "true")
|
||||
if (remoteBuildCacheEnabled != null) envVars.put("DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_ENABLED", String.valueOf(remoteBuildCacheEnabled))
|
||||
if (remoteBuildCachePush != null) envVars.put("DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PUSH", String.valueOf(remoteBuildCachePush))
|
||||
if (remoteBuildCacheServer != null) envVars.put("DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_SERVER", remoteBuildCacheServer)
|
||||
if (remoteBuildCachePath != null) envVars.put("DEVELOCITY_INJECTION_REMOTE_BUILD_CACHE_PATH", remoteBuildCachePath)
|
||||
if (localBuildCacheEnabled != null) envVars.put("DEVELOCITY_INJECTION_LOCAL_BUILD_CACHE_ENABLED", String.valueOf(localBuildCacheEnabled))
|
||||
|
||||
return envVars
|
||||
}
|
||||
@@ -529,6 +622,12 @@ class TestDevelocityInjection extends BaseInitScriptTest {
|
||||
if (pluginRepositoryUrl != null) jvmArgs.add("-Ddevelocity-injection.plugin-repository.url=$pluginRepositoryUrl")
|
||||
if (pluginRepositoryUsername != null) jvmArgs.add("-Ddevelocity-injection.plugin-repository.username=$pluginRepositoryUsername")
|
||||
if (pluginRepositoryPassword != null) jvmArgs.add("-Ddevelocity-injection.plugin-repository.password=$pluginRepositoryPassword")
|
||||
if (enforceBuildCache) jvmArgs.add("-Ddevelocity-injection.enforce-build-cache=true")
|
||||
if (remoteBuildCacheEnabled != null) jvmArgs.add("-Ddevelocity-injection.remote-build-cache.enabled=$remoteBuildCacheEnabled")
|
||||
if (remoteBuildCachePush != null) jvmArgs.add("-Ddevelocity-injection.remote-build-cache.push=$remoteBuildCachePush")
|
||||
if (remoteBuildCacheServer != null) jvmArgs.add("-Ddevelocity-injection.remote-build-cache.server=$remoteBuildCacheServer")
|
||||
if (remoteBuildCachePath != null) jvmArgs.add("-Ddevelocity-injection.remote-build-cache.path=$remoteBuildCachePath")
|
||||
if (localBuildCacheEnabled != null) jvmArgs.add("-Ddevelocity-injection.local-build-cache.enabled=$localBuildCacheEnabled")
|
||||
|
||||
return jvmArgs.collect { it.toString() } // Convert from GStrings
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user