From 67b08c4c51a0b157a6efc1f91334042c0fc22d6c Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Wed, 18 May 2022 12:08:21 -0700 Subject: [PATCH 1/2] Use custom plugin to publish zips to maven Signed-off-by: Martin Gaievski --- build.gradle | 24 ++++++++++++++++++++++++ scripts/build.sh | 1 + settings.gradle | 2 ++ 3 files changed, 27 insertions(+) diff --git a/build.gradle b/build.gradle index d668d2eff..8449e0355 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,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") @@ -80,6 +81,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/opensearch-plugin-template-java" + } + } + } + } + } +} + compileJava { options.compilerArgs.addAll(["-processor", 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor']) } diff --git a/scripts/build.sh b/scripts/build.sh index e495461a2..91d9fb226 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) diff --git a/settings.gradle b/settings.gradle index 483465c89..3b7707ab5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,3 +8,5 @@ rootProject.name = 'opensearch-knn' include ":qa" include ":qa:rolling-upgrade" include ":qa:restart-upgrade" + +startParameter.excludedTaskNames=["publishPluginZipPublicationToMavenLocal"] From 9c766f3a1a88b20db7d32a6f26a280d34438f2f0 Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Wed, 18 May 2022 13:06:38 -0700 Subject: [PATCH 2/2] Address review comments: add cp to build.sh, remove excluded tasks, update dev url Signed-off-by: Martin Gaievski --- build.gradle | 2 +- scripts/build.sh | 3 +++ settings.gradle | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 8449e0355..b7d3a8875 100644 --- a/build.gradle +++ b/build.gradle @@ -96,7 +96,7 @@ publishing { developers { developer { name = "OpenSearch" - url = "https://github.com/opensearch-project/opensearch-plugin-template-java" + url = "https://github.com/opensearch-project/k-NN" } } } diff --git a/scripts/build.sh b/scripts/build.sh index 91d9fb226..2ff2bc2b6 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -119,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 3b7707ab5..9056e382e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,4 +9,3 @@ include ":qa" include ":qa:rolling-upgrade" include ":qa:restart-upgrade" -startParameter.excludedTaskNames=["publishPluginZipPublicationToMavenLocal"]