@@ -76,41 +76,40 @@ val develocityServer = "https://develocity.opentelemetry.io"
7676val isCI = System .getenv(" CI" ) != null
7777val develocityAccessKey = System .getenv(" DEVELOCITY_ACCESS_KEY" ) ? : " "
7878
79- // if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
80- val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
81-
8279develocity {
83- if (useScansGradleCom) {
84- buildScan {
85- termsOfUseUrl = " https://gradle.com/help/legal-terms-of-use"
86- termsOfUseAgree = " yes"
87- }
88- } else {
80+ if (develocityAccessKey.isNotEmpty()) {
8981 server = develocityServer
90- buildScan {
91- publishing.onlyIf { it.isAuthenticated }
82+ }
9283
84+ buildScan {
85+ if (develocityAccessKey.isNotEmpty()) {
9386 gradle.startParameter.projectProperties[" testJavaVersion" ]?.let { tag(it) }
9487 gradle.startParameter.projectProperties[" testJavaVM" ]?.let { tag(it) }
9588 gradle.startParameter.projectProperties[" smokeTestSuite" ]?.let {
9689 value(" Smoke test suite" , it)
9790 }
91+ } else if (isCI) {
92+ termsOfUseUrl = " https://gradle.com/help/legal-terms-of-use"
93+ termsOfUseAgree = " yes"
94+ } else {
95+ publishing.onlyIf { false }
9896 }
99- }
100-
101- buildScan {
102- uploadInBackground = ! isCI
10397
10498 capture {
10599 fileFingerprints = true
106100 }
101+
102+ buildScanPublished {
103+ File (" build-scan.txt" ).printWriter().use { writer ->
104+ writer.println (buildScanUri)
105+ }
106+ }
107107 }
108108}
109109
110- if (! useScansGradleCom) {
111- buildCache {
112- remote(develocity.buildCache) {
113- isPush = isCI && develocityAccessKey.isNotEmpty()
114- }
110+ buildCache {
111+ remote(HttpBuildCache ::class ) {
112+ url = uri(" $develocityServer /cache/" )
113+ isPush = isCI && develocityAccessKey.isNotEmpty()
115114 }
116115}
0 commit comments