Skip to content

Commit

Permalink
Extract version into gradle.properties.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 29, 2022
1 parent a1c6085 commit 27fa75b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
45 changes: 2 additions & 43 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

allprojects {
group = "org.opensearch.client"

// Release manager provides a $VERSION. If not present, it's a local or CI snapshot build.
version = System.getenv("VERSION") ?:
(File(project.rootDir, "config/version.txt").readText().trim() + "-SNAPSHOT")
version = System.getenv("VERSION") ?: System.getProperty("version") + "-SNAPSHOT"

repositories {
mavenLocal()
Expand Down Expand Up @@ -67,44 +67,3 @@ tasks.register<Task>(name = "resolveDependencies") {
}
}
}

tasks.register<Task>(name = "publishForReleaseManager") {
group = "Publishing"
description = "Publishes artifacts in a format suitable for the release manager"
dependsOn(
":java-client:publishAllPublicationsToBuildRepository",
":java-client:generateLicenseReport"
)
doLast {
val version = this.project.version.toString()
val isSnapshot = version.endsWith("SNAPSHOT")

println("Releasing version $version")

val releaseDir = File(rootProject.buildDir, "release")
releaseDir.mkdirs()

File(rootProject.buildDir, "repository/org/opensearch/client").listFiles()?.forEach { artifact ->
println("Releasing artifact " + artifact.name)

val versionDir = File(artifact, version)
var gotPom = false;

versionDir.listFiles()?.forEach { file ->
if (file.name.endsWith(".jar") || file.name.endsWith(".pom")) {
var name = file.name

if (isSnapshot) {
if (file.name.endsWith(".pom")) {
if (gotPom) throw GradleException("Multiple snapshots found in " + file.parentFile)
gotPom = true
}
name = name.replace(Regex("-\\d{8}\\.\\d{6}-\\d+"), "-SNAPSHOT")
}

file.copyTo(File(releaseDir, name), overwrite = true)
}
}
}
}
}
1 change: 0 additions & 1 deletion config/version.txt

This file was deleted.

1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
systemProp.version = 2.1.0

0 comments on commit 27fa75b

Please sign in to comment.