Skip to content
Permalink
Browse files
adjustments for Groovy 4 build
  • Loading branch information
paulk-asert committed Dec 4, 2020
1 parent 858ace7 commit db6f6e6a49371d5dc5d0487df38c0332aa2a5cdd
Showing 4 changed files with 16 additions and 13 deletions.
@@ -86,6 +86,8 @@ ext {
relVersion = project.findProperty('releaseVersion')
numVersion = relVersion?.find(/^[\d\.]+/)
newRelease = numVersion?.endsWith('.0')
apacheGroupId = relVersion && relVersion[0] >= '4'
distParentDir = apacheGroupId ? "$stagingDir/subprojects/groovy-binary/build" : "$stagingDir/target"
underVersion = relVersion?.replace('.', '_')?.replace('-', '_')?.toUpperCase()
releaseBuild = !relVersion?.toLowerCase()?.contains('snapshot')
stableBuild = releaseBuild && !relVersion?.toLowerCase()?.contains('alpha') && !relVersion?.toLowerCase()?.contains('beta') && !relVersion?.toLowerCase()?.contains('rc')
@@ -117,5 +117,7 @@ task showInfo(dependsOn: assumesPropsSet) {
println "devWorkspace = $devWorkspace"
println "releaseWorkspace = $releaseWorkspace"
println "stagingWebsiteDir = $stagingWebsiteDir"
println "apacheGroupId = $apacheGroupId"
println "distParentDir = $distParentDir"
}
}
@@ -169,7 +169,7 @@ task uploadStep2(type: Exec, dependsOn: [buildAndUploadStep1]) {
group = "Pre-vote phase"
description = "Publishes the Maven artifacts to the Apache staging repository"
workingDir stagingDir
if (relVersion.startsWith('4.0')) {
if (apacheGroupId) {
ext.theArgs = []
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
theArgs += ['cmd', '/C', 'gradlew.bat']
@@ -196,14 +196,14 @@ task prepareSvnDevWorkspace(type: SvnCheckout, dependsOn: [assumesBranch, cleanS

task copySvnDistro(type: Copy, dependsOn: [assumesPropsSet, prepareSvnDevWorkspace]) {
description = "Creates the required tree structure for distribution"
from(relVersion.startsWith('4.0') ? "$stagingDir/subprojects/groovy-binary/build/distributions" : "$stagingDir/target/distributions")
from("$distParentDir/distributions")
into "$devWorkspace/distribution"
exclude 'apache-groovy-src-*'
}

task copySvnSources(type: Copy, dependsOn: [assumesPropsSet, prepareSvnDevWorkspace]) {
description = "Creates the required tree structure for sources"
from(relVersion.startsWith('4.0') ? "$stagingDir/subprojects/groovy-binary/build/distributions" : "$stagingDir/target/distributions")
from("$distParentDir/distributions")
into "$devWorkspace/sources"
include 'apache-groovy-src-*'
}
@@ -99,7 +99,7 @@ task promoteOnBintray(dependsOn: jiraCheckPhase2) {
def build = builds.find {
resp = artifactory.get(path: 'api/build/groovy/' + it.uri, contentType: JSON)
assert resp.status == 200
def prefix = relVersion.startsWith('4.0') ? 'org.apache.groovy:groovy:' : 'org.codehaus.groovy:groovy:'
def prefix = apacheGroupId ? 'org.apache.groovy:groovy:' : 'org.codehaus.groovy:groovy:'
def coreModuleId = resp.data.buildInfo.modules*.id.find{ it.startsWith(prefix) }
def found = coreModuleId?.endsWith(':' + relVersion)
println "${found ? 'FOUND' : 'SKIPPING'} $coreModuleId @ ${it.uri}"
@@ -112,17 +112,18 @@ task promoteOnBintray(dependsOn: jiraCheckPhase2) {
"dryRun" : ${project.hasProperty('dryRun').toString()},
"publish" : true,
"async" : false,
"targetRepo" : "distribution-repo",
"targetRepo" : "${apacheGroupId ? 'distribution-repo-apache' : 'distribution-repo'}",
"sourceRepos" : ["libs-release-local"]
}/
if (project.hasProperty('dryRun')) println body
resp = artifactory.post(
path: "api/build/distribute/groovy/$buildNum",
body: body,
requestContentType: JSON
)
assert resp.status == 200
if (project.hasProperty('dryRun')) println resp.data
else println resp.data.message
assert resp.status == 200
}
}

@@ -166,7 +167,7 @@ and progress through process manually -> Close -> Publish ... under staging repo
"password" : "${project.findProperty('centralKey')}"
}/
def resp = bintray.post(
path: "groovy/versions/$relVersion", // apache-groovy?
path: "groovy/versions/$relVersion",
body: body,
requestContentType: JSON
)
@@ -175,20 +176,18 @@ and progress through process manually -> Close -> Publish ... under staging repo
println resp.data.messages.join('\n')
}
}
synchronizeWithMavenCentral.onlyIf()
synchronizeWithMavenCentral.onlyIf{ !apacheGroupId }

// TODO decide if this should go via staging on artifactory
task publishZipsOnBintray(dependsOn: [jiraCheckPhase2, assumesRelVersion]) {
group = "Post-passed phase"
description = "Publish distribution zips to bintray"
doLast {
def bintray = new RESTClient('https://api.bintray.com/content/groovy/maven/')
bintray.headers['Authorization'] = 'Basic ' + "$bintrayUser:$bintrayKey".getBytes('iso-8859-1').encodeBase64()
fileTree("$stagingDir/target/distributions").files.each { File f ->
fileTree("$distParentDir/distributions").files.each { File f ->
println "Uploading $f.name"
def resp = bintray.put(
path: "groovy/$relVersion/${f.name}",
// path: "apache-groovy/$relVersion/${f.name}",
body: f.bytes,
requestContentType: BINARY
)
@@ -258,7 +257,7 @@ task uploadDocumentationToGroovyWebsite() {
ssh.run {
session(remotes.ciServer) {
execute 'uname -a'
put from: "$stagingDir/target/distributions/apache-groovy-docs-${relVersion}.zip", into: '/var/www/docs/docs'
put from: "$distParentDir/distributions/apache-groovy-docs-${relVersion}.zip", into: '/var/www/docs/docs'
execute "rm -rf /var/www/docs/docs/groovy-${relVersion}/"
execute "unzip -d /var/www/docs/docs/ /var/www/docs/docs/apache-groovy-docs-${relVersion}.zip"
execute "chmod 664 /var/www/docs/docs/apache-groovy-docs-${relVersion}.zip"
@@ -364,7 +363,7 @@ task waitForWebsitePublication(dependsOn: pushGroovyWebsite) {
}
waitForWebsitePublication.onlyIf{ releaseBuild }

task publishToSDKman(dependsOn: [waitForWebsitePublication, maybeUpdateDocumentationSymlink, synchronizeWithMavenCentral, publishZipsOnBintray, uploadToApacheReleaseServer, sdkReleaseVersion]) {
task publishToSDKman(dependsOn: [synchronizeWithMavenCentral, publishZipsOnBintray, uploadToApacheReleaseServer, waitForWebsitePublication, maybeUpdateDocumentationSymlink, sdkReleaseVersion]) {
group = "Post-passed phase"
description = "Publishes the release on SDKman"
}

0 comments on commit db6f6e6

Please sign in to comment.