Skip to content

Commit

Permalink
Update maven publication to include cksums. (opensearch-project#82)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mch2 committed Nov 4, 2021
1 parent ebf2a75 commit 67e99bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ fi
[ -z "$OUTPUT" ] && OUTPUT=artifacts

./gradlew publishShadowPublicationToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
mkdir -p $OUTPUT/maven/org/opensearch
cp -r ./spi/build/distributions/* $OUTPUT/maven/org/opensearch
./gradlew publishShadowPublicationToStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
mkdir -p $OUTPUT/maven/org/opensearch/opensearch-job-scheduler-spi
cp -r ./build/local-staging-repo/org/opensearch/opensearch-job-scheduler-spi $OUTPUT/maven/org/opensearch/opensearch-job-scheduler-spi

./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts
Expand Down
15 changes: 6 additions & 9 deletions spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,13 @@ task javadocJar(type: Jar) {
dependsOn javadoc
}

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) { publication ->
project.shadow.component(publication)
Expand Down

0 comments on commit 67e99bb

Please sign in to comment.