Skip to content

Commit

Permalink
Update to Gradle 6.8 and clean up (#3768)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romitou authored Feb 28, 2021
1 parent fd86bf3 commit f639b68
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 297 deletions.
377 changes: 143 additions & 234 deletions build.gradle

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
groupid=ch.njol
name=skript
version=2.5.3
jarName=Skript.jar
testEnv=paper-1.16.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
53 changes: 33 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -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
#
# 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.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -66,6 +82,7 @@ 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
Expand Down Expand Up @@ -109,10 +126,11 @@ 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"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $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" ;;
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

Expand All @@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
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" "$@"
43 changes: 24 additions & 19 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -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 https://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
Expand All @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@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

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -45,28 +64,14 @@ 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%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'Skript'
include 'skript-worldguard6'
include 'skript-worldguard6'
3 changes: 1 addition & 2 deletions skript-worldguard6/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies {
implementation 'com.sk89q:worldguard:6.1.1-SNAPSHOT'
}

sourceCompatibility = 1.8
jar {
archiveName 'Skript-worldguard6.jar'
}
}
14 changes: 7 additions & 7 deletions src/main/java/ch/njol/skript/variables/Variables.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ private Variables() {}
}

@SuppressWarnings("unchecked")
private final void init() {
private void init() {
// used by asserts
info = (ClassInfo<? extends ConfigurationSerializable>) Classes.getExactClassInfo(Object.class);
info = (ClassInfo<? extends ConfigurationSerializable>) (ClassInfo<?>) Classes.getExactClassInfo(Object.class);
}

@SuppressWarnings({"unchecked"})
Expand Down Expand Up @@ -291,7 +291,7 @@ static Lock getReadLock() {
* Returns the internal value of the requested variable.
* <p>
* <b>Do not modify the returned value!</b>
*
*
* @param name
* @return an Object for a normal Variable or a Map<String, Object> for a list variable, or null if the variable is not set.
*/
Expand All @@ -315,7 +315,7 @@ public static Object getVariable(final String name, final @Nullable Event e, fin
return change.value;
}
}

try {
variablesLock.readLock().lock();
return variables.getVariable(n);
Expand All @@ -327,7 +327,7 @@ public static Object getVariable(final String name, final @Nullable Event e, fin

/**
* Sets a variable.
*
*
* @param name The variable's name. Can be a "list variable::*" (<tt>value</tt> must be <tt>null</tt> in this case)
* @param value The variable's value. Use <tt>null</tt> to delete the variable.
*/
Expand Down Expand Up @@ -433,7 +433,7 @@ static void processChangeQueue() {
* Must be called on Bukkit's main thread.
* <p>
* This method directly invokes {@link VariablesStorage#save(String, String, byte[])}, i.e. you should not be holding any database locks or such when calling this!
*
*
* @param name
* @param value
* @param source
Expand Down Expand Up @@ -484,7 +484,7 @@ else if (loadConflicts == MAX_CONFLICT_WARNINGS + 1)

/**
* Stores loaded variables into the variables map and the appropriate databases.
*
*
* @return How many variables were not stored anywhere
*/
@SuppressWarnings("null")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/util/coll/BidiHashMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public Set<T2> valueSet() {

@Override
public BidiHashMap<T1, T2> clone() {
return new BidiHashMap<>(this);
return new BidiHashMap<T1, T2>(this);
}

}
24 changes: 12 additions & 12 deletions src/main/java/ch/njol/yggdrasil/PseudoEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* furthermore a constant can be assigned to any number of fields.
* <p>
* This class defines methods similar to those in {@link Enum} with minor differences, e.g. {@link #values()} returns a {@link List} instead of an array.
*
*
* @author Peter Güttinger
*/
@ThreadSafe
Expand All @@ -56,7 +56,7 @@ public abstract class PseudoEnum<T extends PseudoEnum<T>> {
@SuppressWarnings("unchecked")
protected PseudoEnum(final String name) throws IllegalArgumentException {
this.name = name;
info = getInfo(getClass());
info = (Info<T>) getInfo(getClass());
info.writeLock.lock();
try {
if (info.map.containsKey(name))
Expand All @@ -71,7 +71,7 @@ protected PseudoEnum(final String name) throws IllegalArgumentException {

/**
* Returns the unique name of this constant.
*
*
* @return The unique name of this constant.
* @see Enum#name()
*/
Expand All @@ -81,7 +81,7 @@ public final String name() {

/**
* Returns {@link #name()}.
*
*
* @return {@link #name()}
* @see Enum#toString()
*/
Expand All @@ -93,7 +93,7 @@ public String toString() {
/**
* Returns the unique ID of this constant. This will not be used by Yggdrasil and can thus change freely across version, in particular reordering and inserting constants is
* permitted.
*
*
* @return The unique ID of this constant.
* @see Enum#ordinal()
*/
Expand All @@ -119,7 +119,7 @@ public final boolean equals(@Nullable final Object obj) {

/**
* Prevents cloning of pseudo-enums. If you want to make your enums cloneable, create a <tt>(name, constantToClone)</tt> constructor.
*
*
* @return newer returns normally
* @throws CloneNotSupportedException always
*/
Expand All @@ -131,18 +131,18 @@ protected final Object clone() throws CloneNotSupportedException {
/**
* Returns this constant's pseudo-enum class, i.e. the first non-anonymous superclass of this constant. This class is the same for all constants inheriting from a common class
* independently from whether they define an anonymous subclass.
*
*
* @return This constant's pseudo-enum class.
* @see Enum#getDeclaringClass()
*/
@SuppressWarnings("unchecked")
public final Class<T> getDeclaringClass() {
return getDeclaringClass(getClass());
return (Class<T>) getDeclaringClass(getClass());
}

/**
* Returns the common base class for constants of the given type, i.e. the first non-anonymous superclass of <tt>type</tt>.
*
*
* @return The pseudo-enum class of the given class.
* @see Enum#getDeclaringClass()
*/
Expand All @@ -159,7 +159,7 @@ public static <T extends PseudoEnum<T>> Class<? super T> getDeclaringClass(final
* The returned list is a copy of the internal list at the time this method was called.
* <p>
* Please note that you
*
*
* @return All constants registered so far.
* @see Enum#valueOf(Class, String)
*/
Expand All @@ -172,7 +172,7 @@ public final List<T> values() {
* c).
* <p>
* The returned list is a copy of the internal list at the time this method was called.
*
*
* @return All constants registered so far.
* @throws IllegalArgumentException If <tt>{@link #getDeclaringClass(Class) getDeclaringClass}(c) != c</tt> (i.e. if the given class is anonymous).
* @see Enum#valueOf(Class, String)
Expand All @@ -194,7 +194,7 @@ private static <T extends PseudoEnum<T>> List<T> values(final Class<T> c, final

/**
* Returns the constant with the given ID.
*
*
* @param id The constant's ID
* @return The constant with the given ID.
* @throws IndexOutOfBoundsException if ID is < 0 or >= {@link #numConstants()}
Expand Down

0 comments on commit f639b68

Please sign in to comment.