diff --git a/build-data-capturing-gradle-samples/README.md b/build-data-capturing-gradle-samples/README.md index d7ade9900..8e55b6957 100644 --- a/build-data-capturing-gradle-samples/README.md +++ b/build-data-capturing-gradle-samples/README.md @@ -38,6 +38,12 @@ _Demonstrates: Custom links_ This sample creates a private GitHub gist containing the difference between the current working directory and the index. The URL of the gist is included as a custom link named `Git diff` at the top of the Build Scan. +### Capture maxParallelForks + +_Demonstrates: Custom values_ + +This sample captures the value of `maxParallelForks` for each test task and adds it to the Build Scan as a custom value. + ### Capture OS Processes _Demonstrates: Custom values_ diff --git a/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle b/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle new file mode 100644 index 000000000..4e86452c1 --- /dev/null +++ b/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle @@ -0,0 +1,10 @@ +def buildScan = project.extensions.findByName('buildScan') +if (!buildScan) { + return +} + +allprojects { + tasks.withType(Test).configureEach { + buildScan.value "${identityPath}#maxParallelForks", "$maxParallelForks" + } +} diff --git a/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle.kts b/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle.kts new file mode 100644 index 000000000..5df9355cf --- /dev/null +++ b/build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle.kts @@ -0,0 +1,11 @@ +import com.gradle.enterprise.gradleplugin.GradleEnterpriseExtension + +project.extensions.configure() { + buildScan { + allprojects { + tasks.withType().configureEach { + value("${identityPath}#maxParallelForks", "$maxParallelForks") + } + } + } +}