Upgrade to gradle 4.0

- updated common functions into closures for exporting
This commit is contained in:
Connor Tumbleson 2017-07-03 07:16:53 -04:00
parent f8fe98d9a6
commit 988fd15f0a
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75
4 changed files with 33 additions and 32 deletions

View File

@ -14,36 +14,37 @@
* limitations under the License.
*/
gradle.allprojects {
def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 6
// https://gist.github.com/JonasGroeger/7620911
ext.getCheckedOutGitCommitHash = {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 6
def head
try {
head = new File(gitFolder + "HEAD").text.split(":")
} catch(Exception e) {
return null;
}
def isCommit = head.length == 1
if(isCommit) return head[0].trim().take(takeFromHash)
def refHead = new File(gitFolder + head[1].trim())
refHead.text.trim().take takeFromHash
def head
try {
head = new File(gitFolder + "HEAD").text.split(":")
} catch(Exception e) {
return null;
}
ext.getCheckedOutBranch = {
def gitFolder = "$projectDir/.git/"
def isCommit = head.length == 1
if(isCommit) return head[0].trim().take(takeFromHash)
def head
try {
head = new File(gitFolder + "HEAD").text.split("/")
return head[2].trim();
} catch(Exception e) {
return "SNAPSHOT";
}
def refHead = new File(gitFolder + head[1].trim())
refHead.text.trim().take takeFromHash
}
def getCheckedOutBranch() {
def gitFolder = "$projectDir/.git/"
def head
try {
head = new File(gitFolder + "HEAD").text.split("/")
return head[2].trim();
} catch(Exception e) {
return "SNAPSHOT";
}
}
ext {
getCheckedOutGitCommitHash = this.&getCheckedOutGitCommitHash
getCheckedOutBranch = this.&getCheckedOutBranch
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Mon Apr 24 12:27:08 SGT 2017
#Mon Jul 03 07:09:45 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip

6
gradlew vendored
View File

@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -155,7 +155,7 @@ if $cygwin ; then
fi
# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}