From 621d75eeb9f0af8b6b409fab48d6eab6421a64ac Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Fri, 5 Nov 2021 06:35:44 -0700 Subject: [PATCH] Update maven publication to include cksums. (#224) This change adds a task to publish to a local staging repo under build/ that includes cksums. It also updates build.sh to use this new task and copy the contents of the staging repo to the output directory. The maven publish plugin will not include these cksums when publishing to maven local but will when published to a separate folder. Signed-off-by: Marc Handalian --- notification/build.gradle | 15 ++++++--------- scripts/build.sh | 4 +++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/notification/build.gradle b/notification/build.gradle index 62c2acae7..8477d7d33 100644 --- a/notification/build.gradle +++ b/notification/build.gradle @@ -57,16 +57,13 @@ task javadocJar(type: Jar) { from javadoc.destinationDir } -tasks.withType(Jar) { task -> - task.doLast { - ant.checksum algorithm: 'md5', file: it.archivePath - ant.checksum algorithm: 'sha1', file: it.archivePath - ant.checksum algorithm: 'sha-256', file: it.archivePath, fileext: '.sha256' - ant.checksum algorithm: 'sha-512', file: it.archivePath, fileext: '.sha512' - } -} - publishing { + repositories { + maven { + name = 'staging' + url = "${rootProject.buildDir}/local-staging-repo" + } + } publications { shadow(MavenPublication) { project.shadow.component(it) diff --git a/scripts/build.sh b/scripts/build.sh index 19bdef2bd..7aa6cb535 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -69,7 +69,9 @@ echo "COPY ${distributions}/*.zip" cp ${distributions}/*.zip ./$OUTPUT/plugins ./gradlew publishShadowPublicationToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -x ktlint +./gradlew publishShadowPublicationToStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT mkdir -p $OUTPUT/maven/org/opensearch -cp -r ./notification/build/libs $OUTPUT/maven/org/opensearch/notification +cp -r ./build/local-staging-repo/org/opensearch/notification $OUTPUT/maven/org/opensearch/notification +