From c423caf23cdbe8daeaa7afb4d24738944dfcfa62 Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Thu, 4 Nov 2021 07:16:42 -0700 Subject: [PATCH] Update maven publication to include cksums. (#91) This change adds a local staging repo task that will include cksums. It will also update 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 --- build.gradle | 16 ++++++---------- scripts/build.sh | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 92f71cc5..92e442ca 100644 --- a/build.gradle +++ b/build.gradle @@ -157,17 +157,13 @@ task javadocJar(type: Jar) { classifier = 'javadoc' 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 fdc9be57..891e27fc 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -57,5 +57,6 @@ fi ./gradlew build -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT ./gradlew publishShadowPublicationToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT +./gradlew publishShadowPublicationToStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT mkdir -p $OUTPUT/maven/org/opensearch -cp -r ./build/libs $OUTPUT/maven/org/opensearch/common-utils +cp -r ./build/local-staging-repo/org/opensearch/common-utils $OUTPUT/maven/org/opensearch/common-utils