Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protovalidate module to v0.4.4 #52

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone

plugins {
`version-catalog`

`java-library`
alias(libs.plugins.errorprone)
alias(libs.plugins.git)
alias(libs.plugins.maven)
}

Expand All @@ -18,6 +17,20 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

// The releaseVersion property is set on official releases in the release.yml workflow.
// If not specified, we attempt to calculate a snapshot version based on the last tagged release.
// So if the local build's last tag was v0.1.9, this will set snapshotVersion to 0.1.10-SNAPSHOT.
// If this fails for any reason, we'll fall back to using 0.0.0-SNAPSHOT version.
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val details = versionDetails()
var snapshotVersion = "0.0.0-SNAPSHOT"
val matchResult = """^v(\d+)\.(\d+)\.(\d+)$""".toRegex().matchEntire(details.lastTag)
if (matchResult != null) {
val (major, minor, patch) = matchResult.destructured
snapshotVersion = "$major.$minor.${patch.toInt() + 1}-SNAPSHOT"
}
val releaseVersion = project.findProperty("releaseVersion") as String? ?: snapshotVersion

val bufCLIFile = project.layout.buildDirectory.file("gobin/buf").get().asFile
val bufCLIPath: String = bufCLIFile.absolutePath
val bufLicenseHeaderCLIFile = project.layout.buildDirectory.file("gobin/license-header").get().asFile
Expand Down Expand Up @@ -176,6 +189,7 @@ configure<SpotlessExtension> {
}

allprojects {
version = releaseVersion
repositories {
mavenCentral()
maven {
Expand All @@ -194,6 +208,13 @@ allprojects {
trimTrailingWhitespace()
}
}
tasks.withType<Jar>().configureEach {
if (name == "jar") {
manifest {
attributes("Implementation-Version" to releaseVersion)
}
}
}
}

mavenPublishing {
Expand All @@ -202,8 +223,7 @@ mavenPublishing {
if (isAutoReleased) {
signAllPublications()
}
val releaseVersion = project.findProperty("releaseVersion") as String? ?: System.getenv("VERSION")
coordinates("build.buf", "protovalidate", releaseVersion ?: "0.0.0-SNAPSHOT")
coordinates("build.buf", "protovalidate", releaseVersion)
pomFromGradleProperties()
configure(
JavaLibrary(
Expand All @@ -219,8 +239,6 @@ mavenPublishing {
pom {
name.set("protovalidate-java")
group = "build.buf"
// Default to snapshot versioning for local publishing.
version = releaseVersion ?: "0.0.0-SNAPSHOT"
description.set("Protocol Buffer Validation")
url.set("https://github.com/bufbuild/protovalidate-java")
licenses {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# When updating, also update src/test/resources/proto/buf.yaml and re-run 'buf mod update'.
protovalidate.version = v0.4.3
protovalidate.version = v0.4.4

# Arguments to the protovalidate-conformance CLI
protovalidate.conformance.args = --strict_message
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version =

[plugins]
errorprone = { id = "net.ltgt.errorprone", version = "3.1.0" }
git = { id = "com.palantir.git-version", version = "3.0.0" }
maven = { id = "com.vanniktech.maven.publish.base", version = "0.25.3" }
Loading