From 27fa75b7a548eec43d70059966f345c2d6b1904a Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 29 Jul 2022 11:28:29 -0400 Subject: [PATCH] Extract version into gradle.properties. Signed-off-by: dblock --- build.gradle.kts | 45 ++------------------------------------------- config/version.txt | 1 - gradle.properties | 1 + 3 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 config/version.txt create mode 100644 gradle.properties diff --git a/build.gradle.kts b/build.gradle.kts index f016494b29..df7f0dc13b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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() @@ -67,44 +67,3 @@ tasks.register(name = "resolveDependencies") { } } } - -tasks.register(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) - } - } - } - } -} diff --git a/config/version.txt b/config/version.txt deleted file mode 100644 index 7ec1d6db40..0000000000 --- a/config/version.txt +++ /dev/null @@ -1 +0,0 @@ -2.1.0 diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..aac6d37671 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +systemProp.version = 2.1.0 \ No newline at end of file