Skip to content

Commit b42423b

Browse files
committed
Last minute release plugin fixes
1 parent 555240c commit b42423b

5 files changed

Lines changed: 37 additions & 29 deletions

File tree

buildSrc/src/main/groovy/org.apache.fineract.release.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ fineract {
111111
templateFile: "${projectDir}/buildSrc/src/main/resources/jira/changelog.txt.ftl"
112112
],
113113
gpg: [
114-
file: "${projectDir}/buildSrc/build/libs/buildSrc.jar"
114+
files: [
115+
"${projectDir}/buildSrc/build/libs/buildSrc.jar"
116+
]
115117
]
116118
],
117119
step1: [
@@ -173,7 +175,10 @@ fineract {
173175
order: 7,
174176
description: 'Sign the distribution artifacts',
175177
gpg: [
176-
file: "${rootDir}/fineract-war/build/distributions/apache-fineract-binary-${project.version}.tar.gz"
178+
files: [
179+
"${rootDir}/fineract-war/build/distributions/apache-fineract-${project.version}-src.tar.gz",
180+
"${rootDir}/fineract-war/build/distributions/apache-fineract-${project.version}-binary.tar.gz"
181+
]
177182
]
178183
],
179184
step8: [

buildSrc/src/main/groovy/org/apache/fineract/gradle/FineractPlugin.groovy

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class FineractPlugin implements Plugin<Project> {
324324

325325
// step 6
326326
project.tasks.register("fineractReleaseStep6") {
327-
dependsOn(":fineract-war:binaryDistTar")
327+
dependsOn(":fineract-war:distTar")
328328
}
329329

330330
// step 7
@@ -334,13 +334,11 @@ class FineractPlugin implements Plugin<Project> {
334334

335335
gpgService.sign(step.gpg)
336336

337-
def md5 = gpgService.md5(step.gpg)
338-
def md5File = new File("${step.gpg.file}.md5")
339-
md5File.write md5
337+
step.gpg.files.findAll {
338+
gpgService.md5(step.gpg)
340339

341-
def sha512 = gpgService.sha512(step.gpg)
342-
def sha512File = new File("${step.gpg.file}.sha512")
343-
sha512File.write sha512
340+
gpgService.sha512(step.gpg)
341+
}
344342
}
345343
}
346344

buildSrc/src/main/groovy/org/apache/fineract/gradle/FineractPluginExtension.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,6 @@ class FineractPluginExtension {
159159
}
160160

161161
static class FineractPluginGpgParams {
162-
String file
162+
List<String> files
163163
}
164164
}

buildSrc/src/main/groovy/org/apache/fineract/gradle/service/GpgService.groovy

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ class GpgService {
9292
}
9393

9494
void sign(FineractPluginExtension.FineractPluginGpgParams params) {
95-
InputStream is = new FileInputStream(params.file)
95+
params.files.findAll {
96+
InputStream is = new FileInputStream(it)
9697

97-
BCPGOutputStream os = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(params.file + ".asc")))
98-
sign(is).encode(os)
99-
os.close();
98+
BCPGOutputStream os = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(it + ".asc")))
99+
sign(is).encode(os)
100+
os.close();
101+
}
100102
}
101103

102104
PGPSignature sign(InputStream is) throws IOException, PGPException, GeneralSecurityException {
@@ -115,12 +117,20 @@ class GpgService {
115117
}
116118

117119

118-
String md5(FineractPluginExtension.FineractPluginGpgParams params) {
119-
return calc(new FileInputStream(params.file), MessageDigest.getInstance("MD5", BouncyCastleProvider.PROVIDER_NAME))
120+
void md5(FineractPluginExtension.FineractPluginGpgParams params) {
121+
params.files.findAll {
122+
def result = calc(new FileInputStream(it), MessageDigest.getInstance("MD5", BouncyCastleProvider.PROVIDER_NAME))
123+
def file = new File("${it}.md5")
124+
file.write result
125+
}
120126
}
121127

122-
String sha512(FineractPluginExtension.FineractPluginGpgParams params) {
123-
return calc(new FileInputStream(params.file), MessageDigest.getInstance("SHA-512", BouncyCastleProvider.PROVIDER_NAME))
128+
void sha512(FineractPluginExtension.FineractPluginGpgParams params) {
129+
params.files.findAll {
130+
def result = calc(new FileInputStream(it), MessageDigest.getInstance("SHA-512", BouncyCastleProvider.PROVIDER_NAME))
131+
def file = new File("${it}.sha512")
132+
file.write result
133+
}
124134
}
125135

126136
private static String calc(InputStream is, MessageDigest digest) {

fineract-war/build.gradle

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ tasks.withType(Tar) {
5858

5959
distributions {
6060
binary {
61-
if(project.hasProperty("distVersion")) {
62-
distributionBaseName = "apache-fineract-$distVersion-binary"
63-
} else {
64-
distributionBaseName = "apache-fineract-binary"
65-
}
61+
distributionBaseName = 'apache-fineract-binary'
6662
contents {
6763
from ("$rootDir/fineract-client/build/libs/") {
6864
include 'fineract-client-*.jar'
@@ -88,19 +84,18 @@ distributions {
8884
}
8985
}
9086
src {
91-
if(project.hasProperty("distVersion")) {
92-
distributionBaseName = "apache-fineract-$distVersion-src"
93-
} else {
94-
distributionBaseName = "apache-fineract-src"
95-
}
96-
87+
distributionBaseName = 'apache-fineract-src'
9788
contents {
9889
from "$rootDir/"
9990
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', '*.class', '**/bin', '*.log', '.dockerignore', '**/.gitkeep'
10091
rename ('LICENSE_SOURCE', 'LICENSE')
10192
rename ('NOTICE_SOURCE', 'NOTICE')
10293
}
10394
}
95+
doLast {
96+
file("${buildDir}/distributions/apache-fineract-binary-${version}.tar.gz").renameTo("${buildDir}/distributions/apache-fineract-${version}-binary.tar.gz")
97+
file("${buildDir}/distributions/apache-fineract-src-${version}.tar.gz").renameTo("${buildDir}/distributions/apache-fineract-${version}-src.tar.gz")
98+
}
10499
}
105100

106101
binaryDistZip.enabled false

0 commit comments

Comments
 (0)