From 7c7b84edaaec16882295f72240edfe6227d7c3b5 Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Wed, 18 May 2022 15:42:54 -0700 Subject: [PATCH] Use custom plugin to publish zips to maven Signed-off-by: Martin Gaievski --- build.gradle | 28 ++++++++++++++++++++++++++-- scripts/build.sh | 4 ++++ settings.gradle | 1 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index bd7fbe2b6..de0eb9eb7 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ buildscript { ext { // build.version_qualifier parameter applies to knn plugin artifacts only. OpenSearch version must be set // explicitly as 'opensearch.version' property, for instance opensearch.version=2.0.0-rc1-SNAPSHOT - opensearch_version = System.getProperty("opensearch.version", "2.0.0-rc1-SNAPSHOT") - version_qualifier = System.getProperty("build.version_qualifier", "rc1") + opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT") + version_qualifier = System.getProperty("build.version_qualifier", "") opensearch_group = "org.opensearch" } @@ -42,6 +42,7 @@ plugins { apply from: 'gradle/formatting.gradle' apply plugin: 'opensearch.opensearchplugin' apply plugin: 'opensearch.rest-test' +apply plugin: 'opensearch.pluginzip' ext { isSnapshot = "true" == System.getProperty("build.snapshot", "true") @@ -79,6 +80,29 @@ allprojects { } } +publishing { + publications { + pluginZip(MavenPublication) { publication -> + pom { + name = "opensearch-knn" + description = "OpenSearch k-NN plugin" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + name = "OpenSearch" + url = "https://github.com/opensearch-project/k-NN" + } + } + } + } + } +} + def usingRemoteCluster = System.properties.containsKey('tests.rest.cluster') || System.properties.containsKey('tests.cluster') def usingMultiNode = project.properties.containsKey('numNodes') // Only apply jacoco test coverage if we are running a local single node cluster diff --git a/scripts/build.sh b/scripts/build.sh index e495461a2..2ff2bc2b6 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -100,6 +100,7 @@ make opensearchknn_faiss opensearchknn_nmslib cd $work_dir ./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER +./gradlew publishPluginZipPublicationToZipStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER # Add lib to zip zipPath=$(find "$(pwd)" -path \*build/distributions/*.zip) @@ -118,3 +119,6 @@ cd $work_dir echo "COPY ${distributions}/*.zip" mkdir -p $OUTPUT/plugins cp ${distributions}/*.zip $OUTPUT/plugins + +mkdir -p $OUTPUT/maven/org/opensearch +cp -r ./build/local-staging-repo/org/opensearch/. $OUTPUT/maven/org/opensearch diff --git a/settings.gradle b/settings.gradle index 483465c89..9056e382e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,3 +8,4 @@ rootProject.name = 'opensearch-knn' include ":qa" include ":qa:rolling-upgrade" include ":qa:restart-upgrade" +