@@ -14,6 +14,7 @@ pluginManagement {
1414}
1515
1616plugins {
17+ id(" com.gradle.develocity" ) version " 4.2"
1718 id(" com.gradle.common-custom-user-data-gradle-plugin" ) version " 2.4.0"
1819 id(" org.gradle.toolchains.foojay-resolver-convention" ) version " 1.0.0"
1920 // this can't live in pluginManagement currently due to
@@ -22,7 +23,6 @@ plugins {
2223 // ./gradlew :smoke-tests:images:servlet:buildLinuxTestImages pushMatrix -PsmokeTestServer=jetty
2324 // ./gradlew :smoke-tests:images:servlet:buildWindowsTestImages pushMatrix -PsmokeTestServer=jetty
2425 id(" com.bmuschko.docker-remote-api" ) version " 9.4.0" apply false
25- id(" com.gradle.develocity" ) version " 4.2.2"
2626}
2727
2828dependencyResolutionManagement {
@@ -47,21 +47,67 @@ dependencyResolutionManagement {
4747 }
4848}
4949
50- develocity {
51- buildScan {
52- publishing.onlyIf { System .getenv(" CI" ) != null }
53- termsOfUseUrl.set(" https://gradle.com/help/legal-terms-of-use" )
54- termsOfUseAgree.set(" yes" )
50+ val gradleEnterpriseServer = " https://ge.opentelemetry.io"
51+ val isCI = System .getenv(" CI" ) != null
52+ val geAccessKey = System .getenv(" GRADLE_ENTERPRISE_ACCESS_KEY" ) ? : " "
5553
56- if (! gradle.startParameter.taskNames.contains(" listTestsInPartition" ) &&
57- ! gradle.startParameter.taskNames.contains(" :test-report:reportFlakyTests" )) {
58- buildScanPublished {
59- File (" build-scan.txt" ).printWriter().use { writer ->
60- writer.println (buildScanUri)
54+ // if GE access key is not given and we are in CI, then we publish to scans.gradle.com
55+ val useScansGradleCom = isCI && geAccessKey.isEmpty()
56+
57+ if (useScansGradleCom) {
58+ develocity {
59+ buildScan {
60+ termsOfUseUrl = " https://gradle.com/help/legal-terms-of-use"
61+ termsOfUseAgree = " yes"
62+ uploadInBackground = ! isCI
63+
64+ capture {
65+ fileFingerprints = true
66+ }
67+
68+ if (! gradle.startParameter.taskNames.contains(" listTestsInPartition" ) &&
69+ ! gradle.startParameter.taskNames.contains(" :test-report:reportFlakyTests" )) {
70+ buildScanPublished {
71+ File (" build-scan.txt" ).printWriter().use { writer ->
72+ writer.println (buildScanUri)
73+ }
74+ }
75+ }
76+ }
77+ }
78+ } else {
79+ develocity {
80+ server = gradleEnterpriseServer
81+ buildScan {
82+ uploadInBackground = ! isCI
83+ publishing.onlyIf { it.isAuthenticated }
84+
85+ capture {
86+ fileFingerprints = true
87+ }
88+
89+ gradle.startParameter.projectProperties[" testJavaVersion" ]?.let { tag(it) }
90+ gradle.startParameter.projectProperties[" testJavaVM" ]?.let { tag(it) }
91+ gradle.startParameter.projectProperties[" smokeTestSuite" ]?.let {
92+ value(" Smoke test suite" , it)
93+ }
94+
95+ if (! gradle.startParameter.taskNames.contains(" listTestsInPartition" ) &&
96+ ! gradle.startParameter.taskNames.contains(" :test-report:reportFlakyTests" )) {
97+ buildScanPublished {
98+ File (" build-scan.txt" ).printWriter().use { writer ->
99+ writer.println (buildScanUri)
100+ }
61101 }
62102 }
63103 }
64104 }
105+
106+ buildCache {
107+ remote(develocity.buildCache) {
108+ isPush = isCI && geAccessKey.isNotEmpty()
109+ }
110+ }
65111}
66112
67113rootProject.name = " opentelemetry-java-instrumentation"
0 commit comments