groovy-release git commit: initial commit of move from groovy/groovy-release

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy-release git commit: initial commit of move from groovy/groovy-release

paulk
Repository: groovy-release
Updated Branches:
  refs/heads/master [created] f717b2336


initial commit of move from groovy/groovy-release


Project: http://git-wip-us.apache.org/repos/asf/groovy-release/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy-release/commit/f717b233
Tree: http://git-wip-us.apache.org/repos/asf/groovy-release/tree/f717b233
Diff: http://git-wip-us.apache.org/repos/asf/groovy-release/diff/f717b233

Branch: refs/heads/master
Commit: f717b23364f836866026ef22fc0de297b5a1280e
Parents:
Author: paulk <[hidden email]>
Authored: Fri Jun 16 21:46:44 2017 +1000
Committer: paulk <[hidden email]>
Committed: Fri Jun 16 21:46:44 2017 +1000

----------------------------------------------------------------------
 .gitignore                               |  17 +
 LICENSE                                  | 201 ++++++++++++
 build.gradle                             | 139 ++++++++
 gradle.properties                        |   5 +
 gradle/adhoc.gradle                      | 102 ++++++
 gradle/phase1.gradle                     | 296 +++++++++++++++++
 gradle/phase2.gradle                     | 444 ++++++++++++++++++++++++++
 gradle/wrapper/gradle-wrapper.jar        | Bin 0 -> 54227 bytes
 gradle/wrapper/gradle-wrapper.properties |   6 +
 gradlew                                  | 172 ++++++++++
 gradlew.bat                              |  84 +++++
 settings.gradle                          |  19 ++
 12 files changed, 1485 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0e943a7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+.gradle
