FINERACT-1129: create Gradle release task - fix source distribution

This commit is contained in:
Aleksandar Vidakovic
2020-08-28 02:39:43 +02:00
parent 11e4ce92ed
commit 89e4e54ad3
2 changed files with 36 additions and 29 deletions
+8 -5
View File
@@ -377,13 +377,16 @@ NOTE: Let's assume your GPG key ID would be "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789
Above tasks will create the following files in folder build/distributions:
- distribution file: apache-fineract-1.4.0-binary.tar.gz
- ASCII armored signatures: apache-fineract-1.4.0-binary.tar.gz.asc
- SHA512 checksum: apache-fineract-1.4.0-binary.tar.gz.sha512
- binary distribution file: apache-fineract-1.4.0-binary.tar.gz
- ASCII armored signature for binary distribution: apache-fineract-1.4.0-binary.tar.gz.asc
- SHA512 checksum for binary distribution: apache-fineract-1.4.0-binary.tar.gz.sha512
- source distribution file: apache-fineract-1.4.0-src.tar.gz
- ASCII armored signature for source distribution: apache-fineract-1.4.0-src.tar.gz.asc
- SHA512 checksum for source distribution: apache-fineract-1.4.0-src.tar.gz.sha512
The signature is automatically verified by the build script. It will throw an exception if the verification fails.
The signatures are automatically verified by the build script. It will throw an exception if the verification fails.
Additionally, you can verify the validity of the release distribution with:
Additionally, you can verify the validity of the release distribution files e. g. with:
```
gpg --verify build/distributions/apache-fineract-1.4.0-binary.tar.gz.asc
```
+28 -24
View File
@@ -825,22 +825,16 @@ bootJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allSource
}
tasks.withType(Tar){
tasks.withType(Tar) {
compression Compression.GZIP
extension 'tar.gz'
dependsOn 'buildSwaggerCodeFineract'
}
distributions {
main {
binary {
baseName "apache-fineract-$releaseVersion-binary"
contents {
from sourcesJar
from bootJar
from bootWar
from('../build/swagger-code-fineract/build/libs/') {
@@ -859,17 +853,26 @@ distributions {
from '../README.md'
}
}
src {
baseName "apache-fineract-$releaseVersion-src"
contents {
from "../"
exclude 'build' , '.git', '.gradle', '.github', '.settings', '.project', '.classpath', '.idea', 'out', '._.DS_Store', '.DS_Store', 'WebContent', '.externalToolbuilders', '.theia', '.gitpod.yml', '.travis.yml', 'LICENSE_RELEASE', 'NOTICE_RELEASE', '**/licenses/binary'
rename ('LICENSE_SOURCE', 'LICENSE')
rename ('NOTICE_SOURCE', 'NOTICE')
}
}
}
tasks.distZip.enabled false
tasks.binaryDistZip.enabled false
tasks.srcDistZip.enabled false
// create signatures and checksums only if project parameter "fineract.release" is provided on the command line
if( project.hasProperty("fineract.release") ) {
signing {
useGpgCmd()
sign distTar
sign (binaryDistTar, srcDistTar)
}
tasks.withType(Tar) { task ->
task.doLast {
ant.checksum file: task.archivePath, algorithm: 'SHA-512', fileext: '.sha512'
@@ -877,19 +880,20 @@ if( project.hasProperty("fineract.release") ) {
}
tasks.withType(Sign) { task ->
task.doLast {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
workingDir '../build/distributions'
executable 'sh'
args '-c', "gpg --verify apache-fineract-$releaseVersion-binary.tar.gz.asc"
standardOutput = os
}
if(result.exitValue==0) {
println '+++++++ GPG signature correct!'
} else {
println '------- GPG signature incorrect!'
throw new RuntimeException('GPG signature incorrect!')
task.getFilesToSign().each { f ->
new ByteArrayOutputStream().withStream { os ->
def result = exec {
workingDir '../build/distributions'
executable 'sh'
args '-c', "gpg --verify ${f}.asc"
standardOutput = os
}
if(result.exitValue==0) {
println '+++ GPG signature correct!'
} else {
println '--- GPG signature incorrect!'
throw new RuntimeException('--- GPG signature incorrect!')
}
}
}
}