Skip to content

Commit

Permalink
Replace usage of Project.extra for PublishingHelperPlugin + expli…
Browse files Browse the repository at this point in the history
…citly disable Gradle config cache (#8942)
  • Loading branch information
snazy authored Jun 26, 2024
1 parent 725bdf2 commit ccf42ab
Show file tree
Hide file tree
Showing 96 changed files with 120 additions and 124 deletions.
2 changes: 1 addition & 1 deletion api/client-testextension/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - JUnit Jupiter Test Extension for Client-Side Tests"
publishingHelper { mavenName = "Nessie - JUnit Jupiter Test Extension for Client-Side Tests" }

dependencies {
api(platform(libs.junit.bom))
Expand Down
2 changes: 1 addition & 1 deletion api/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
alias(libs.plugins.annotations.stripper)
}

extra["maven.name"] = "Nessie - Client"
publishingHelper { mavenName = "Nessie - Client" }

dependencies {
api(project(":nessie-model"))
Expand Down
2 changes: 1 addition & 1 deletion api/model-quarkus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
alias(libs.plugins.smallrye.openapi)
}

extra["maven.name"] = "Nessie - Model - Variant only for Java 11+ consumers"
publishingHelper { mavenName = "Nessie - Model - Variant only for Java 11+ consumers" }

description =
"nessie-model-jakarta is effectively the same as nessie-model, but it is _not_ a " +
Expand Down
2 changes: 2 additions & 0 deletions api/model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ plugins {
alias(libs.plugins.smallrye.openapi)
}

publishingHelper { mavenName = "Nessie - Model" }

dependencies {
implementation(platform(libs.jackson.bom))
implementation("com.fasterxml.jackson.core:jackson-databind")
Expand Down
2 changes: 1 addition & 1 deletion bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {
id("nessie-common-base")
}

extra["maven.name"] = "Nessie - Bill of Materials (BOM)"
publishingHelper { mavenName = "Nessie - Bill of Materials (BOM)" }

dependencies {
constraints {
Expand Down
20 changes: 11 additions & 9 deletions build-logic/src/main/kotlin/PublishingHelperPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.tasks.GenerateModuleMetadata
import org.gradle.api.tasks.PathSensitivity
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
Expand Down Expand Up @@ -83,12 +82,10 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl

pom {
name.set(
project.provider {
if (project.extra.has("maven.name")) {
project.extra["maven.name"].toString()
} else {
project.name
}
if (e.mavenName.isPresent) {
e.mavenName.get()
} else {
project.name
}
)
description.set(project.description)
Expand Down Expand Up @@ -147,7 +144,9 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
url.set("https://github.com/projectnessie/$nessieRepoName/issues")
}
developers {
file(rootProject.file("gradle/developers.csv"))
rootProject.layout.projectDirectory
.file("gradle/developers.csv")
.asFile
.readLines()
.map { line -> line.trim() }
.filter { line -> line.isNotEmpty() && !line.startsWith("#") }
Expand All @@ -166,7 +165,9 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
}
}
contributors {
file(rootProject.file("gradle/contributors.csv"))
rootProject.layout.projectDirectory
.file("gradle/contributors.csv")
.asFile
.readLines()
.map { line -> line.trim() }
.filter { line -> line.isNotEmpty() && !line.startsWith("#") }
Expand Down Expand Up @@ -359,6 +360,7 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
}

abstract class PublishingHelperExtension {
abstract val mavenName: Property<String>
abstract val nessieRepoName: Property<String>
abstract val inceptionYear: Property<String>
}
6 changes: 0 additions & 6 deletions build-logic/src/main/kotlin/Utilities.kt
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,3 @@ class ReplaceInFiles(val files: FileTree, val replacements: Map<String, String>)
}
}
}

class WriteFile(val file: File, val text: String) : Action<Task> {
override fun execute(task: Task) {
file.writeText(text)
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

apply<ReleaseSupportPlugin>()

extra["maven.name"] = "Nessie"
publishingHelper { mavenName = "Nessie" }

description = "Transactional Catalog for Data Lakes"

Expand Down
2 changes: 1 addition & 1 deletion catalog/files/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Catalog - Files API"
publishingHelper { mavenName = "Nessie - Catalog - Files API" }

dependencies {
api(project(":nessie-storage-uri"))
Expand Down
2 changes: 1 addition & 1 deletion catalog/files/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
alias(libs.plugins.jmh)
}

extra["maven.name"] = "Nessie - Catalog - Object I/O"
publishingHelper { mavenName = "Nessie - Catalog - Object I/O" }

dependencies {
implementation(project(":nessie-catalog-model"))
Expand Down
2 changes: 1 addition & 1 deletion catalog/model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
alias(libs.plugins.annotations.stripper)
}

extra["maven.name"] = "Nessie - Catalog - Schema Model"
publishingHelper { mavenName = "Nessie - Catalog - Schema Model" }

description = "Nessie Catalog Schema Model classes"

Expand Down
2 changes: 1 addition & 1 deletion catalog/secrets/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Catalog - Secrets API"
publishingHelper { mavenName = "Nessie - Catalog - Secrets API" }

dependencies {
implementation(libs.guava)
Expand Down
2 changes: 1 addition & 1 deletion catalog/service/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Catalog - Service Common"
publishingHelper { mavenName = "Nessie - Catalog - Service Common" }

dependencies {
implementation(project(":nessie-model"))
Expand Down
2 changes: 1 addition & 1 deletion catalog/service/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Catalog - Service Implementation"
publishingHelper { mavenName = "Nessie - Catalog - Service Implementation" }

dependencies {
implementation(project(":nessie-catalog-files-api"))
Expand Down
2 changes: 1 addition & 1 deletion catalog/service/rest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
alias(libs.plugins.annotations.stripper)
}

extra["maven.name"] = "Nessie - Catalog - REST Service"
publishingHelper { mavenName = "Nessie - Catalog - REST Service" }

description = "Nessie Catalog service implementation providing REST endpoints."

Expand Down
2 changes: 1 addition & 1 deletion cli/cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
id("nessie-license-report")
}

extra["maven.name"] = "Nessie - CLI"
publishingHelper { mavenName = "Nessie - CLI" }

configurations.all { exclude(group = "org.projectnessie.nessie", module = "nessie-model") }

Expand Down
26 changes: 12 additions & 14 deletions cli/grammar/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ val genNessieGrammarDir = project.layout.buildDirectory.dir("generated/sources/c
val genJsonGrammarDir = project.layout.buildDirectory.dir("generated/sources/congocc/json")
val genNessieSyntaxDir = project.layout.buildDirectory.dir("generated/resources/nessie-syntax")

val generateNessieCcc =
tasks.register("generateNessieCcc", Generate::class.java) {
val generateNessieCcc by
tasks.registering(Generate::class) {
sourceDir = projectDir.resolve("src/main/congocc/nessie")
val sourceFile =
sourceDir.get().file("nessie-cli-java.ccc").asFile.relativeTo(projectDir).toString()
outputDir = genNessieGrammarDir

classpath(congocc)
Expand All @@ -74,23 +76,18 @@ val generateNessieCcc =

mainClass = "org.congocc.app.Main"
workingDir(projectDir)

argumentProviders.add(
CommandLineArgumentProvider {
val base =
listOf(
"-d",
genNessieGrammarDir.get().asFile.toString(),
"-jdk17",
"-n",
sourceDir.get().file("nessie-cli-java.ccc").asFile.relativeTo(projectDir).toString()
)
listOf("-d", genNessieGrammarDir.get().asFile.toString(), "-jdk17", "-n", sourceFile)
if (logger.isInfoEnabled) base else (base + listOf("-q"))
}
)
}

val generateJsonCcc =
tasks.register("generateJsonCcc", Generate::class.java) {
val generateJsonCcc by
tasks.registering(Generate::class) {
sourceDir = projectDir.resolve("src/main/congocc/json")
outputDir = genJsonGrammarDir

Expand All @@ -100,6 +97,7 @@ val generateJsonCcc =

mainClass = "org.congocc.app.Main"
workingDir(projectDir)

argumentProviders.add(
CommandLineArgumentProvider {
val base =
Expand All @@ -117,16 +115,16 @@ val generateJsonCcc =

val compileJava = tasks.named("compileJava") { dependsOn(generateNessieCcc, generateJsonCcc) }

val generateNessieSyntax =
tasks.register("generateNessieSyntax", Generate::class.java) {
val generateNessieSyntax by
tasks.registering(Generate::class) {
dependsOn(compileJava)

sourceDir = projectDir.resolve("src/main/congocc/nessie")
outputDir = genNessieSyntaxDir

classpath(syntaxGen, configurations.runtimeClasspath, compileJava)

doFirst { delete(genNessieSyntaxDir) }
doFirst { delete(genNessieGrammarDir) }

mainClass = "org.projectnessie.nessie.cli.syntax.SyntaxTool"
workingDir(projectDir)
Expand Down
2 changes: 1 addition & 1 deletion compatibility/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Backward Compatibility - Common"
publishingHelper { mavenName = "Nessie - Backward Compatibility - Common" }

dependencies {
api(project(":nessie-client"))
Expand Down
2 changes: 1 addition & 1 deletion compatibility/compatibility-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.apache.tools.ant.taskdefs.condition.Os

plugins { id("nessie-conventions-server") }

extra["maven.name"] = "Nessie - Backward Compatibility - Tests"
publishingHelper { mavenName = "Nessie - Backward Compatibility - Tests" }

dependencies {
implementation(platform(libs.junit.bom))
Expand Down
2 changes: 1 addition & 1 deletion compatibility/jersey/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

plugins { id("nessie-conventions-server") }

extra["maven.name"] = "Nessie - Backward Compatibility - Jersey"
publishingHelper { mavenName = "Nessie - Backward Compatibility - Jersey" }

dependencies {
implementation(project(":nessie-model"))
Expand Down
2 changes: 1 addition & 1 deletion events/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Events - API"
publishingHelper { mavenName = "Nessie - Events - API" }

dependencies {

Expand Down
2 changes: 1 addition & 1 deletion events/quarkus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Events - Quarkus"
publishingHelper { mavenName = "Nessie - Events - Quarkus" }

dependencies {
implementation(project(":nessie-versioned-spi"))
Expand Down
2 changes: 1 addition & 1 deletion events/service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Events - Service"
publishingHelper { mavenName = "Nessie - Events - Service" }

dependencies {
implementation(project(":nessie-model"))
Expand Down
2 changes: 1 addition & 1 deletion events/spi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - Events - SPI"
publishingHelper { mavenName = "Nessie - Events - SPI" }

dependencies {
implementation(project(":nessie-events-api"))
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-base-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

plugins { id("nessie-conventions-iceberg") }

extra["maven.name"] = "Nessie - GC - Base Implementation Tests"
publishingHelper { mavenName = "Nessie - GC - Base Implementation Tests" }

dependencies {
implementation(nessieProject("nessie-model"))
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - GC - Base Implementation"
publishingHelper { mavenName = "Nessie - GC - Base Implementation" }

description =
"Mark and sweep GC base functionality to identify live contents, map to live files, list existing files and to purge orphan files."
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-iceberg-files/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - GC - Iceberg FileIO connector"
publishingHelper { mavenName = "Nessie - GC - Iceberg FileIO connector" }

description =
"Nessie GC integration tests with Spark, Iceberg and S3 as a separate project " +
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-iceberg-inttest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
alias(libs.plugins.nessie.run)
}

extra["maven.name"] = "Nessie - GC - Integration tests"
publishingHelper { mavenName = "Nessie - GC - Integration tests" }

val sparkScala = useSparkScalaVersionsForProject("3.5", "2.12")

Expand Down
2 changes: 1 addition & 1 deletion gc/gc-iceberg-mock/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

plugins { id("nessie-conventions-iceberg") }

extra["maven.name"] = "Nessie - GC - Mocked Iceberg data for tests"
publishingHelper { mavenName = "Nessie - GC - Mocked Iceberg data for tests" }

dependencies {
compileOnly(platform(libs.iceberg.bom))
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-iceberg/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - GC - Iceberg content functionality"
publishingHelper { mavenName = "Nessie - GC - Iceberg content functionality" }

dependencies {
implementation(platform(libs.iceberg.bom))
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-repository-jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
id("nessie-jacoco")
}

extra["maven.name"] = "Nessie - GC - JDBC live-contents-set persistence"
publishingHelper { mavenName = "Nessie - GC - JDBC live-contents-set persistence" }

dependencies {
compileOnly(libs.errorprone.annotations)
Expand Down
2 changes: 1 addition & 1 deletion gc/gc-tool-inttest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
alias(libs.plugins.nessie.run)
}

extra["maven.name"] = "Nessie - GC - CLI integration test"
publishingHelper { mavenName = "Nessie - GC - CLI integration test" }

val sparkScala = useSparkScalaVersionsForProject("3.4", "2.12")

Expand Down
Loading

0 comments on commit ccf42ab

Please sign in to comment.