| import groovyx.net.http.HttpBuilder |
| import org.ajoberstar.grgit.Credentials |
| import org.ajoberstar.grgit.util.JGitUtil |
| import org.apache.tools.ant.taskdefs.condition.Os |
| |
| buildscript { |
| repositories { |
| jcenter() |
| maven { |
| url "https://plugins.gradle.org/m2/" |
| } |
| } |
| |
| dependencies { |
| classpath "org.ajoberstar:grgit:${getProperty('version.grgit')}" |
| classpath "at.bxm.gradleplugins:gradle-svntools-plugin:${getProperty('version.svntools')}" |
| classpath "io.github.http-builder-ng:http-builder-ng-okhttp:${getProperty('version.httpbuilderng')}" |
| classpath "org.hidetake:gradle-ssh-plugin:${getProperty('version.sshplugin')}" |
| classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:${getProperty('version.sdkmanplugin')}" |
| } |
| } |
| |
| ssh.settings { |
| dryRun = project.hasProperty('dryRun') |
| // TODO explore whether this can be made more secure - below not working on windows |
| // knownHosts = file(System.getProperty('user.home') + '/.ssh/known_hosts') |
| knownHosts = allowAnyHosts |
| } |
| |
| remotes { |
| ciServer { |
| host = 'ci.groovy-lang.org' |
| user = findProperty('ciserver.user') |
| password = findProperty('ciserver.password') |
| //identity = file('id_rsa') |
| } |
| } |
| |
| // use Exec rather than GradleBuild to avoid any issues between gradle versions |
| task websiteBuild(type: Exec, dependsOn: [assumesRelVersion, checkoutGroovyWebsite]) { |
| workingDir stagingWebsiteDir |
| def theArgs = [] |
| if (Os.isFamily(Os.FAMILY_WINDOWS)) { |
| theArgs += ['cmd', '/C', 'gradlew.bat'] |
| } else { |
| theArgs += ['sh', './gradlew'] |
| } |
| theArgs << ':site-dev:webzip' |
| theArgs << ':site-user:webzip' |
| commandLine theArgs |
| } |
| |
| // NOTE: not normally needed as part of a release since the CI server does |
| // this automatically upon commit of the changed website |
| task websitePublishUserSite(dependsOn: websiteBuild) { |
| description = "Manual upload of documentation to the Groovy website server" |
| doLast { |
| println "WARNING: result might be overridden by CI server" |
| ssh.run { |
| session(remotes.ciServer) { |
| execute 'uname -a' |
| file("$stagingWebsiteDir/site-user/build/site").listFiles().each { |
| put from: it, into: '/var/www/beta' |
| } |
| // execute 'chgrp -R teamcity /var/www/beta' |
| } |
| } |
| } |
| } |
| |
| task untagVersion(dependsOn: assumesPropsSet) { |
| doLast { |
| def apacheCredentials = new Credentials(apacheUser, apachePassword) |
| // def apacheCredentials = new Credentials(username: apacheUser, password: apachePassword) |
| def grgit = grgitClass.open(dir: stagingDir, creds: apacheCredentials) |
| def tagName = "GROOVY_$underVersion" |
| def tag = null |
| try { |
| tag = JGitUtil.resolveTag(grgit.repository, tagName) |
| } catch (ignore) { |
| println "Exception message: " + ignore.message |
| } |
| assert tag, "Tag $tagName is supposed to exist but doesn't!" |
| grgit.tag.remove(names: [tagName]) |
| grgit.push(tags: true) |
| grgit.push(refsOrSpecs: [":refs/tags/$tagName"]) |
| } |
| } |
| |
| task unreleaseOnJira(dependsOn: jiraCheckPhase2) { |
| description = "Unrelease on Jira if the VOTE is cancelled" |
| doLast { |
| HttpBuilder.configure { |
| request.uri = 'https://issues.apache.org' |
| request.auth.basic apacheUser, apachePassword |
| }.put { |
| request.uri.path = "/jira/rest/api/2/version/$versionId" |
| request.body = /{ "released": false, "releaseDate": null }/ |
| request.contentType = 'application/json' |
| } |
| } |
| } |
| |
| task showInfo(dependsOn: assumesPropsSet) { |
| doLast { |
| println "branch = $branch" |
| println "relVersion = $relVersion" |
| println "stagingDir = $stagingDir" |
| println "newRelease = $newRelease" |
| println "releaseBuild = $releaseBuild" |
| println "stableBuild = $stableBuild" |
| println "nextVersion = $nextVersion" |
| println "baseVersion = $baseVersion" |
| println "underVersion = $underVersion" |
| println "devWorkspace = $devWorkspace" |
| println "releaseWorkspace = $releaseWorkspace" |
| println "stagingWebsiteDir = $stagingWebsiteDir" |
| println "apacheGroupId = $apacheGroupId" |
| println "distParentDir = $distParentDir" |
| } |
| } |