You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2018/04/27 16:30:30 UTC
kudu git commit: [Java] Check in the Gradle wrapper properties
Repository: kudu
Updated Branches:
refs/heads/master bf9e30578 -> 08287b032
[Java] Check in the Gradle wrapper properties
We were downloading the properties file, but that can result in
using an outdated Gradle wrapper distribution.
This changes .gitignore so the generated
gradle-wrapper.properties file is checked in anytime
we change the gradle verison and updates wrapper.gradle
to add a license to the header.
I also added the silent (-s) flag to the curl command
when downloading the jar to remove some noise from
the log.
Change-Id: I3a772d5e093be29fcbabcbd8324bd6434fb33beb
Reviewed-on: http://gerrit.cloudera.org:8080/10215
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/08287b03
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/08287b03
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/08287b03
Branch: refs/heads/master
Commit: 08287b032278adf53e9d954d8f308bfa6b5a126f
Parents: bf9e305
Author: Grant Henke <gr...@apache.org>
Authored: Wed Apr 25 21:46:36 2018 -0500
Committer: Grant Henke <gr...@apache.org>
Committed: Fri Apr 27 16:28:57 2018 +0000
----------------------------------------------------------------------
java/.gitignore | 2 +-
java/gradle/wrapper.gradle | 59 +++++++++++++---------
java/gradle/wrapper/gradle-wrapper.properties | 19 +++++++
java/gradlew | 6 +--
4 files changed, 56 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/08287b03/java/.gitignore
----------------------------------------------------------------------
diff --git a/java/.gitignore b/java/.gitignore
index 202e5f5..865e93d 100644
--- a/java/.gitignore
+++ b/java/.gitignore
@@ -28,7 +28,7 @@ dependency-reduced-pom.xml
# Gradle build artifacts
.gradle
build
-gradle/wrapper
+gradle/wrapper/*.jar
# IntelliJ
*.ipr
http://git-wip-us.apache.org/repos/asf/kudu/blob/08287b03/java/gradle/wrapper.gradle
----------------------------------------------------------------------
diff --git a/java/gradle/wrapper.gradle b/java/gradle/wrapper.gradle
index aaa059c..f442f15 100644
--- a/java/gradle/wrapper.gradle
+++ b/java/gradle/wrapper.gradle
@@ -24,6 +24,21 @@ task wrapper(type: Wrapper) {
gradleVersion = versions.gradle
}
+def licenseString = """#
+# Copyright 2017 the original author or authors.
+#
+# 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."""
+
// Custom task to inject support for downloading the gradle wrapper jar if it doesn't exist.
// This allows us to avoid checking in the jar to our repository.
// Additionally adds a license header to the wrapper while editing the file contents.
@@ -32,42 +47,20 @@ task bootstrapWrapper() {
doLast {
def wrapperBasePath = "\$APP_HOME/gradle/wrapper"
def wrapperJarPath = wrapperBasePath + "/gradle-wrapper.jar"
- def wrapperPropertiesPath = wrapperBasePath + "/gradle-wrapper.properties"
// Add a trailing zero to the version if needed.
def fullVersion = versions.gradle.count(".") == 1 ? "${versions.gradle}.0" : versions.gradle
// Leverages the wrapper jar checked into the gradle project on github because the jar isn't available elsewhere.
def wrapperBaseUrl = "https://raw.githubusercontent.com/gradle/gradle/v$fullVersion/gradle/wrapper"
def wrapperJarUrl = wrapperBaseUrl + "/gradle-wrapper.jar"
- def wrapperPropertiesUrl = wrapperBaseUrl + "/gradle-wrapper.properties"
def bootstrapString = """
- mkdir -p $wrapperBasePath
if [ ! -e $wrapperJarPath ]; then
- curl -o $wrapperJarPath $wrapperJarUrl
- fi
- if [ ! -e $wrapperPropertiesPath ]; then
- curl -o $wrapperPropertiesPath $wrapperPropertiesUrl
+ curl -s -o $wrapperJarPath $wrapperJarUrl
fi
""".stripIndent()
- def licenseString = """
- #
- # Copyright 2017 the original author or authors.
- #
- # 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.""".stripIndent()
-
- def wrapperScript = file("$rootDir/gradlew")
+ def wrapperScript = wrapper.scriptFile
def wrapperLines = wrapperScript.readLines()
wrapperScript.withPrintWriter { out ->
def licenseWritten = false
@@ -81,6 +74,7 @@ task bootstrapWrapper() {
out.print(line)
// Print the licence after the shebang.
if(!licenseWritten && line.contains("#!/usr/bin/env sh")) {
+ out.println()
out.print(licenseString)
licenseWritten = true
}
@@ -91,6 +85,23 @@ task bootstrapWrapper() {
}
wrapper.finalizedBy bootstrapWrapper
+// Custom task to add a license header to the gradle-wrapper.properties file.
+task bootstrapWrapperProperties() {
+ // In the doLast block so this runs when the task is called and not during project configuration.
+ doLast {
+ def wrapperProperties = wrapper.propertiesFile
+ def wrapperLines = wrapperProperties.readLines()
+ wrapperProperties.withPrintWriter { out ->
+ // Print the license
+ out.println(licenseString)
+ wrapperLines.each { line ->
+ out.println(line)
+ }
+ }
+ }
+}
+wrapper.finalizedBy bootstrapWrapperProperties
+
// Remove the generated batch file since we don't test building in the Windows environment.
task removeWindowScript(type: Delete) {
delete "$rootDir/gradlew.bat"
http://git-wip-us.apache.org/repos/asf/kudu/blob/08287b03/java/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..48a9df4
--- /dev/null
+++ b/java/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,19 @@
+#
+# Copyright 2017 the original author or authors.
+#
+# 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.
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
http://git-wip-us.apache.org/repos/asf/kudu/blob/08287b03/java/gradlew
----------------------------------------------------------------------
diff --git a/java/gradlew b/java/gradlew
index 1e49e3a..5cab7c0 100755
--- a/java/gradlew
+++ b/java/gradlew
@@ -79,12 +79,8 @@ case "`uname`" in
esac
-mkdir -p $APP_HOME/gradle/wrapper
if [ ! -e $APP_HOME/gradle/wrapper/gradle-wrapper.jar ]; then
- curl -o $APP_HOME/gradle/wrapper/gradle-wrapper.jar https://raw.githubusercontent.com/gradle/gradle/v4.7.0/gradle/wrapper/gradle-wrapper.jar
-fi
-if [ ! -e $APP_HOME/gradle/wrapper/gradle-wrapper.properties ]; then
- curl -o $APP_HOME/gradle/wrapper/gradle-wrapper.properties https://raw.githubusercontent.com/gradle/gradle/v4.7.0/gradle/wrapper/gradle-wrapper.properties
+ curl -s -o $APP_HOME/gradle/wrapper/gradle-wrapper.jar https://raw.githubusercontent.com/gradle/gradle/v4.7.0/gradle/wrapper/gradle-wrapper.jar
fi
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar