FINERACT-1129: create Gradle release task - fix source distribution
This commit is contained in:
@@ -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:
|
Above tasks will create the following files in folder build/distributions:
|
||||||
|
|
||||||
- distribution file: apache-fineract-1.4.0-binary.tar.gz
|
- binary distribution file: apache-fineract-1.4.0-binary.tar.gz
|
||||||
- ASCII armored signatures: apache-fineract-1.4.0-binary.tar.gz.asc
|
- ASCII armored signature for binary distribution: apache-fineract-1.4.0-binary.tar.gz.asc
|
||||||
- SHA512 checksum: apache-fineract-1.4.0-binary.tar.gz.sha512
|
- 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
|
gpg --verify build/distributions/apache-fineract-1.4.0-binary.tar.gz.asc
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -825,22 +825,16 @@ bootJar {
|
|||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
tasks.withType(Tar) {
|
||||||
classifier 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Tar){
|
|
||||||
compression Compression.GZIP
|
compression Compression.GZIP
|
||||||
extension 'tar.gz'
|
extension 'tar.gz'
|
||||||
dependsOn 'buildSwaggerCodeFineract'
|
dependsOn 'buildSwaggerCodeFineract'
|
||||||
}
|
}
|
||||||
|
|
||||||
distributions {
|
distributions {
|
||||||
main {
|
binary {
|
||||||
baseName "apache-fineract-$releaseVersion-binary"
|
baseName "apache-fineract-$releaseVersion-binary"
|
||||||
contents {
|
contents {
|
||||||
from sourcesJar
|
|
||||||
from bootJar
|
from bootJar
|
||||||
from bootWar
|
from bootWar
|
||||||
from('../build/swagger-code-fineract/build/libs/') {
|
from('../build/swagger-code-fineract/build/libs/') {
|
||||||
@@ -859,17 +853,26 @@ distributions {
|
|||||||
from '../README.md'
|
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
|
// create signatures and checksums only if project parameter "fineract.release" is provided on the command line
|
||||||
if( project.hasProperty("fineract.release") ) {
|
if( project.hasProperty("fineract.release") ) {
|
||||||
signing {
|
signing {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
sign distTar
|
sign (binaryDistTar, srcDistTar)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Tar) { task ->
|
tasks.withType(Tar) { task ->
|
||||||
task.doLast {
|
task.doLast {
|
||||||
ant.checksum file: task.archivePath, algorithm: 'SHA-512', fileext: '.sha512'
|
ant.checksum file: task.archivePath, algorithm: 'SHA-512', fileext: '.sha512'
|
||||||
@@ -877,19 +880,20 @@ if( project.hasProperty("fineract.release") ) {
|
|||||||
}
|
}
|
||||||
tasks.withType(Sign) { task ->
|
tasks.withType(Sign) { task ->
|
||||||
task.doLast {
|
task.doLast {
|
||||||
new ByteArrayOutputStream().withStream { os ->
|
task.getFilesToSign().each { f ->
|
||||||
def result = exec {
|
new ByteArrayOutputStream().withStream { os ->
|
||||||
workingDir '../build/distributions'
|
def result = exec {
|
||||||
executable 'sh'
|
workingDir '../build/distributions'
|
||||||
args '-c', "gpg --verify apache-fineract-$releaseVersion-binary.tar.gz.asc"
|
executable 'sh'
|
||||||
standardOutput = os
|
args '-c', "gpg --verify ${f}.asc"
|
||||||
}
|
standardOutput = os
|
||||||
|
}
|
||||||
if(result.exitValue==0) {
|
if(result.exitValue==0) {
|
||||||
println '+++++++ GPG signature correct!'
|
println '+++ GPG signature correct!'
|
||||||
} else {
|
} else {
|
||||||
println '------- GPG signature incorrect!'
|
println '--- GPG signature incorrect!'
|
||||||
throw new RuntimeException('GPG signature incorrect!')
|
throw new RuntimeException('--- GPG signature incorrect!')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user