Skip to content

Commit

Permalink
chore: move to develocity from Gradle enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshg committed Apr 4, 2024
1 parent 4e5cb4c commit c25cf82
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 40 deletions.
12 changes: 6 additions & 6 deletions gradle/build-logic/common-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ gradlePlugin {
plugins {

// Re-exposure of plugin from dependency. Gradle doesn't expose the plugin itself.
create("com.gradle.enterprise") {
id = "com.gradle.enterprise"
implementationClass = "com.gradle.enterprise.gradleplugin.GradleEnterprisePlugin"
displayName = "Gradle Enterprise"
description = "Gradle enterprise settings plugin re-exposed from dependency"
create("com.gradle.develocity") {
id = "com.gradle.develocity"
implementationClass = "com.gradle.develocity.agent.gradle.DevelocityPlugin"
displayName = "Develocity Gradle Plugin"
description = "Develocity gradle settings plugin re-exposed from dependency"
}

// A generic plugin for both project and settings
Expand Down Expand Up @@ -93,7 +93,7 @@ dependencies {
implementation(libs.build.kotlinx.kover)
implementation(libs.build.dokka)
implementation(libs.build.ksp.redacted)
implementation(libs.build.gradle.enterprise)
implementation(libs.build.gradle.develocity)
implementation(libs.build.nexus.plugin)
implementation(libs.build.spotless.plugin)
implementation(libs.build.shadow.plugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class GenericSettingsPlugin : Plugin<Settings> {
gradle.beforeProject { pluginManager.apply(GenericProjectPlugin::class) }

// Configure an extension when a plugin is applied.
plugins.withId("com.gradle.enterprise") {}
plugins.withId("com.gradle.develocity") {}

// OR pluginManager.withPlugin("com.gradle.enterprise") {}
// OR pluginManager.withPlugin("com.gradle.develocity") {}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package settings

import GithubAction
import com.gradle.scan.plugin.PublishedBuildScan
import com.gradle.develocity.agent.gradle.scan.PublishedBuildScan
import org.gradle.kotlin.dsl.*
import org.gradle.toolchains.foojay.FoojayToolchainResolver

Expand All @@ -25,7 +25,7 @@ pluginManagement {
// Apply the plugins to all projects
plugins {
// Gradle build scan
id("com.gradle.enterprise")
id("com.gradle.develocity")
// Toolchains resolver using the Foojay Disco API.
id("org.gradle.toolchains.foojay-resolver")
// Use semver on all projects
Expand All @@ -46,20 +46,6 @@ dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
}

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
capture.isTaskInputFiles = true
if (GithubAction.isEnabled) {
publishAlways()
isUploadInBackground = false
tag("GITHUB_ACTION")
buildScanPublished { addJobSummary() }
}
}
}

@Suppress("UnstableApiUsage")
toolchainManagement {
jvm {
Expand All @@ -69,6 +55,29 @@ toolchainManagement {
}
}

develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/terms-of-service"
termsOfUseAgree = "yes"

capture {
buildLogging = false
testLogging = false
}

obfuscation {
ipAddresses { it.map { _ -> "0.0.0.0" } }
hostname { "*******" }
username { name -> name.reversed() }
}

publishing.onlyIf { GithubAction.isEnabled }
uploadInBackground = false
tag("GITHUB_ACTION")
buildScanPublished { addJobSummary() }
}
}

/** Add build scan details to GitHub Job summary report! */
fun PublishedBuildScan.addJobSummary() =
with(GithubAction) {
Expand Down
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ grpc-kotlin = "1.4.1"
http-common = "0.10.0"
helidon-nima = "4.0.0-ALPHA6"
imageio-twelvemonkeys = "3.10.1"
invokebinder = "1.13"
invokebinder = "1.14"
jakewharton-picnic = "0.6.0"
jakewharton-crossword = "0.3.0"
jackson-databind = "2.17.0"
javaagent-allocation = "3.3.4"
jetbrains-markdown = "0.6.1"
jetty = "12.0.7"
jetty = "12.0.8"
jetty-jakarta-servlet = "5.0.2"
jgit = "6.9.0.202403050737-r"
jgitver = "0.10.0-rc03"
Expand Down Expand Up @@ -149,17 +149,17 @@ foojay-resolver = "0.8.0"
idea-ext = "1.1.7"
gradle-checksum = "1.4.0"
google-jib = "3.4.2"
google-javaformat = "1.19.2"
google-javaformat = "1.22.0"
graalvm-nativeimage = "0.10.1"
gradle-enterprise = "3.16.2"
gradle-develocity = "3.17"
gradlex-javamoduleinfo = "1.8"
gradlex-buildparameters = "1.0"
git-properties = "2.4.1"
jetbrains-exposed = "0.2.1"
jetbrains-qodana = "2023.3.2"
javaagent-application = "0.5.1"
jextract = "0.4.2"
ktfmt = "0.46"
jextract = "0.5.0"
ktfmt = "0.47"
ktlint = "0.48.2"
licensee = "1.11.0"
licenser = "0.6.1"
Expand All @@ -177,7 +177,7 @@ taskinfo = "2.2.0"
versioncatalog-update = "0.8.4"
dependency-analysis = "1.30.0"
best-practices-plugin = "0.10"
modulegraph = "0.5.0"
modulegraph = "0.6.0"

# Composite build versions
module-jdk = "1.0.0"
Expand All @@ -195,7 +195,7 @@ build-kotlin-ksp = { module = "com.google.devtools.ksp:symbol-pro
build-ksp-redacted = { module = "dev.zacsweers.redacted:redacted-compiler-plugin-gradle" , version.ref = "ksp-redacted"}
build-benmanesversions = { module = "com.github.ben-manes:gradle-versions-plugin" , version.ref = "benmanes"}
build-gradlex-buildparameters = { module = "org.gradlex:build-parameters" , version.ref = "gradlex-buildparameters"}
build-gradle-enterprise = { module = "com.gradle.enterprise:com.gradle.enterprise.gradle.plugin" , version.ref = "gradle-enterprise" }
build-gradle-develocity = { module = "com.gradle:develocity-gradle-plugin" , version.ref = "gradle-develocity" }
build-jte-plugin = { module = "gg.jte:jte-gradle-plugin" , version.ref = "jte"}
build-nexus-plugin = { module = "io.github.gradle-nexus:publish-plugin" , version.ref = "nexus-publish"}
build-spotless-plugin = { module = "com.diffplug.spotless:spotless-plugin-gradle" , version.ref = "spotless"}
Expand Down
8 changes: 4 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ pluginManagement {
google()
}

// val gradleEnterprise: String by settings
// val develocityPlugin: String by settings
// OR
// val gradleEnterprise =
// val develocityPlugin =
// file("$rootDir/gradle/libs.versions.toml")
// .readLines()
// .first { it.contains("gradle-enterprise") }
// .first { it.contains("develocity-plugin") }
// .split("\"")[1]

// https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management
// plugins {
// id("com.gradle.enterprise") version gradleEnterprise
// id("com.gradle.develocity") version develocityPlugin
// val kotlinVersion = extra["kotlin.version"] as String
// kotlin("jvm") version kotlinVersion
// }
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dev/suresh/generics/Director.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public String toString() {
Director {
name='%s'
}
""".formatted(getName());
"""
.formatted(getName());
}
}
3 changes: 2 additions & 1 deletion src/main/java/dev/suresh/generics/Employee.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public String toString() {
Employee {
name='%s'
}
""".formatted(name);
"""
.formatted(name);
}
}
3 changes: 2 additions & 1 deletion src/main/java/dev/suresh/generics/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public String toString() {
Manager {
name='%s'
}
""".formatted(getName());
"""
.formatted(getName());
}
}
3 changes: 2 additions & 1 deletion src/main/java/dev/suresh/npe/HelpfulNPE.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public static void run() {
} catch (NullPointerException npe) {
System.out.println(STR."Helpful NPE: \{npe.getMessage()}");
assert npe.getMessage()
.equals("""
.equals(
"""
Cannot read field "name" because "address.country" is null""");
}
}
Expand Down

0 comments on commit c25cf82

Please sign in to comment.