From c27a05aa4e579e488984b2acd072dec079b5bb5e Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 23 Jan 2024 09:34:26 -0500 Subject: [PATCH] Enable local maven build, e.g. ./gradlew build -Dopensearch.version=3.0.0 -Dbuild.snapshot=false. Signed-off-by: dblock --- build.gradle | 65 ++++++++++--------- repositories.gradle | 11 ++++ .../resources/rest-api-spec/test/20_api.yml | 2 +- 3 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 repositories.gradle diff --git a/build.gradle b/build.gradle index f7b6d9c..b44d492 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,40 @@ def projectPath = 'org.opensearch' def pathToPlugin = 'plugin.api' def pluginClassName = 'APIPlugin' -group = "org.dblock" +buildscript { + ext { + opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT") + isSnapshot = "true" == System.getProperty("build.snapshot", "true") + } + + apply from: 'repositories.gradle' + + repositories { + mavenLocal() + maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } + } + + dependencies { + classpath "org.opensearch.gradle:build-tools:${opensearch_version}" + } +} + +allprojects { + group = "org.dblock" + + version = opensearch_version - "-SNAPSHOT" + ".0" + + if (isSnapshot) { + version += "-SNAPSHOT" + } + + plugins.withId('java') { + targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_11 + } +} tasks.register("preparePluginPathDirs") { mustRunAfter clean @@ -65,36 +98,6 @@ validateNebulaPom.enabled = false // Don't care about documentation javadoc.enabled = false -buildscript { - ext { - opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT") - isSnapshot = "true" == System.getProperty("build.snapshot", "true") - } - - repositories { - mavenLocal() - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - } - - dependencies { - classpath "org.opensearch.gradle:build-tools:${opensearch_version}" - } -} - -version = opensearch_version - "-SNAPSHOT" + ".0" -if (isSnapshot) { - version += "-SNAPSHOT" -} - -repositories { - mavenLocal() - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } -} - test { include '**/*Tests.class' } diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000..0ce55ee --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,11 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +repositories { + mavenLocal() + maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } +} \ No newline at end of file diff --git a/src/yamlRestTest/resources/rest-api-spec/test/20_api.yml b/src/yamlRestTest/resources/rest-api-spec/test/20_api.yml index b63c794..a943d92 100644 --- a/src/yamlRestTest/resources/rest-api-spec/test/20_api.yml +++ b/src/yamlRestTest/resources/rest-api-spec/test/20_api.yml @@ -3,7 +3,7 @@ api: {} - match: { info.title: "opensearch" } - - match: { info.version: /.*-SNAPSHOT/ } + - match: { info.version: /\d*\.\d*\.\d*.*/ } - match: { info.description: "The OpenSearch Project: https://opensearch.org/" } - match: { paths./_plugins/api.get: {} }