+build/
+*.iml
+*.ipr
+*.iws
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8dada3e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..7a04c4a
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,139 @@
+import org.apache.tools.ant.taskdefs.condition.Os
+
+/**
+ * Phase1 is invoked with:
+ *
+ *     gradlew -Pbranch=checkout_branch_name -PreleaseVersion=versionToRelease phase1
+ *
+ * e.g.:
+ *
+ *     gradlew -Pbranch=GROOVY_2_4_X -PreleaseVersion=2.4.8 phase1
+ *
+ * Assumes you have the following properties set up, e.g. in ~/.gradle/gradle.properties
+ * or using -PpropName=propValue on the command line:
+ *
+ *     signing.keyId=hexId
+ *     signing.password=your_s3cr3t_passphrase
+ *     signing.secretKeyRingFile=path_to_secring.gpg
+ *     apacheUser=your_username
+ *     apachePassword=your_password
+ *     artifactoryUser=artifactory_username
+ *     artifactoryPassword=artifactory_secret_password
+ *
+ * Phase 2 is invoked with:
+ *
+ *     gradlew -Pbranch=checkout_branch_name -PreleaseVersion=versionToRelease phase2
+ *
+ * e.g.:
+ *
+ *     gradlew -Pbranch=GROOVY_2_4_X -PreleaseVersion=2.4.8 phase2
+ *
+ * Assumes you have the following properties set up, e.g. in ~/.gradle/gradle.properties
+ * or using -PpropName=propValue on the command line:
+ *
+ *     ciserver.user=ci_login_user
+ *     ciserver.password=ci_login_password
+ *     githubUser=your_github_user
+ *     githubPassword=your_github_password
+ *     gvm.consumerKey=xxxxx
+ *     gvm.consumerToken=yyyyy
+ *     artifactoryUser=aaaa
+ *     artifactoryPassword=bbbb
+ *     centralUser=cccc
+ *     centralKey=dddd
+ *
+ * Using the -PsecurityFix property will add some additional placeholder text
+ * about a security fix to the email template.
+ *
+ * The script will try to be smart about making the new release the latest release version.
+ * It does this if the new release is a stable release and it looks like no other stable releases have
+ * a higher major.minor version. Use -PforceDefault and -PskipDefault to override.
+ *
+ * Assumptions:
+ * <ul>
+ * <li>The KEYS file is currently assumed to be updated manually outside this build script</li>
+ * </ul>
+ */
+
+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 "org.codehaus.groovy.modules.http-builder:http-builder:${getProperty('version.httpbuilder')}"
+        classpath "org.hidetake:gradle-ssh-plugin:${getProperty('version.sshplugin')}"
+        classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:${getProperty('version.sdkmanplugin')}"
+    }
+}
+
+ext {
+    grgitClass = org.ajoberstar.grgit.Grgit
+    repoBase = 'https://git1-us-west.apache.org/repos/asf'
+    repoUri = "$repoBase/groovy.git"
+    websiteRepo = 'https://github.com/groovy/groovy-website'
+    now = new Date().format('yyyy-MM-dd')
+    branch = project.findProperty('branch')
+    stagingDir = "$project.buildDir/staging-$branch/"
+    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        System.setProperty('https.protocols', 'TLSv1.1')
+    }
+    relVersion = project.findProperty('releaseVersion')
+    numVersion = relVersion?.find(/^[\d\.]+/)
+    newRelease = numVersion?.endsWith('.0')
+    underVersion = relVersion?.replace('.', '_')?.replace('-', '_')?.toUpperCase()
+    releaseBuild = !relVersion?.toLowerCase()?.contains('snapshot')
+    stableBuild = releaseBuild && !relVersion?.toLowerCase()?.contains('alpha') && !relVersion?.toLowerCase()?.contains('beta') && !relVersion?.toLowerCase()?.contains('rc')
+    if (stableBuild) {
+        def parts = relVersion?.split(/\./)
+        baseVersion = parts?.with{ "${it[0]}.${it[1]}.0"  }
+        nextVersion = parts?.with{ "${it[0]}.${it[1]}.${it[2].toInteger() + 1}"  }
+        if (!newRelease) {
+            prevVersion = parts?.with{ "${it[0]}.${it[1]}.${it[2].toInteger() - 1}"  }
+        }
+    }
+    devWorkspaceRoot = "$project.buildDir/svn-dev-workspace-$branch"
+    devWorkspace = "$devWorkspaceRoot/$relVersion"
+    releaseWorkspaceRoot = "$project.buildDir/svn-release-workspace-$branch"
+    releaseWorkspace = "$releaseWorkspaceRoot/$relVersion"
+    stagingWebsiteDir = "$project.buildDir/staging-website/"
+}
+
+task assumesBranch {
+    doLast {
+        assert branch, "Required property 'branch' not set"
+    }
+}
+
+task assumesRelVersion {
+    doLast {
+        assert relVersion, "Required property 'releaseVersion' not set"
+    }
+}
+
+task assumesPropsSet(dependsOn: [assumesBranch, assumesRelVersion])
+
+apply plugin: 'idea'
+apply plugin: 'groovy'
+apply from: 'gradle/phase1.gradle'
+apply from: 'gradle/phase2.gradle'
+apply from: 'gradle/adhoc.gradle'
+
+task phase1 {
+    dependsOn 'prepareVoteThread'
+    doLast {
+        println "Pre-vote phase"
+    }
+}
+
+task phase2 {
+    dependsOn 'announceReleaseOnSDKman'
+    doLast {
+        println "Post-vote phase"
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle.properties
----------------------------------------------------------------------
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..c8d40cf
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,5 @@
+version.grgit=1.8.0
+version.svntools=2.2.1
+version.httpbuilder=0.7.1
+version.sshplugin=2.7.0
+version.sdkmanplugin=1.1.1

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle/adhoc.gradle
----------------------------------------------------------------------
diff --git a/gradle/adhoc.gradle b/gradle/adhoc.gradle
new file mode 100644
index 0000000..34edb22
--- /dev/null
+++ b/gradle/adhoc.gradle
@@ -0,0 +1,102 @@
+import groovyx.net.http.RESTClient
+import org.ajoberstar.grgit.Credentials
+import org.ajoberstar.grgit.util.JGitUtil
+import org.apache.tools.ant.taskdefs.condition.Os
+
+import static groovyx.net.http.ContentType.JSON
+
+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 "org.codehaus.groovy.modules.http-builder:http-builder:${getProperty('version.httpbuilder')}"
+        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 << './gradlew'
+    }
+    theArgs << '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 websitePublish(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/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(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 {
+        def jira = new RESTClient('https://issues.apache.org/jira/rest/api/2/')
+        jira.headers['Authorization'] = 'Basic ' + "$apacheUser:$apachePassword".getBytes('iso-8859-1').encodeBase64()
+        def resp = jira.put(
+                path: "version/$versionId",
+                body: /{ "released": false, "releaseDate": null }/,
+                requestContentType: JSON
+        )
+        assert resp.status == 200
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle/phase1.gradle
----------------------------------------------------------------------
diff --git a/gradle/phase1.gradle b/gradle/phase1.gradle
new file mode 100644
index 0000000..0fab2ce
--- /dev/null
+++ b/gradle/phase1.gradle
@@ -0,0 +1,296 @@
+import at.bxm.gradleplugins.svntools.api.SvnDepth
+import at.bxm.gradleplugins.svntools.tasks.SvnAdd
+import at.bxm.gradleplugins.svntools.tasks.SvnCheckout
+import at.bxm.gradleplugins.svntools.tasks.SvnCommit
+import at.bxm.gradleplugins.svntools.tasks.SvnVersion
+import groovyx.net.http.RESTClient
+import org.ajoberstar.grgit.Credentials
+import org.ajoberstar.grgit.Person
+import org.ajoberstar.grgit.util.JGitUtil
+import org.apache.tools.ant.taskdefs.condition.Os
+
+import static groovyx.net.http.ContentType.JSON
+
+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 "org.codehaus.groovy.modules.http-builder:http-builder:${getProperty('version.httpbuilder')}"
+        classpath "org.hidetake:gradle-ssh-plugin:${getProperty('version.sshplugin')}"
+        classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:${getProperty('version.sdkmanplugin')}"
+    }
+}
+
+apply plugin: "at.bxm.svntools"
+
+svntools {
+    username = apacheUser
+    password = apachePassword
+}
+
+task checkout(dependsOn: assumesBranch) {
+    group = "Pre-vote phase"
+    description = "Checks out the Apache Groovy sources (assumes -Pbranch=branch_to_release)"
+    // fresh clone may be overkill but take safe option for now unless skipClone specified
+    doLast {
+        def grgit
+        if (project.hasProperty('skipClone')) {
+            grgit = grgitClass.open(dir: stagingDir)
+        } else {
+            println "Cloning $repoUri to $stagingDir. This may take a few minutes ..."
+            grgit = grgitClass.clone(dir: stagingDir, uri: repoUri, refToCheckout: branch)
+        }
+        grgit.checkout(branch: branch)
+        def id = grgit.head().abbreviatedId
+        def message = grgit.head().shortMessage
+        def dir = file(stagingDir)
+        assert !dir.isFile() && dir.listFiles()
+        println "Checked out: $grgit.branch.current.name @ $id ($message)"
+    }
+}
+
+task confirmVersion(dependsOn: [assumesPropsSet, checkout]) {
+    group = "Pre-vote phase"
+    description = "Confirm version to release (assumes -PreleaseVersion=version_to_release)"
+    doLast {
+        def propsFile = file("$stagingDir/gradle.properties")
+        def versionLines = propsFile.text.readLines().findAll { it.matches(/groovy.*Version.*/) }
+        def normalVersion = /(?ism).*$numVersion[a-zA-Z\-]*\.SNAPSHOT.*/
+        def bundleVersion = /(?ism).*$numVersion[a-zA-Z\-]*-SNAPSHOT.*/
+        versionLines.each {
+            assert it.matches(normalVersion) || it.matches(bundleVersion)
+        }
+    }
+}
+
+// use Exec rather than GradleBuild to avoid any issues between gradle versions
+task checkCompatibility(type: Exec, dependsOn: [assumesBranch, checkout]) {
+    workingDir stagingDir
+    def theArgs = []
+    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        theArgs += ['cmd', '/C', 'gradlew.bat']
+    } else {
+        theArgs << './gradlew'
+    }
+    theArgs << 'checkCompatibility'
+    commandLine theArgs
+}
+
+task jiraPrecheck(dependsOn: assumesRelVersion) {
+    doLast {
+        def jira = new RESTClient('https://issues.apache.org/jira/rest/api/2/')
+        def resp = jira.get(path: 'project/GROOVY/versions')
+        assert resp.status == 200 && resp.data
+        def versionFields = resp.data.find { it.name == relVersion }
+        assert versionFields, "Version $relVersion not found in Jira!"
+        assert !versionFields.released, "Version $relVersion already released!"
+        project.ext.versionId = versionFields.id
+        project.ext.projectId = versionFields.projectId
+
+        resp = jira.get(path: "version/$versionId/unresolvedIssueCount")
+        assert resp.status == 200 && resp.data
+        if (resp.data.issuesUnresolvedCount) {
+            logger.warn "Warning found $resp.data.issuesUnresolvedCount unresolved issues for version $relVersion"
+        }
+        resp = jira.get(path: "version/$versionId/relatedIssueCounts")
+        assert resp.status == 200 && resp.data
+        project.ext.fixCount = resp.data.issuesFixedCount
+    }
+}
+
+task createReleaseBranch(dependsOn: [assumesPropsSet, jiraPrecheck, confirmVersion]) {
+    group = "Pre-vote phase"
+    description = "Creates a release branch"
+    doLast {
+        def grgit = grgitClass.open(dir: stagingDir)
+        grgit.checkout(branch: "REL_BRANCH_$underVersion", startPoint: branch, createBranch: true)
+        println "Checked out: $grgit.branch.current.name"
+    }
+}
+
+task updateVersionProperties(dependsOn: [assumesPropsSet, createReleaseBranch]) {
+    group = "Pre-vote phase"
+    description = "Promotes versions to non SNAPSHOT in gradle.properties and commits the result"
+    doLast {
+        def propsFile = file("$stagingDir/gradle.properties")
+        def propsText = propsFile.text
+        propsText = propsText.replace(numVersion + '-SNAPSHOT', relVersion)
+        propsText = propsText.replace(numVersion + '.SNAPSHOT', relVersion)
+        propsFile.text = propsText
+        def grgit = grgitClass.open(dir: stagingDir)
+        grgit.add(patterns: ['gradle.properties'])
+        def commit = grgit.commit(message: "Release $relVersion: update versions")
+        println "@ $commit.abbreviatedId ($commit.shortMessage)"
+    }
+}
+[jiraPrecheck, createReleaseBranch, updateVersionProperties]*.onlyIf {
+    project.hasProperty('releaseBuild') && releaseBuild
+}
+
+// use Exec rather the GradleBuild to ensure we use the correct gradle version for the groovy version being built
+task buildAndUpload(type: Exec, dependsOn: [assumesPropsSet, updateVersionProperties, checkCompatibility]) {
+    group = "Pre-vote phase"
+    description = "Builds Apache Groovy and publishes the Maven artifacts to the staging repository on Bintray"
+    workingDir stagingDir
+    ext.theArgs = []
+    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        theArgs += ['cmd', '/C', 'gradlew.bat']
+    } else {
+        theArgs << './gradlew'
+    }
+    theArgs << "-PartifactoryContext=https://groovy.jfrog.io/groovy/"
+    theArgs << "-PartifactoryRepoKey=${releaseBuild ? 'libs-release-local' : 'libs-snapshot-local'}"
+    theArgs += ['install', 'dist', 'artifactoryPublish']
+    commandLine theArgs
+}
+
+task cleanSvnDevWorkspace(type: Delete, dependsOn: [assumesBranch, buildAndUpload]) {
+    delete devWorkspaceRoot
+}
+
+task prepareSvnDevWorkspace(type: SvnCheckout, dependsOn: [assumesBranch, cleanSvnDevWorkspace]) {
+    svnUrl = "https://dist.apache.org/repos/dist/dev/groovy"
+    workspaceDir = devWorkspaceRoot
+    depth = SvnDepth.FILES // slightly more efficient if we have two concurrent releases (e.g. 2.4.latest, 2.5.0)
+}
+
+task copySvnDistro(type: Copy, dependsOn: [assumesPropsSet, prepareSvnDevWorkspace]) {
+    description = "Creates the required tree structure for distribution"
+    from("$stagingDir/target/distributions")
+    into "$devWorkspace/distribution"
+    exclude 'apache-groovy-src-*'
+}
+
+task copySvnSources(type: Copy, dependsOn: [assumesPropsSet, prepareSvnDevWorkspace]) {
+    description = "Creates the required tree structure for sources"
+    from("$stagingDir/target/distributions")
+    into "$devWorkspace/sources"
+    include 'apache-groovy-src-*'
+}
+
+task createChecksums(dependsOn: [assumesPropsSet, copySvnDistro, copySvnSources]) {
+    group = "Pre-vote phase"
+    description = "Creates SHA-256 checksums for all artifacts"
+    doLast {
+        fileTree(devWorkspace).files.each { File f ->
+            if (f.name.toLowerCase().endsWith('.zip')) {
+                ant.checksum file: f, algorithm: 'SHA-256', fileext: '.sha256'
+            }
+        }
+    }
+}
+
+task addSvnDevFiles(type: SvnAdd, dependsOn: [assumesPropsSet, createChecksums]) {
+    description = "Adds the changed files to svn"
+    add devWorkspace
+    recursive true
+}
+
+task commitAddToDevSvn(type: SvnCommit, dependsOn: [assumesPropsSet, addSvnDevFiles]) {
+    source << devWorkspace
+    recursive = true
+    commitMessage = "New version $branch $relVersion added to staging area"
+}
+
+task checkDevWorkspaceVersion(type: SvnVersion, dependsOn: [assumesPropsSet, commitAddToDevSvn]) {
+    sourcePath = devWorkspace
+    doLast {
+        def f = new File(devWorkspace)
+        println "SvnVersion: build/${f.parentFile.name}/${f.name} at r" + svnVersion.maxRevisionNumber
+    }
+}
+
+task createAndPushTag(dependsOn: [assumesPropsSet, checkDevWorkspaceVersion]) {
+    group = "Pre-vote phase"
+    description = "Creates a release tag and pushes it to the Apache Git repository"
+    doLast {
+        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) {
+        }
+        if (project.hasProperty('skipTag')) {
+            assert tag, "Tag $tagName is supposed to exist but doesn't!"
+        } else {
+            assert !tag, "Tag $tagName already found!"
+            tag = grgit.tag.add(name: tagName,
+                    message: "Release Groovy $relVersion",
+                    tagger: new Person(apacheUser, apacheUser + '@apache.org')
+            )
+        }
+        project.ext.tagId = tag.commit.id
+        grgit.push(tags: true)
+    }
+}
+
+task releaseOnJira(dependsOn: [assumesRelVersion, jiraPrecheck, createAndPushTag]) {
+    group = "Pre-vote phase"
+    description = "Releases the version on JIRA"
+    doLast {
+        def jira = new RESTClient('https://issues.apache.org/jira/rest/api/2/')
+        jira.headers['Authorization'] = 'Basic ' + "$apacheUser:$apachePassword".getBytes('iso-8859-1').encodeBase64()
+        def resp = jira.put(
+                path: "version/$versionId",
+                body: /{ "released": true, "releaseDate": "$now" }/,
+                requestContentType: JSON
+        )
+        assert resp.status == 200
+    }
+}
+
+task prepareVoteThread(dependsOn: [assumesPropsSet, releaseOnJira]) {
+    group = "Pre-vote phase"
+    description = "Generates a [VOTE] thread to be tweaked and sent to the dev@ mailing list"
+    doLast {
+        println """
+Below is a template email to tweak and send to the dev@ mailing list as a [VOTE] thread.
+If the vote passes after 72h, proceed with phase2.
+If the vote fails or the release is cancelled, manually unrelease the version from Jira and start again.
+
+---------------- >8 -----------------
+
+Dear community,
+
+I am happy to start the VOTE thread for a Groovy $relVersion release!
+
+This release includes $fixCount bug fixes/improvements as outlined in the changelog:
+https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=$projectId&version=$versionId
+
+Tag: $repoBase?p=groovy.git;a=tag;h=refs/tags/GROOVY_$underVersion
+Tag commit id: $tagId
+
+The artifacts to be voted on are located as follows (r$svnVersion.maxRevisionNumber).
+Source release: https://dist.apache.org/repos/dist/dev/groovy/$relVersion/sources
+Convenience binaries: https://dist.apache.org/repos/dist/dev/groovy/$relVersion/distribution
+
+Release artifacts are signed with a key from the following file:
+https://dist.apache.org/repos/dist/dev/groovy/KEYS
+
+Please vote on releasing this package as Apache Groovy $relVersion.
+
+The vote is open for the next 72 hours and passes if a majority of at least three +1 PMC votes are cast.
+
+[ ] +1 Release Apache Groovy $relVersion
+[ ]  0 I don't have a strong opinion about this, but I assume it's ok
+[ ] -1 Do not release Apache Groovy $relVersion because...
+
+Here is my vote:
+
++1 (binding)
+
+---------------- >8 -----------------
+"""
+    }
+}
+
+[createAndPushTag, releaseOnJira, prepareVoteThread]*.onlyIf { project.hasProperty('releaseBuild') && releaseBuild }

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle/phase2.gradle
----------------------------------------------------------------------
diff --git a/gradle/phase2.gradle b/gradle/phase2.gradle
new file mode 100644
index 0000000..e19848b
--- /dev/null
+++ b/gradle/phase2.gradle
@@ -0,0 +1,444 @@
+import at.bxm.gradleplugins.svntools.api.SvnDepth
+import at.bxm.gradleplugins.svntools.tasks.SvnAdd
+import at.bxm.gradleplugins.svntools.tasks.SvnCheckout
+import at.bxm.gradleplugins.svntools.tasks.SvnCommit
+import at.bxm.gradleplugins.svntools.tasks.SvnDelete
+import groovyx.net.http.RESTClient
+import org.ajoberstar.grgit.Credentials
+
+import static groovyx.net.http.ContentType.*
+
+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 "org.codehaus.groovy.modules.http-builder:http-builder:${getProperty('version.httpbuilder')}"
+        classpath "org.hidetake:gradle-ssh-plugin:${getProperty('version.sshplugin')}"
+        classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:${getProperty('version.sdkmanplugin')}"
+    }
+}
+
+apply plugin: "at.bxm.svntools"
+apply plugin: "org.hidetake.ssh"
+apply plugin: "io.sdkman.vendors"
+
+svntools {
+    username = apacheUser
+    password = apachePassword
+}
+
+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')
+    }
+}
+
+sdkman {
+    api = "https://vendors.sdkman.io/"
+    consumerKey = findProperty('gvm.consumerKey')
+    consumerToken = findProperty('gvm.consumerPassword')
+    candidate = "groovy"
+    version = "$relVersion"
+    url = "http://dl.bintray.com/groovy/maven/apache-groovy-sdk-${relVersion}.zip"
+    hashtag = "#groovylang"
+}
+
+task jiraCheckPhase2(dependsOn: assumesRelVersion) {
+    doLast {
+        def jira = new RESTClient('https://issues.apache.org/jira/rest/api/2/')
+//        jira.headers['Authorization'] = 'Basic ' + "$apacheUser:$apachePassword".getBytes('iso-8859-1').encodeBase64()
+        def resp = jira.get(path: 'project/GROOVY/versions')
+        assert resp.status == 200
+        def versionFields = resp.data.find { it.name == relVersion }
+        assert versionFields, "Version $relVersion not found in Jira!"
+        assert versionFields.released, "Version $relVersion not yet released!"
+        project.ext.versionId = versionFields.id
+        project.ext.projectId = versionFields.projectId
+
+        resp = jira.get(path: "version/$versionId/unresolvedIssueCount")
+        assert resp.data
+        if (resp.data.issuesUnresolvedCount) {
+            logger.warn "Warning found $resp.data.issuesUnresolvedCount unresolved issues for version $relVersion"
+        }
+        resp = jira.get(path: "version/$versionId/relatedIssueCounts")
+        assert resp.data
+        project.ext.fixCount = resp.data.issuesFixedCount
+    }
+}
+
+task promoteOnBintray(dependsOn: jiraCheckPhase2) {
+    group = "Post-passed phase"
+    description = "Releases the version on Bintray"
+    doLast {
+        def artifactory = new RESTClient('https://groovy.jfrog.io/groovy/')
+        artifactory.headers['Authorization'] = 'Basic ' + "$artifactoryUser:$artifactoryPassword".getBytes('iso-8859-1').encodeBase64()
+        def resp = artifactory.get(path: 'api/build/groovy', contentType: JSON)
+        assert resp.status == 200
+        // sort to minimise work - normally we want the last started
+        def builds = resp.data.buildsNumbers.sort{ it.started }.reverse()
+        // check version - in case we are releasing multiple builds at the one time
+        println "----------------"
+        def build = builds.find {
+            resp = artifactory.get(path: 'api/build/groovy/' + it.uri, contentType: JSON)
+            assert resp.status == 200
+            def coreModuleId = resp.data.buildInfo.modules*.id.find{ it.startsWith('org.codehaus.groovy:groovy:') }
+            def found = coreModuleId?.endsWith(':' + relVersion)
+            println "${found ? 'FOUND' : 'SKIPPING'} $coreModuleId @ ${it.uri}"
+            found
+        }
+        println "----------------"
+        assert build, "No build matching $relVersion found in artifactory"
+        def buildNum = build.uri[1..-1]
+        def body = /{
+            "dryRun" : ${project.hasProperty('dryRun').toString()},
+            "publish" : true,
+            "async" : false,
+            "targetRepo" : "distribution-repo",
+            "sourceRepos" : ["libs-release-local"]
+        }/
+        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
+    }
+}
+
+task synchronizeWithMavenCentral(dependsOn: promoteOnBintray) {
+    group = "Post-passed phase"
+    description = "Syncs with Maven Central/Sonatype"
+    doLast {
+        def bintray = new RESTClient('https://api.bintray.com/maven_central_sync/groovy/maven/')
+        bintray.headers['Authorization'] = 'Basic ' + "$bintrayUser:$bintrayPassword".getBytes('iso-8859-1').encodeBase64()
+        def body = /{
+            "username" : "${project.findProperty('centralUser')}",
+            "password" : "${project.findProperty('centralKey')}"
+        }/
+        def resp = bintray.post(
+                path: "groovy/versions/$relVersion",
+                body: body,
+                requestContentType: JSON
+        )
+        assert resp.status == 200
+        println resp.data.status
+        println resp.data.messages.join('\n')
+    }
+}
+
+// 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:$bintrayPassword".getBytes('iso-8859-1').encodeBase64()
+        fileTree("$stagingDir/target/distributions").files.each { File f ->
+            println "Uploading $f.name"
+            def resp = bintray.put(
+                    path: "groovy/$version/${f.name}",
+                    body: f.bytes,
+                    requestContentType: BINARY
+            )
+            assert resp.status == 201
+        }
+        println "Zips uploaded! Please release manually."
+        // TODO automate release
+    }
+}
+
+
+task cleanSvnReleaseWorkspace(type: Delete, dependsOn: [assumesRelVersion, synchronizeWithMavenCentral, publishZipsOnBintray]) {
+    delete releaseWorkspaceRoot
+}
+
+task prepareSvnReleaseWorkspace(type: SvnCheckout, dependsOn: cleanSvnReleaseWorkspace) {
+    svnUrl = "https://dist.apache.org/repos/dist/release/groovy"
+    workspaceDir = releaseWorkspaceRoot
+    depth = SvnDepth.FILES // slightly more efficient if we have two concurrent releases (e.g. 2.4.latest, 2.5.0)
+}
+
+task copyReleaseArtifacts(type: Copy, dependsOn: prepareSvnReleaseWorkspace) {
+    description = "Copies all files from DEV to RELEASE"
+    from(devWorkspace)
+    into releaseWorkspace
+}
+
+task addSvnReleaseFiles(type: SvnAdd, dependsOn: copyReleaseArtifacts) {
+    description = "Adds the changed files to dist svn"
+    add releaseWorkspace
+    recursive true
+}
+
+task deleteSvnDevFiles(type: SvnDelete, dependsOn: addSvnReleaseFiles) {
+    description = "Deletes the changed files to svn"
+    delete devWorkspace
+}
+
+task commitDeleteFromDevSvn(type: SvnCommit, dependsOn: deleteSvnDevFiles) {
+    description = "Deletes the version from the DEV staging area"
+    source << devWorkspaceRoot
+    recursive = true
+    commitMessage = "Deleting version $relVersion from the DEV staging area"
+}
+
+task commitAddToReleaseSvn(type: SvnCommit, dependsOn: addSvnReleaseFiles) {
+    source << releaseWorkspace
+    recursive = true
+    commitMessage = "Releasing version $relVersion"
+}
+
+task uploadToApacheReleaseServer(dependsOn: [commitDeleteFromDevSvn, commitAddToReleaseSvn]) {
+    // svntools has no move so add and delete explicitly
+    group = "Post-passed phase"
+    description = "Moves the artifacts from the DEV svn repo to the RELEASE svn repo"
+}
+
+task uploadDocumentationToGroovyWebsite(dependsOn: uploadToApacheReleaseServer) {
+    group = "Post-passed phase"
+    description = "Uploads the documentation to the Groovy website server"
+    doLast {
+        ssh.run {
+            session(remotes.ciServer) {
+                execute 'uname -a'
+                put from: "$stagingDir/target/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 "chgrp -R teamcity /var/www/docs/docs/groovy-${relVersion}/"
+                execute "rm /var/www/docs/docs/apache-groovy-docs-${relVersion}.zip"
+            }
+        }
+    }
+}
+
+task checkoutGroovyWebsite(dependsOn: uploadDocumentationToGroovyWebsite) {
+    group = "Post-passed phase"
+    description = "Checks out the Groovy website repository"
+    doLast {
+        if (!project.hasProperty('skipClone')) {
+            println "Cloning $websiteRepo to $stagingWebsiteDir. This may take a few minutes ..."
+            grgitClass.clone(dir: stagingWebsiteDir, uri: websiteRepo)
+        }
+    }
+}
+
+task findGroovyVersions(dependsOn: checkoutGroovyWebsite) {
+    doLast {
+        def sitemapFile = file("$stagingWebsiteDir/site/src/site/sitemap.groovy")
+        def matcher = sitemapFile.text =~ /(?ism).*groovyDocumentationVersions\(([^)]*)\).*/
+        assert matcher[0]
+        rootProject.ext.versionsText = matcher[0][1]
+        def majorMinor = { String s -> s.split(/\./).with{ it[0].toInteger() * 100 + it[1].toInteger() } }
+        def versions = Eval.me(versionsText)
+        def relMajorMinor = majorMinor(relVersion)
+        rootProject.ext.foundNewer = versions.findAll{ !(it.contains('alpha') || it.contains('beta') || it.contains('rc')) }.collect{ majorMinor(it) }.any{ it > relMajorMinor }
+        rootProject.ext.newDefault = project.hasProperty('forceDefault') ||
+                (!project.hasProperty('skipDefault') && stableBuild && !foundNewer)
+    }
+}
+
+task maybeUpdateDocumentationSymlink(dependsOn: findGroovyVersions) {
+    group = "Post-passed phase"
+    description = "Changes the symlink to the latest documentation if and only if it's a stable release"
+    doLast {
+        // TODO work out unix group permissions - currently might require manual chown/chgrp fix ups
+        ssh.run {
+            session(remotes.ciServer) {
+                execute 'uname -a'
+                execute "cd /var/www/docs/docs; ln -s -f -T groovy-$relVersion latest"
+                execute "chgrp -h teamcity /var/www/docs/docs/latest"
+//                execute "chown -h teamcity /var/www/docs/docs/latest"
+            }
+        }
+    }
+}
+maybeUpdateDocumentationSymlink.onlyIf{ newDefault }
+
+task updateGroovySitemap(dependsOn: findGroovyVersions) {
+    group = "Post-passed phase"
+    description = "Updates sitemap.groovy to include the newly released version and commits the result"
+    doLast {
+        def sitemapFile = file("$stagingWebsiteDir/site/src/site/sitemap.groovy")
+        def sitemapText = sitemapFile.text
+        def newText = newRelease ? versionsText.replaceFirst(/(?sm)'\s*\]/, "',\n            '$relVersion'\n    \\]")
+                : versionsText.replaceFirst(/(?sm)(.*)('$baseVersion'[',. 0-9]*)/, "\$1\$2, '$relVersion'")
+        sitemapText = sitemapText.replace(versionsText, newText)
+        // TODO add download distributions section ...
+        sitemapFile.text = sitemapText
+    }
+}
+updateGroovySitemap.onlyIf{ stableBuild }
+
+task pushGroovyWebsite(dependsOn: updateGroovySitemap) {
+    group = "Post-passed phase"
+    description = "Pushes the Groovy website so that the new website is published"
+    doLast {
+        def githubCredentials = new Credentials(username: githubUser, password: githubPassword)
+        def grgit = grgitClass.open(dir: stagingWebsiteDir, creds: githubCredentials)
+        grgit.add(patterns: ['sitemap.groovy'])
+        def commit = grgit.commit(message: "Release $relVersion: update sitemap")
+        println "@ $commit.abbreviatedId ($commit.shortMessage)"
+        grgit.push()
+    }
+}
+pushGroovyWebsite.onlyIf{ stableBuild }
+
+task waitForWebsitePublication(dependsOn: pushGroovyWebsite) {
+    group = "Post-passed phase"
+    description = "Polls the Groovy website to check if it is released"
+    doLast {
+        def found = false
+        def delay = 30000 // 1/2 a minute
+        def numTries = 60 // wait for up to 30 mins
+        while (!found && numTries-- > 0) {
+            def groovysite = new RESTClient('http://groovy-lang.org/')
+            def resp = groovysite.get(path: "changelogs/changelog-${relVersion}.html")
+            if (resp.status == 200 && !resp.data.text().contains('Oops!')) {
+                found = true
+            } else {
+                sleep delay
+            }
+        }
+        assert found, 'Timed out waiting for website to be published - please check manually'
+    }
+}
+waitForWebsitePublication.onlyIf{ stableBuild }
+
+task publishToSDKman(dependsOn: [waitForWebsitePublication, maybeUpdateDocumentationSymlink, sdkReleaseVersion]) {
+    group = "Post-passed phase"
+    description = "Publishes the release on SDKman"
+}
+
+task makeDefaultOnSDKman(dependsOn: [publishToSDKman, sdkDefaultVersion]) {
+    group = "Post-passed phase"
+    description = "Make it the default version on SDKman"
+}
+makeDefaultOnSDKman.onlyIf{ rootProject.ext.newDefault }
+sdkDefaultVersion.onlyIf{ rootProject.ext.newDefault }
+
+task createNextVersionInJira(dependsOn: [makeDefaultOnSDKman, jiraCheckPhase2]) {
+    group = "Post-passed phase"
+    description = "Make sure that Jira is ready for the next version on this branch"
+    doLast {
+        def jira = new RESTClient('https://issues.apache.org/jira/rest/api/2/')
+        def resp = jira.get(path: 'project/GROOVY/versions')
+        assert resp.status == 200
+        def versionFields = resp.data.find { it.name == nextVersion }
+        if (versionFields) {
+            println "Version $nextVersion already found in Jira!"
+        } else {
+            jira.headers['Authorization'] = 'Basic ' + "$apacheUser:$apachePassword".getBytes('iso-8859-1').encodeBase64()
+            def body = /{ "name": "$nextVersion", "project": "GROOVY", "projectId": $projectId }/
+            resp = jira.post(path: "version", body: body, requestContentType: JSON)
+            assert resp.status == 201
+        }
+    }
+}
+
+task bumpVersionInGit(dependsOn: createNextVersionInJira) {
+    group = "Post-passed phase"
+    description = "The version in the gradle.properties file in the branch repo should be bumped"
+    doLast {
+        // TODO should this handle beta-1 => beta-2, rc-1 => rc-2 etc.
+        def apacheCredentials = new Credentials(username: apacheUser, password: apachePassword)
+        def grgit = grgitClass.open(dir: stagingDir, creds: apacheCredentials)
+        grgit.checkout(branch: branch)
+        def propsFile = file("$stagingDir/gradle.properties")
+        def propsText = propsFile.text
+        propsText = propsText.replace(numVersion + '-SNAPSHOT', nextVersion + '-SNAPSHOT')
+        propsText = propsText.replace(numVersion + '.SNAPSHOT', nextVersion + '.SNAPSHOT')
+        propsFile.text = propsText
+        grgit.add(patterns: ['gradle.properties'])
+        def commit = grgit.commit(message: "Bump version on $branch branch")
+        println "@ $commit.abbreviatedId ($commit.shortMessage)"
+        grgit.push()
+    }
+}
+
+task proposeAnnouncementEmail(dependsOn: [bumpVersionInGit, jiraCheckPhase2]) {
+    group = "Post-passed phase"
+    description = "Generates an [ANNOUNCE] thread to be tweaked and sent to the dev@, user@ and announce@ mailing lists"
+    doLast {
+        def securityFix = project.hasProperty('securityFix')
+        println """"
+Below is a template email to tweak and send to the dev@, user@ and announce@ mailing lists as an [ANNOUNCE] thread.
+
+---------------- >8 -----------------
+
+Dear community,
+
+The Apache Groovy team is pleased to announce version $relVersion of Apache Groovy.
+Apache Groovy is a multi-facet programming language for the JVM.
+Further details can be found at the http://groovy.apache.org website.
+
+${ stableBuild ?
+    (newRelease ?
+        '''We are sure you'll enjoy the features in this new version of Groovy.
+Your feedback on any unintentional glitches is welcome.'''
+        : """This release is a maintenance release of the $branch branch.
+It is strongly encouraged that all users using prior
+versions on this branch upgrade to this version.""")
+    : '''This is a pre-release of a new version of Groovy.
+We greatly appreciate any feedback you can give us when using this version.'''
+}
+${securityFix ? '''
+This release contains critical security fixes.
+Details can be found on http://groovy-lang.org/security.html
+''' : '' }
+This release includes $fixCount bug fixes/improvements as outlined in the changelog:
+https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=$projectId&version=$versionId
+
+Sources can be downloaded from: http://www.groovy-lang.org/download.html
+Convenience binaries, SDK and documentation can be found at: http://www.groovy-lang.org/download.html
+Jars are also available within the major binary repositories.
+We would like to thank all people who contributed to this release.
+
+We welcome your help and feedback. For more information on how to
+report problems, and to get involved, visit the project website at
+https://groovy.apache.org/
+
+Best regards,
+
+The Apache Groovy team.
+"""
+    }
+}
+
+task promptForReleaseUpdater(dependsOn: proposeAnnouncementEmail) {
+    group = "Post-passed phase"
+    description = "Prompts the release manager to update the Apache Release info system"
+    doLast {
+        println '''
+If you are a PMC member of this project, we ask that you log on to:
+https://reporter.apache.org/addrelease.html?groovy
+and add your release data (version and date) to the database.
+If you are not a PMC member, please have a PMC member add this information.
+'''
+    }
+}
+
+task announceReleaseOnSDKman(dependsOn: [promptForReleaseUpdater, sdkAnnounceVersion]) {
+    group = "Post-passed phase"
+    description = "Announces the release on SDKman"
+}
+
+

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle/wrapper/gradle-wrapper.jar
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..51288f9
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..bea3a6d
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Dec 11 19:57:38 AEST 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradlew
----------------------------------------------------------------------
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..4453cce
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save ( ) {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/gradlew.bat
----------------------------------------------------------------------
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

http://git-wip-us.apache.org/repos/asf/groovy-release/blob/f717b233/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..85343d0
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,19 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+rootProject.name = 'groovy-release'