-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 6f203b8)
- Loading branch information
Showing
7 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.gradle.develocity) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
import org.gradle.api.initialization.Settings | ||
import org.gradle.api.provider.Provider | ||
|
||
|
||
val buildingOnTeamCity: Boolean = System.getenv("TEAMCITY_VERSION") != null | ||
val buildingOnGitHub: Boolean = System.getenv("GITHUB_ACTION") != null | ||
val buildingOnCi: Boolean = System.getenv("CI") != null || buildingOnTeamCity || buildingOnGitHub | ||
|
||
// NOTE: build scan properties are documented in README.md | ||
val Settings.buildScanEnabled: Provider<Boolean> | ||
get() = | ||
kotlinCompilerServerProperty("build.scan.enabled", String::toBoolean) | ||
.orElse(buildingOnCi) | ||
|
||
internal const val DEFAULT_KOTLIN_COMPILER_SERVER_USER_NAME = "<default>" | ||
|
||
/** | ||
* Optionaly override the default name attached to a Build Scan. | ||
*/ | ||
val Settings.buildScanUsername: Provider<String> | ||
get() = | ||
kotlinCompilerServerProperty("build.scan.username") | ||
.orElse(DEFAULT_KOTLIN_COMPILER_SERVER_USER_NAME) | ||
.map(String::trim) | ||
|
||
internal fun Settings.kotlinCompilerServerProperty(name: String): Provider<String> = | ||
providers.gradleProperty("org.jetbrains.kotlin.compiler.server.$name") | ||
|
||
internal fun <T : Any> Settings.kotlinCompilerServerProperty(name: String, convert: (String) -> T): Provider<T> = | ||
kotlinCompilerServerProperty(name).map(convert) | ||
|
34 changes: 34 additions & 0 deletions
34
build-settings-logic/src/main/kotlin/kotlin-compiler-server-build-scan.settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// this is a settings convention plugin for Gradle Develocity | ||
|
||
plugins { | ||
id("com.gradle.develocity") | ||
} | ||
|
||
develocity { | ||
if (buildScanEnabled.get()) { | ||
val overriddenName = buildScanUsername.orNull | ||
server = "https://ge.jetbrains.com/" | ||
buildScan { | ||
publishing.onlyIf { true } | ||
capture { | ||
fileFingerprints = true | ||
buildLogging = true | ||
uploadInBackground = true | ||
} | ||
obfuscation { | ||
ipAddresses { _ -> listOf("0.0.0.0") } | ||
hostname { _ -> "concealed" } | ||
username { originalUsername -> | ||
when { | ||
buildingOnTeamCity -> "TeamCity" | ||
buildingOnGitHub -> "GitHub" | ||
buildingOnCi -> "CI" | ||
!overriddenName.isNullOrBlank() && overriddenName != DEFAULT_KOTLIN_COMPILER_SERVER_USER_NAME -> overriddenName | ||
overriddenName == DEFAULT_KOTLIN_COMPILER_SERVER_USER_NAME -> originalUsername | ||
else -> "unknown" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters