diff --git a/.gitignore b/.gitignore index 0c05d76e..357cba91 100644 --- a/.gitignore +++ b/.gitignore @@ -67,12 +67,11 @@ gradle-app.setting # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar +!gradle-wrapper.properties # Cache of project .gradletasknamecache -# Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -gradle/wrapper/gradle-wrapper.properties diff --git a/build.gradle.kts b/build.gradle.kts index e9f50189..6b14db4f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,6 +16,8 @@ import Build_gradle.Extras.bcVersion import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask +import net.sf.json.JSONObject +import java.net.URL import java.time.Instant import java.util.* import kotlin.collections.component1 @@ -435,9 +437,35 @@ tasks.named("dependencyUpdates") { /////////////////////////////// ////// Gradle Wrapper Configuration. -///// Run this task, then refresh the gradle project +///// Run this task (GRADLE -> autoUpdateGradleWrapper), then refresh the gradle project /////////////////////////////// -task("wrapperUpdate") { - gradleVersion = "5.3" - distributionUrl = distributionUrl.replace("bin", "all") +task("autoUpdateGradleWrapper") { + group = "gradle" + outputs.upToDateWhen { false } + outputs.cacheIf { false } + + // always make sure this task when specified. ALWAYS skip for other tasks, Never skip for us. + // This is a little bit of a PITA, because of how gradle configures, then runs tasks... + if (gradle.startParameter.taskNames.contains("autoUpdateGradleWrapper")) { + finalizedBy(task("autoUpdateGradleWrapperDownloader") { + group = "gradle" + outputs.upToDateWhen { false } + outputs.cacheIf { false } + + val releaseText = URL("https://services.gradle.org/versions/current").readText() + val foundGradleVersion = JSONObject.fromObject(releaseText)["version"] as String? + + if (foundGradleVersion.isNullOrEmpty()) { + println("\tUnable to detect Newest Gradle Version. Output json: $releaseText") + } + else { + println("\tDetected Newest Gradle Version: '$foundGradleVersion'") + + finalizedBy(task("wrapperUpdate") { + gradleVersion = foundGradleVersion + distributionUrl = distributionUrl.replace("bin", "all") + }) + } + }) + } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..b8a51fe2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708ff..b0d6d0ab 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# 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 +# +# 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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,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" diff --git a/gradlew.bat b/gradlew.bat index 6d57edc7..9991c503 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome