mirror of https://github.com/apache/kafka.git
MINOR: Remove unnecessary license generation code in wrapper.gradle (#7742)
Newer versions of Gradle handle this automatically. Tested with Gradle 5.6. Credit to @granthenke for the tip. Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
This commit is contained in:
parent
e057d61050
commit
45842a3962
|
@ -130,6 +130,7 @@ if (file('.git').exists()) {
|
|||
'PULL_REQUEST_TEMPLATE.md',
|
||||
'gradlew',
|
||||
'gradlew.bat',
|
||||
'gradle/wrapper/gradle-wrapper.properties',
|
||||
'TROGDOR.md',
|
||||
'**/README.md',
|
||||
'**/id_rsa',
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
#
|
||||
# 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-5.0-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2017 the original author or authors.
|
||||
# Copyright 2015 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
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
|
@ -42,7 +44,7 @@ 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='"-Xmx64m"'
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
@ -82,7 +84,7 @@ esac
|
|||
# Loop in case we encounter an error.
|
||||
for attempt in 1 2 3; do
|
||||
if [ ! -e $APP_HOME/gradle/wrapper/gradle-wrapper.jar ]; then
|
||||
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v5.0.0/gradle/wrapper/gradle-wrapper.jar"; then
|
||||
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v5.6.2/gradle/wrapper/gradle-wrapper.jar"; then
|
||||
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
||||
# Pause for a bit before looping in case the server throttled us.
|
||||
sleep 5
|
||||
|
@ -136,8 +138,8 @@ 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
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
|
|
@ -27,21 +27,6 @@ wrapper {
|
|||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -78,7 +63,6 @@ task bootstrapWrapper() {
|
|||
def wrapperScript = wrapper.scriptFile
|
||||
def wrapperLines = wrapperScript.readLines()
|
||||
wrapperScript.withPrintWriter { out ->
|
||||
def licenseWritten = false
|
||||
def bootstrapWritten = false
|
||||
wrapperLines.each { line ->
|
||||
// Print the wrapper bootstrap before the first usage of the wrapper jar.
|
||||
|
@ -87,36 +71,13 @@ task bootstrapWrapper() {
|
|||
bootstrapWritten = true
|
||||
}
|
||||
out.print(line)
|
||||
// Print the licence after the shebang.
|
||||
if(!licenseWritten && line.contains("#!/usr/bin/env sh")) {
|
||||
out.println()
|
||||
out.print(licenseString)
|
||||
licenseWritten = true
|
||||
}
|
||||
out.println() // New Line
|
||||
out.println()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 removeWindowsScript(type: Delete) {
|
||||
delete "$rootDir/gradlew.bat"
|
||||
|
|
Loading…
Reference in New Issue