From 4ac4f4c325adde2eb704968f2bd142b619920dba Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Mon, 3 Jun 2024 01:31:32 +0000 Subject: [PATCH 1/3] enable publishing of alerting-spi jar Signed-off-by: Subhobrata Dey --- .github/workflows/maven-publish.yml | 1 + spi/build.gradle | 76 +++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 31e21d66b..75f22834a 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -38,4 +38,5 @@ jobs: export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) echo "::add-mask::$SONATYPE_USERNAME" echo "::add-mask::$SONATYPE_PASSWORD" + ./gradlew publishShadowPublicationToSnapshotsRepository ./gradlew publishPluginZipPublicationToSnapshotsRepository diff --git a/spi/build.gradle b/spi/build.gradle index 1da8d06e4..c2df62ed9 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -3,14 +3,90 @@ * SPDX-License-Identifier: Apache-2.0 */ +plugins { + id 'java-library' + id 'maven-publish' +} + +apply plugin: 'maven-publish' apply plugin: 'java' apply plugin: 'opensearch.java-rest-test' apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'jacoco' apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'opensearch.repositories' dependencies { compileOnly "org.opensearch:opensearch:${opensearch_version}" compileOnly "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" compileOnly "org.opensearch:common-utils:${common_utils_version}@jar" +} + +shadowJar { + archiveClassifier = null +} + +task sourcesJar(type: Jar) { + archiveClassifier = 'sources' + from sourceSets.main.allJava +} + +task javadocJar(type: Jar) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +publishing { + repositories { + maven { + name = 'staging' + url = "${rootProject.buildDir}/local-staging-repo" + } + maven { + name = "Snapshots" + url = "https://aws.oss.sonatype.org/content/repositories/snapshots" + credentials { + username "$System.env.SONATYPE_USERNAME" + password "$System.env.SONATYPE_PASSWORD" + } + } + } + publications { + shadow(MavenPublication) { + project.shadow.component(it) + groupId = 'org.opensearch.alerting' + artifactId = 'alerting-spi' + + artifact sourcesJar + artifact javadocJar + + pom { + name = "OpenSearch Alerting spi" + packaging = "jar" + url = "https://github.com/opensearch-project/alerting-spi" + description = "OpenSearch Alerting spi" + scm { + connection = "scm:git@github.com:opensearch-project/alerting.git" + developerConnection = "scm:git@github.com:opensearch-project/alerting.git" + url = "git@github.com:opensearch-project/alerting.git" + } + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + id = "amazonwebservices" + organization = "Amazon Web Services" + organizationUrl = "https://aws.amazon.com" + } + } + } + } + } + + gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS) + gradle.startParameter.setLogLevel(LogLevel.DEBUG) } \ No newline at end of file From a0cf60003b7fc00c22307eb43960b5d1d5d35196 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Sun, 2 Jun 2024 23:43:12 -0700 Subject: [PATCH 2/3] Update build.gradle --- spi/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spi/build.gradle b/spi/build.gradle index c2df62ed9..1c8945b6f 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -63,7 +63,7 @@ publishing { pom { name = "OpenSearch Alerting spi" packaging = "jar" - url = "https://github.com/opensearch-project/alerting-spi" + url = "https://github.com/opensearch-project/alerting" description = "OpenSearch Alerting spi" scm { connection = "scm:git@github.com:opensearch-project/alerting.git" @@ -89,4 +89,4 @@ publishing { gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS) gradle.startParameter.setLogLevel(LogLevel.DEBUG) -} \ No newline at end of file +} From 0652ef0ee74812088df10da82bf0771231044e03 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Mon, 3 Jun 2024 18:22:49 +0000 Subject: [PATCH 3/3] change developers to point to OpenSearch Signed-off-by: Subhobrata Dey --- spi/build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spi/build.gradle b/spi/build.gradle index 1c8945b6f..5a586bd48 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -78,9 +78,8 @@ publishing { } developers { developer { - id = "amazonwebservices" - organization = "Amazon Web Services" - organizationUrl = "https://aws.amazon.com" + name = "OpenSearch" + url = "https://github.com/opensearch-project/alerting" } } }