Add settings convention for Gradle enterprise
This commit is contained in:
committed by
Space Team
parent
b7f50aeaf2
commit
920f76b9ef
@@ -135,8 +135,7 @@ dependencies {
|
||||
|
||||
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.0.1")
|
||||
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.5.1")
|
||||
compileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.11.2")
|
||||
compileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.12.3")
|
||||
|
||||
compileOnly(gradleApi())
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
id "build-cache"
|
||||
id "gradle-enterprise"
|
||||
}
|
||||
|
||||
File versionPropertiesFile = new File(rootProject.projectDir.parentFile, "gradle/versions.properties")
|
||||
|
||||
@@ -281,9 +281,7 @@ fun Project.configureTests() {
|
||||
// Aggregate task for build related checks
|
||||
tasks.register("checkBuild")
|
||||
|
||||
afterEvaluate {
|
||||
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
|
||||
}
|
||||
configureTestRetriesForTestTasks()
|
||||
}
|
||||
|
||||
// TODO: migrate remaining modules to the new JVM default scheme.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import com.gradle.enterprise.gradleplugin.testretry.retry
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
fun Project.configureTestRetriesForTestTasks() {
|
||||
val testRetryMaxRetries = findProperty("kotlin.build.testRetry.maxRetries")
|
||||
?.toString()?.toInt()
|
||||
?: (if (kotlinBuildProperties.isTeamcityBuild) 3 else 0)
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
retry {
|
||||
maxRetries.set(testRetryMaxRetries)
|
||||
maxFailures.set(20)
|
||||
failOnPassedAfterRetry.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
apply(plugin = "org.gradle.test-retry")
|
||||
|
||||
val testRetryMaxRetries = findProperty("kotlin.build.testRetry.maxRetries")?.toString()?.toInt() ?:
|
||||
(if (kotlinBuildProperties.isTeamcityBuild) 3 else 0)
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
configure<org.gradle.testretry.TestRetryTaskExtension> {
|
||||
maxRetries.set(testRetryMaxRetries)
|
||||
maxFailures.set(20)
|
||||
failOnPassedAfterRetry.set(false)
|
||||
}
|
||||
}
|
||||
@@ -2203,16 +2203,16 @@
|
||||
<sha256 value="7846399b35c7cd642a9b3a000c3e2d62d04eb37a4547b6933cc8b18bcc2f086b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.gradle" name="common-custom-user-data-gradle-plugin" version="1.8.1">
|
||||
<artifact name="common-custom-user-data-gradle-plugin-1.8.1.jar">
|
||||
<md5 value="0a9834218dc7c9d5a221154ad76f8e96" origin="Generated by Gradle"/>
|
||||
<sha256 value="8fa1cc8d25f131eaf4f561c90971a2d9ea49cf2911d0616fc0fd97e756fc6798" origin="Generated by Gradle"/>
|
||||
<component group="com.gradle" name="common-custom-user-data-gradle-plugin" version="1.8.2">
|
||||
<artifact name="common-custom-user-data-gradle-plugin-1.8.2.jar">
|
||||
<md5 value="a0a560ef54962f2b3b7f9f9fd0b4986b" origin="Generated by Gradle"/>
|
||||
<sha256 value="1e803f2a84a44f15c18aee693cdbabb230b93e0a87bcdf2c99d1be959c400567" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.11.2">
|
||||
<artifact name="gradle-enterprise-gradle-plugin-3.11.2.jar">
|
||||
<md5 value="b8f7d5a851960c8827547d6368cafeba" origin="Generated by Gradle"/>
|
||||
<sha256 value="efec489c7721670b827fdfd5c26eb1f43561911f7d99d35c2bb0b9a74578e119" origin="Generated by Gradle"/>
|
||||
<component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.12.3">
|
||||
<artifact name="gradle-enterprise-gradle-plugin-3.12.3.jar">
|
||||
<md5 value="f5c90702e7bfaf15d347875e4fd796a7" origin="Generated by Gradle"/>
|
||||
<sha256 value="2a71b48d8de588ccd029a8f90ff8e8e622a7becf9446bf06d9353ed2fa10a40f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.gradle.publish" name="plugin-publish-plugin" version="1.0.0">
|
||||
@@ -6536,12 +6536,6 @@
|
||||
<sha256 value="d51048567b64e1be4bba6f66260b28b67e2d044dd161164489dcc894d783d3fe" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.gradle" name="test-retry-gradle-plugin" version="1.5.1">
|
||||
<artifact name="test-retry-gradle-plugin-1.5.1.jar">
|
||||
<md5 value="8f60d55940af5c44f9f6fba24ec77e3f" origin="Generated by Gradle"/>
|
||||
<sha256 value="839689074535c61187f5724629aa45b77f5675a6544de04af6a9cd98155ad8c5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.gradle.kotlin" name="gradle-kotlin-dsl-plugins" version="2.1.7">
|
||||
<artifact name="gradle-kotlin-dsl-plugins-2.1.7.jar">
|
||||
<md5 value="b8c2f81d00941a5ac0f8bcf867ac3c74" origin="Generated by Gradle"/>
|
||||
|
||||
@@ -4,4 +4,5 @@ Provides common settings convention plugins for the repo.
|
||||
|
||||
### List of plugins
|
||||
|
||||
- "build-cache" - local and remote build cache configuration
|
||||
- "build-cache" - local and remote build cache configuration
|
||||
- "gradle-enterprise" - configures build scans upload
|
||||
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
kotlin.jvmToolchain(8)
|
||||
|
||||
val buildGradlePluginVersion = extra.get("kotlin.build.gradlePlugin.version")
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:$buildGradlePluginVersion")
|
||||
implementation("com.gradle:gradle-enterprise-gradle-plugin:3.12.3")
|
||||
implementation("com.gradle:common-custom-user-data-gradle-plugin:1.8.2")
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
plugins {
|
||||
id("com.gradle.enterprise")
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") apply false
|
||||
}
|
||||
|
||||
val buildProperties = getKotlinBuildPropertiesForSettings(settings)
|
||||
|
||||
val buildScanServer = buildProperties.buildScanServer
|
||||
val isTeamCity = buildProperties.isTeamcityBuild
|
||||
|
||||
if (buildProperties.buildScanServer != null) {
|
||||
plugins.apply("com.gradle.common-custom-user-data-gradle-plugin")
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
if (buildScanServer != null) {
|
||||
server = buildScanServer
|
||||
publishAlways()
|
||||
|
||||
capture {
|
||||
isTaskInputFiles = true
|
||||
isBuildLogging = true
|
||||
isBuildLogging = true
|
||||
isUploadInBackground = true
|
||||
}
|
||||
} else {
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
}
|
||||
|
||||
val username = if (isTeamCity) "TeamCity" else "concealed"
|
||||
obfuscation {
|
||||
ipAddresses { _ -> listOf("0.0.0.0") }
|
||||
hostname { _ -> "concealed" }
|
||||
username { _ -> username }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ buildscript {
|
||||
}
|
||||
|
||||
include(":build-cache")
|
||||
include(":gradle-enterprise")
|
||||
|
||||
// Unfortunately it is not possible to apply build-cache.settings.gradle.kts as script compilation
|
||||
// could not then find types from "kotlin-build-gradle-plugin"
|
||||
|
||||
+1
-28
@@ -16,40 +16,13 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.11.2"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.8.1" apply false
|
||||
id "org.gradle.toolchains.foojay-resolver-convention" version "0.4.0"
|
||||
id "build-cache"
|
||||
id "gradle-enterprise"
|
||||
}
|
||||
|
||||
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||
|
||||
if (buildProperties.buildScanServer != null) {
|
||||
apply plugin: com.gradle.CommonCustomUserDataGradlePlugin
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
def buildScanServer = buildProperties.buildScanServer
|
||||
def isTeamCity = buildProperties.isTeamcityBuild
|
||||
|
||||
buildScan {
|
||||
if (buildScanServer != null) {
|
||||
server = buildScanServer
|
||||
captureTaskInputFiles = true
|
||||
publishAlways()
|
||||
} else {
|
||||
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||
setTermsOfServiceAgree("yes")
|
||||
}
|
||||
|
||||
obfuscation {
|
||||
ipAddresses { addresses -> ["0.0.0.0"] }
|
||||
hostname { host -> "concealed" }
|
||||
username { name -> isTeamCity ? "TeamCity" : "concealed" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// modules
|
||||
include ":benchmarks",
|
||||
":compiler",
|
||||
|
||||
Reference in New Issue
Block a user