Skip to content

Commit

Permalink
Merge pull request #909 from gradle/tylerbertrand/gradle-maxparallelf…
Browse files Browse the repository at this point in the history
…orks-data-capture-sample

Add samples capturing maxParallelForks as a custom value
  • Loading branch information
tylerbertrand authored Oct 13, 2023
2 parents c1996a4 + ad2a2f4 commit 6b507f5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build-data-capturing-gradle-samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def buildScan = project.extensions.findByName('buildScan')
if (!buildScan) {
return
}

allprojects {
tasks.withType(Test).configureEach {
buildScan.value "${identityPath}#maxParallelForks", "$maxParallelForks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import com.gradle.enterprise.gradleplugin.GradleEnterpriseExtension

project.extensions.configure<GradleEnterpriseExtension>() {
buildScan {
allprojects {
tasks.withType<Test>().configureEach {
value("${identityPath}#maxParallelForks", "$maxParallelForks")
}
}
}
}

0 comments on commit 6b507f5

Please sign in to comment.