diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e2b11f47..1f8bd573 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,10 +9,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Set up JDK 1.16 + - name: Set up JDK 1.17 uses: actions/setup-java@v1 with: - java-version: 16 + java-version: 17 - uses: actions/cache@v2 with: path: | diff --git a/BlueMapAPI b/BlueMapAPI index 66ed276c..30bde97b 160000 --- a/BlueMapAPI +++ b/BlueMapAPI @@ -1 +1 @@ -Subproject commit 66ed276cc66a802b0a6967f277e60ffad8e13f05 +Subproject commit 30bde97bd9700ff412ab73911eb56b76c879b503 diff --git a/BlueMapCommon/build.gradle b/BlueMapCommon/build.gradle deleted file mode 100644 index cccc0aa3..00000000 --- a/BlueMapCommon/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id "com.github.node-gradle.node" version "3.0.1" -} - -dependencies { - api 'com.mojang:brigadier:1.0.17' - - api project(':BlueMapCore') - api project(':BlueMapAPI') - - testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' -} - -test { - useJUnitPlatform() -} - -node { - version = '14.16.1' - download = true - nodeProjectDir = file("BlueMapVue/") -} - -task cleanWebapp(type: Delete) { - delete 'BlueMapVue/dist' -} - -task buildWebapp(type: NpmTask) { - dependsOn 'cleanWebapp' - dependsOn 'npmInstall' - args = ['run', 'build'] -} - -task zipWebapp(type: Zip) { - dependsOn 'buildWebapp' - from fileTree('BlueMapVue/dist/') - archiveFileName.set('webapp.zip') - destinationDirectory.set(file('src/main/resources/de/bluecolored/bluemap/')) - outputs.upToDateWhen { false } -} - -//always update the zip before build -processResources.dependsOn(zipWebapp) - diff --git a/BlueMapCommon/build.gradle.kts b/BlueMapCommon/build.gradle.kts new file mode 100644 index 00000000..cf190bad --- /dev/null +++ b/BlueMapCommon/build.gradle.kts @@ -0,0 +1,106 @@ +import com.github.gradle.node.npm.task.NpmTask +import java.util.Properties +import java.io.IOException + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.common" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } +} + +dependencies { + api ("com.mojang:brigadier:1.0.17") + + api ("de.bluecolored.bluemap.core:BlueMapCore") + api ("de.bluecolored.bluemap.api:BlueMapAPI") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +node { + version.set("14.16.1") + download.set(true) + nodeProjectDir.set(file("BlueMapVue/")) +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.register("buildWebapp", type = NpmTask::class) { + doFirst { + if (!file("BlueMapVue/dist/").deleteRecursively()) + throw IOException("Failed to delete build directory!") + } + + dependsOn ("npmInstall") + args.set(listOf("run", "build")) + + inputs.dir("BlueMapVue/") + outputs.dir("BlueMapVue/dist/") +} + +tasks.register("zipWebapp", type = Zip::class) { + dependsOn ("buildWebapp") + from (fileTree("BlueMapVue/dist/")) + archiveFileName.set("webapp.zip") + destinationDirectory.set(file("src/main/resources/de/bluecolored/bluemap/")) + + //outputs.upToDateWhen { false } + inputs.dir("BlueMapVue/dist/") + outputs.file("src/main/resources/de/bluecolored/bluemap/webapp.zip") +} + +//always update the zip before build +tasks.processResources { + dependsOn("zipWebapp") +} diff --git a/BlueMapCommon/gradle/wrapper/gradle-wrapper.jar b/BlueMapCommon/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/BlueMapCommon/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BlueMapCommon/gradle/wrapper/gradle-wrapper.properties b/BlueMapCommon/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/BlueMapCommon/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BlueMapCommon/gradlew b/BlueMapCommon/gradlew new file mode 100644 index 00000000..744e882e --- /dev/null +++ b/BlueMapCommon/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/BlueMapCommon/gradlew.bat b/BlueMapCommon/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/BlueMapCommon/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BlueMapCommon/settings.gradle.kts b/BlueMapCommon/settings.gradle.kts new file mode 100644 index 00000000..a876bfa9 --- /dev/null +++ b/BlueMapCommon/settings.gradle.kts @@ -0,0 +1,4 @@ +rootProject.name = "BlueMapCommon" + +includeBuild("../BlueMapAPI") +includeBuild("../BlueMapCore") \ No newline at end of file diff --git a/BlueMapCore/build.gradle b/BlueMapCore/build.gradle deleted file mode 100644 index e7434292..00000000 --- a/BlueMapCore/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -dependencies { - api 'com.github.ben-manes.caffeine:caffeine:2.8.5' - api 'com.google.code.gson:gson:2.8.0' - api 'org.apache.commons:commons-lang3:3.6' - api group: 'commons-io', name: 'commons-io', version: '2.5' - api 'com.flowpowered:flow-math:1.0.3' - api 'org.spongepowered:configurate-hocon:4.1.1' - api 'org.spongepowered:configurate-gson:4.1.1' - api 'com.github.Querz:NBT:4.0' - api 'org.apache.commons:commons-dbcp2:2.9.0' - - testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' -} - -test { - useJUnitPlatform() -} - -processResources { - def git = versionDetails() - from(sourceSets.main.resources.srcDirs) { - include 'de/bluecolored/bluemap/version.json' - duplicatesStrategy = DuplicatesStrategy.WARN - - expand ( - version: project.version, - gitHash: git.gitHashFull, - gitClean: git.isCleanTag - ) - } -} - -license { - exclude('**/AABB.java') -} - -//resource Extensions -String[] resourceIds = [ - "1_13", "1_15", "1_16", "1_18" -]; - -task zipResourceExtensions { - for (String id : resourceIds) { - dependsOn "zipResourceExtensions$id" - } -} - -for (String id : resourceIds) zipResourcesTask(id) -void zipResourcesTask(String resourceId) { - task ("zipResourceExtensions$resourceId", type: Zip) { - from fileTree("src/main/resourceExtensions/mc$resourceId") - archiveName 'resourceExtensions.zip' - destinationDir(file("src/main/resources/de/bluecolored/bluemap/mc$resourceId/")) - outputs.upToDateWhen{ false } - } -} - -//always update the zip before build -processResources.dependsOn(zipResourceExtensions) diff --git a/BlueMapCore/build.gradle.kts b/BlueMapCore/build.gradle.kts new file mode 100644 index 00000000..0fd4e249 --- /dev/null +++ b/BlueMapCore/build.gradle.kts @@ -0,0 +1,113 @@ +import java.util.Properties + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.core" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() + maven { + setUrl("https://jitpack.io") + } +} + +@Suppress("GradlePackageUpdate") +dependencies { + api ("com.github.ben-manes.caffeine:caffeine:2.8.5") + api ("com.google.code.gson:gson:2.8.0") + api ("org.apache.commons:commons-lang3:3.6") + api ("commons-io:commons-io:2.5") + api ("com.flowpowered:flow-math:1.0.3") + api ("org.spongepowered:configurate-hocon:4.1.1") + api ("org.spongepowered:configurate-gson:4.1.1") + api ("com.github.Querz:NBT:4.0") + api ("org.apache.commons:commons-dbcp2:2.9.0") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + from("src/main/resources") { + include("de/bluecolored/bluemap/version.json") + duplicatesStrategy = DuplicatesStrategy.INCLUDE + + expand ( + "version" to project.version, + "gitHash" to git.gitHashFull, + "gitClean" to git.isCleanTag + ) + } +} + +//resource Extensions +val resourceIds: Array = arrayOf( + "1_13", "1_15", "1_16", "1_18" +) + +tasks.register("zipResourceExtensions") { + resourceIds.forEach { + dependsOn("zipResourceExtensions$it") + } +} + +resourceIds.forEach { + zipResourcesTask(it) +} + +fun zipResourcesTask(resourceId: String) { + tasks.register ("zipResourceExtensions$resourceId", type = Zip::class) { + from(fileTree("src/main/resourceExtensions/mc$resourceId")) + archiveFileName.set("resourceExtensions.zip") + destinationDirectory.set(file("src/main/resources/de/bluecolored/bluemap/mc$resourceId/")) + outputs.upToDateWhen{ false } + } +} + +//always update the zip before build +tasks.processResources { + dependsOn("zipResourceExtensions") +} \ No newline at end of file diff --git a/BlueMapCore/gradle/wrapper/gradle-wrapper.jar b/BlueMapCore/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/BlueMapCore/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BlueMapCore/gradle/wrapper/gradle-wrapper.properties b/BlueMapCore/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/BlueMapCore/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BlueMapCore/gradlew b/BlueMapCore/gradlew new file mode 100644 index 00000000..744e882e --- /dev/null +++ b/BlueMapCore/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/BlueMapCore/gradlew.bat b/BlueMapCore/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/BlueMapCore/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BlueMapCore/settings.gradle.kts b/BlueMapCore/settings.gradle.kts new file mode 100644 index 00000000..82c6709b --- /dev/null +++ b/BlueMapCore/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "BlueMapCore" \ No newline at end of file diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/BufferAttribute.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/BufferAttribute.java index f497a099..5f5ab316 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/BufferAttribute.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/BufferAttribute.java @@ -22,9 +22,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -/** - * - */ package de.bluecolored.bluemap.core.threejs; import com.google.gson.stream.JsonReader; diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/MaterialGroup.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/MaterialGroup.java index 788bb70c..e503afbf 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/MaterialGroup.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/threejs/MaterialGroup.java @@ -22,9 +22,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -/** - * - */ package de.bluecolored.bluemap.core.threejs; public class MaterialGroup { diff --git a/build.gradle b/build.gradle deleted file mode 100644 index ff568c7c..00000000 --- a/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'com.github.johnrengelman.shadow' version '6.1.0' - id 'com.github.hierynomus.license' version '0.16.1' - id 'com.palantir.git-version' version '0.12.3' - id 'com.diffplug.spotless' version '5.14.2' -} - -allprojects { - repositories { - jcenter() - mavenCentral() - maven { - url 'https://jitpack.io' - } - maven { - name 'sponge' - url 'https://repo.spongepowered.org/repository/maven-public/' - } - maven { - name 'CodeMC' - url 'https://repo.codemc.org/repository/maven-public/' - } - maven { - url "https://libraries.minecraft.net" - } - maven { - name 'Fabric' - url 'https://maven.fabricmc.net/' - } - } - - compileJava.options.compilerArgs.add '-parameters' - compileTestJava.options.compilerArgs.add '-parameters' - - tasks.withType(JavaCompile) { - options.encoding = "UTF-8" - } - - apply plugin: 'java' - apply plugin: 'java-library' - - group = 'de.bluecolored.bluemap' - version = coreVersion - - apply plugin: 'license' - license { - header rootProject.file('HEADER') - excludes([ - '**/*.conf', - '**/*.yml', - '**/*.zip', - '**/*.json' - ]) - } -} - -subprojects { - apply plugin: 'com.github.johnrengelman.shadow' - apply plugin: 'java' - - sourceCompatibility = 1.8 - targetCompatibility = 1.8 -} - - -spotless { - java { - indentWithSpaces() - trimTrailingWhitespace() - - target fileTree(project.rootDir) { - include '**/*.java' - exclude '**/build/**' - exclude 'BlueMapAPI/**' - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..3d492b36 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,17 @@ + +tasks.register("clean") { + gradle.includedBuilds.forEach { + dependsOn(it.task(":clean")) + } + + doFirst { + if (!file("build").deleteRecursively()) + throw java.io.IOException("Failed to delete build directory!") + } +} + +tasks.register("build") { + gradle.includedBuilds.forEach { + dependsOn(it.task(":release")) + } +} diff --git a/implementations/cli/build.gradle b/implementations/cli/build.gradle deleted file mode 100644 index 03b98dce..00000000 --- a/implementations/cli/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: '1.4' - implementation project(':BlueMapCommon') -} - -jar { - manifest { - attributes 'Main-Class' : "de.bluecolored.bluemap.cli.BlueMapCLI" - } -} - -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-cli.jar") - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.google', 'de.bluecolored.shadow.google' - relocate 'com.typesafe', 'de.bluecolored.shadow.typesafe' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'org.apache', 'de.bluecolored.shadow.apache' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'javax.annotation', 'de.bluecolored.shadow.javax.annotation' - relocate 'com.mojang.brigadier', 'de.bluecolored.shadow.mojang.brigadier' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} \ No newline at end of file diff --git a/implementations/cli/build.gradle.kts b/implementations/cli/build.gradle.kts new file mode 100644 index 00000000..7a953f86 --- /dev/null +++ b/implementations/cli/build.gradle.kts @@ -0,0 +1,103 @@ +import java.util.Properties + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.cli" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } +} + +dependencies { + api ("de.bluecolored.bluemap.common:BlueMapCommon") + + @Suppress("GradlePackageUpdate") + implementation ("commons-cli:commons-cli:1.5.0") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + + +tasks.jar { + manifest { + attributes ( + "Main-Class" to "de.bluecolored.bluemap.cli.BlueMapCLI" + ) + } +} + +tasks.shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.google", "de.bluecolored.shadow.google") + relocate ("com.typesafe", "de.bluecolored.shadow.typesafe") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("javax.annotation", "de.bluecolored.shadow.javax.annotation") + relocate ("com.mojang.brigadier", "de.bluecolored.shadow.mojang.brigadier") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + relocate ("org.apache.commons", "de.bluecolored.shadow.apache.commons") +} + +tasks.register("release") { + dependsOn(tasks.shadowJar) +} diff --git a/implementations/cli/gradle/wrapper/gradle-wrapper.jar b/implementations/cli/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/cli/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/cli/gradle/wrapper/gradle-wrapper.properties b/implementations/cli/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..69a97150 --- /dev/null +++ b/implementations/cli/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/cli/gradlew b/implementations/cli/gradlew new file mode 100644 index 00000000..744e882e --- /dev/null +++ b/implementations/cli/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/implementations/cli/gradlew.bat b/implementations/cli/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/cli/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/cli/settings.gradle.kts b/implementations/cli/settings.gradle.kts new file mode 100644 index 00000000..2055ed8c --- /dev/null +++ b/implementations/cli/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "cli" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.15.2/build.gradle b/implementations/fabric-1.15.2/build.gradle deleted file mode 100644 index 9ce194ed..00000000 --- a/implementations/fabric-1.15.2/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import net.fabricmc.loom.task.RemapJarTask - -plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' -} - -configurations { - implementation.extendsFrom shadowInclude -} - -dependencies { - minecraft "com.mojang:minecraft:1.15.2" - mappings "net.fabricmc:yarn:1.15.2+build.17:v2" - modImplementation "net.fabricmc:fabric-loader:0.9.2+build.206" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.19.0+build.325-1.15" - - shadowInclude (project(':BlueMapCommon')) { - //exclude dependencies provided by fabric - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowInclude] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -task ramappedShadowJar(type: RemapJarTask) { - destinationDirectory = file '../../build/release' - dependsOn tasks.shadowJar - input.set(tasks.shadowJar.archiveFile.get()) - addNestedDependencies.set(true) - archiveFileName.set("BlueMap-${archiveVersion.get()}-fabric-1.15.2.jar") -} -build.dependsOn ramappedShadowJar - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} diff --git a/implementations/fabric-1.15.2/build.gradle.kts b/implementations/fabric-1.15.2/build.gradle.kts new file mode 100644 index 00000000..4d818ee6 --- /dev/null +++ b/implementations/fabric-1.15.2/build.gradle.kts @@ -0,0 +1,134 @@ +import java.util.Properties +import net.fabricmc.loom.task.RemapJarTask + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("fabric-loom") version "0.8-SNAPSHOT" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.fabric" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) + + withSourcesJar() +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.fabricmc.net/") + } +} + +val shadowInclude: Configuration by configurations.creating + +configurations { + implementation.get().extendsFrom(shadowInclude) +} + +dependencies { + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group = "com.google.guava", module = "guava") + exclude (group = "com.google.code.gson", module = "gson") + exclude (group = "org.apache.commons", module = "commons-lang3") + exclude (group = "commons-io", module = "commons-io") + exclude (group = "com.mojang", module = "brigadier") + } + + minecraft ("com.mojang:minecraft:1.15.2") + mappings ("net.fabricmc:yarn:1.15.2+build.17:v2") + modImplementation ("net.fabricmc:fabric-loader:0.9.2+build.206") + modImplementation ("net.fabricmc.fabric-api:fabric-api:0.19.0+build.325-1.15") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + inputs.property ("version", project.version) + + filesMatching("fabric.mod.json") { + expand ("version" to project.version) + } +} + +tasks.shadowJar { + configurations = listOf(shadowInclude) + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +tasks.register("remappedShadowJar", type = RemapJarTask::class) { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + dependsOn (tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile.get()) + addNestedDependencies.set(true) +} + +tasks.register("release") { + dependsOn(tasks["remappedShadowJar"]) +} diff --git a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.15.2/gradlew b/implementations/fabric-1.15.2/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/fabric-1.15.2/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.15.2/gradlew.bat b/implementations/fabric-1.15.2/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/fabric-1.15.2/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/fabric-1.15.2/settings.gradle.kts b/implementations/fabric-1.15.2/settings.gradle.kts new file mode 100644 index 00000000..91537e54 --- /dev/null +++ b/implementations/fabric-1.15.2/settings.gradle.kts @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +rootProject.name = "fabric-1.15.2" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.16.1/build.gradle b/implementations/fabric-1.16.1/build.gradle deleted file mode 100644 index 1f082798..00000000 --- a/implementations/fabric-1.16.1/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import net.fabricmc.loom.task.RemapJarTask - -plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' -} - -configurations { - implementation.extendsFrom shadowInclude -} - -dependencies { - minecraft "com.mojang:minecraft:1.16.1" - mappings "net.fabricmc:yarn:1.16.1+build.21:v2" - modImplementation "net.fabricmc:fabric-loader:0.9.2+build.206" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.16.2+build.385-1.16.1" - - shadowInclude (project(':BlueMapCommon')) { - //exclude dependencies provided by fabric - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowInclude] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -task ramappedShadowJar(type: RemapJarTask) { - destinationDirectory = file '../../build/release' - dependsOn tasks.shadowJar - input.set(tasks.shadowJar.archiveFile.get()) - addNestedDependencies.set(true) - archiveFileName.set("BlueMap-${archiveVersion.get()}-fabric-1.16.1.jar") -} -build.dependsOn ramappedShadowJar - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} diff --git a/implementations/fabric-1.16.1/build.gradle.kts b/implementations/fabric-1.16.1/build.gradle.kts new file mode 100644 index 00000000..6e1a8a0e --- /dev/null +++ b/implementations/fabric-1.16.1/build.gradle.kts @@ -0,0 +1,134 @@ +import java.util.Properties +import net.fabricmc.loom.task.RemapJarTask + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("fabric-loom") version "0.8-SNAPSHOT" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.fabric" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) + + withSourcesJar() +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.fabricmc.net/") + } +} + +val shadowInclude: Configuration by configurations.creating + +configurations { + implementation.get().extendsFrom(shadowInclude) +} + +dependencies { + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group = "com.google.guava", module = "guava") + exclude (group = "com.google.code.gson", module = "gson") + exclude (group = "org.apache.commons", module = "commons-lang3") + exclude (group = "commons-io", module = "commons-io") + exclude (group = "com.mojang", module = "brigadier") + } + + minecraft ("com.mojang:minecraft:1.16.1") + mappings ("net.fabricmc:yarn:1.16.1+build.21:v2") + modImplementation ("net.fabricmc:fabric-loader:0.9.2+build.206") + modImplementation ("net.fabricmc.fabric-api:fabric-api:0.16.2+build.385-1.16.1") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + inputs.property ("version", project.version) + + filesMatching("fabric.mod.json") { + expand ("version" to project.version) + } +} + +tasks.shadowJar { + configurations = listOf(shadowInclude) + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +tasks.register("remappedShadowJar", type = RemapJarTask::class) { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + dependsOn (tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile.get()) + addNestedDependencies.set(true) +} + +tasks.register("release") { + dependsOn(tasks["remappedShadowJar"]) +} diff --git a/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/fabric-1.16.1/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.16.1/gradlew b/implementations/fabric-1.16.1/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/fabric-1.16.1/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.16.1/gradlew.bat b/implementations/fabric-1.16.1/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/fabric-1.16.1/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/fabric-1.16.1/settings.gradle.kts b/implementations/fabric-1.16.1/settings.gradle.kts new file mode 100644 index 00000000..e4773347 --- /dev/null +++ b/implementations/fabric-1.16.1/settings.gradle.kts @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +rootProject.name = "fabric-1.16.1" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.16.2/build.gradle b/implementations/fabric-1.16.2/build.gradle deleted file mode 100644 index f20c9a36..00000000 --- a/implementations/fabric-1.16.2/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import net.fabricmc.loom.task.RemapJarTask - -plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' -} - -configurations { - implementation.extendsFrom shadowInclude -} - -dependencies { - minecraft "com.mojang:minecraft:1.16.3" - mappings "net.fabricmc:yarn:1.16.3+build.1:v2" - modImplementation "net.fabricmc:fabric-loader:0.9.3+build.207" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.20.2+build.402-1.16" - - shadowInclude (project(':BlueMapCommon')) { - //exclude dependencies provided by fabric - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowInclude] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -task ramappedShadowJar(type: RemapJarTask) { - destinationDirectory = file '../../build/release' - dependsOn tasks.shadowJar - input.set(tasks.shadowJar.archiveFile.get()) - addNestedDependencies.set(true) - archiveFileName.set("BlueMap-${archiveVersion.get()}-fabric-1.16.4.jar") -} -build.dependsOn ramappedShadowJar - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} diff --git a/implementations/fabric-1.16.2/build.gradle.kts b/implementations/fabric-1.16.2/build.gradle.kts new file mode 100644 index 00000000..a480e826 --- /dev/null +++ b/implementations/fabric-1.16.2/build.gradle.kts @@ -0,0 +1,134 @@ +import java.util.Properties +import net.fabricmc.loom.task.RemapJarTask + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("fabric-loom") version "0.8-SNAPSHOT" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.fabric" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) + + withSourcesJar() +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.fabricmc.net/") + } +} + +val shadowInclude: Configuration by configurations.creating + +configurations { + implementation.get().extendsFrom(shadowInclude) +} + +dependencies { + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group = "com.google.guava", module = "guava") + exclude (group = "com.google.code.gson", module = "gson") + exclude (group = "org.apache.commons", module = "commons-lang3") + exclude (group = "commons-io", module = "commons-io") + exclude (group = "com.mojang", module = "brigadier") + } + + minecraft ("com.mojang:minecraft:1.16.3") + mappings ("net.fabricmc:yarn:1.16.3+build.1:v2") + modImplementation ("net.fabricmc:fabric-loader:0.9.3+build.207") + modImplementation ("net.fabricmc.fabric-api:fabric-api:0.20.2+build.402-1.16") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + inputs.property ("version", project.version) + + filesMatching("fabric.mod.json") { + expand ("version" to project.version) + } +} + +tasks.shadowJar { + configurations = listOf(shadowInclude) + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +tasks.register("remappedShadowJar", type = RemapJarTask::class) { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + dependsOn (tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile.get()) + addNestedDependencies.set(true) +} + +tasks.register("release") { + dependsOn(tasks["remappedShadowJar"]) +} diff --git a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.16.2/gradlew b/implementations/fabric-1.16.2/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/fabric-1.16.2/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.16.2/gradlew.bat b/implementations/fabric-1.16.2/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/fabric-1.16.2/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/fabric-1.16.2/settings.gradle.kts b/implementations/fabric-1.16.2/settings.gradle.kts new file mode 100644 index 00000000..b69aac6c --- /dev/null +++ b/implementations/fabric-1.16.2/settings.gradle.kts @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +rootProject.name = "fabric-1.16.2" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.17/build.gradle b/implementations/fabric-1.17/build.gradle deleted file mode 100644 index f89799d4..00000000 --- a/implementations/fabric-1.17/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import net.fabricmc.loom.task.RemapJarTask - -plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' -} - -configurations { - implementation.extendsFrom shadowInclude -} - -dependencies { - minecraft "com.mojang:minecraft:1.17" - mappings "net.fabricmc:yarn:1.17+build.1:v2" - modImplementation "net.fabricmc:fabric-loader:0.11.3" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.34.9+1.17" - - shadowInclude (project(':BlueMapCommon')) { - //exclude dependencies provided by fabric - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowInclude] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -task ramappedShadowJar(type: RemapJarTask) { - destinationDirectory = file '../../build/release' - dependsOn tasks.shadowJar - input.set(tasks.shadowJar.archiveFile.get()) - addNestedDependencies.set(true) - archiveFileName.set("BlueMap-${archiveVersion.get()}-fabric-1.17.jar") -} -build.dependsOn ramappedShadowJar - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} diff --git a/implementations/fabric-1.17/build.gradle.kts b/implementations/fabric-1.17/build.gradle.kts new file mode 100644 index 00000000..6eb1a091 --- /dev/null +++ b/implementations/fabric-1.17/build.gradle.kts @@ -0,0 +1,134 @@ +import java.util.Properties +import net.fabricmc.loom.task.RemapJarTask + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("fabric-loom") version "0.8-SNAPSHOT" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.fabric" +version = releaseProperties["version"].toString() + +val javaTarget = 16 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) + + withSourcesJar() +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.fabricmc.net/") + } +} + +val shadowInclude: Configuration by configurations.creating + +configurations { + implementation.get().extendsFrom(shadowInclude) +} + +dependencies { + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group = "com.google.guava", module = "guava") + exclude (group = "com.google.code.gson", module = "gson") + exclude (group = "org.apache.commons", module = "commons-lang3") + exclude (group = "commons-io", module = "commons-io") + exclude (group = "com.mojang", module = "brigadier") + } + + minecraft ("com.mojang:minecraft:1.17") + mappings ("net.fabricmc:yarn:1.17+build.1:v2") + modImplementation ("net.fabricmc:fabric-loader:0.11.3") + modImplementation ("net.fabricmc.fabric-api:fabric-api:0.34.9+1.17") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + inputs.property ("version", project.version) + + filesMatching("fabric.mod.json") { + expand ("version" to project.version) + } +} + +tasks.shadowJar { + configurations = listOf(shadowInclude) + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +tasks.register("remappedShadowJar", type = RemapJarTask::class) { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + dependsOn (tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile.get()) + addNestedDependencies.set(true) +} + +tasks.register("release") { + dependsOn(tasks["remappedShadowJar"]) +} diff --git a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.17/gradlew b/implementations/fabric-1.17/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/fabric-1.17/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.17/gradlew.bat b/implementations/fabric-1.17/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/fabric-1.17/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/fabric-1.17/settings.gradle.kts b/implementations/fabric-1.17/settings.gradle.kts new file mode 100644 index 00000000..352cc383 --- /dev/null +++ b/implementations/fabric-1.17/settings.gradle.kts @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +rootProject.name = "fabric-1.17" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.18/build.gradle b/implementations/fabric-1.18/build.gradle deleted file mode 100644 index 887f3818..00000000 --- a/implementations/fabric-1.18/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import net.fabricmc.loom.task.RemapJarTask - -plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' -} - -configurations { - implementation.extendsFrom shadowInclude -} - -dependencies { - minecraft "com.mojang:minecraft:1.18-pre5" - mappings "net.fabricmc:yarn:1.18-pre5+build.4:v2" - modImplementation "net.fabricmc:fabric-loader:0.11.3" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.42.2+1.18" - - shadowInclude (project(':BlueMapCommon')) { - //exclude dependencies provided by fabric - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowInclude] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -task ramappedShadowJar(type: RemapJarTask) { - destinationDirectory = file '../../build/release' - dependsOn tasks.shadowJar - input.set(tasks.shadowJar.archiveFile.get()) - addNestedDependencies.set(true) - archiveFileName.set("BlueMap-${archiveVersion.get()}-fabric-1.18.jar") -} -build.dependsOn ramappedShadowJar - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} diff --git a/implementations/fabric-1.18/build.gradle.kts b/implementations/fabric-1.18/build.gradle.kts new file mode 100644 index 00000000..bb1afb12 --- /dev/null +++ b/implementations/fabric-1.18/build.gradle.kts @@ -0,0 +1,134 @@ +import java.util.Properties +import net.fabricmc.loom.task.RemapJarTask + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("fabric-loom") version "0.8-SNAPSHOT" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.fabric" +version = releaseProperties["version"].toString() + +val javaTarget = 17 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) + + withSourcesJar() +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.fabricmc.net/") + } +} + +val shadowInclude: Configuration by configurations.creating + +configurations { + implementation.get().extendsFrom(shadowInclude) +} + +dependencies { + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group = "com.google.guava", module = "guava") + exclude (group = "com.google.code.gson", module = "gson") + exclude (group = "org.apache.commons", module = "commons-lang3") + exclude (group = "commons-io", module = "commons-io") + exclude (group = "com.mojang", module = "brigadier") + } + + minecraft ("com.mojang:minecraft:1.18-pre5") + mappings ("net.fabricmc:yarn:1.18-pre5+build.4:v2") + modImplementation ("net.fabricmc:fabric-loader:0.11.3") + modImplementation ("net.fabricmc.fabric-api:fabric-api:0.42.2+1.18") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + inputs.property ("version", project.version) + + filesMatching("fabric.mod.json") { + expand ("version" to project.version) + } +} + +tasks.shadowJar { + configurations = listOf(shadowInclude) + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +tasks.register("remappedShadowJar", type = RemapJarTask::class) { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + dependsOn (tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile.get()) + addNestedDependencies.set(true) +} + +tasks.register("release") { + dependsOn(tasks["remappedShadowJar"]) +} diff --git a/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/fabric-1.18/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.18/gradlew b/implementations/fabric-1.18/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/fabric-1.18/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.18/gradlew.bat b/implementations/fabric-1.18/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/fabric-1.18/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/fabric-1.18/settings.gradle.kts b/implementations/fabric-1.18/settings.gradle.kts new file mode 100644 index 00000000..5a2d6ee9 --- /dev/null +++ b/implementations/fabric-1.18/settings.gradle.kts @@ -0,0 +1,13 @@ +pluginManagement { + repositories { + maven { + name = "Fabric" + url = uri("https://maven.fabricmc.net/") + } + gradlePluginPortal() + } +} + +rootProject.name = "fabric-1.18" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.14.4/build.gradle b/implementations/forge-1.14.4/build.gradle index 3f073161..634b1810 100644 --- a/implementations/forge-1.14.4/build.gradle +++ b/implementations/forge-1.14.4/build.gradle @@ -1,64 +1,160 @@ buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven/' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true - } + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true + } } -apply plugin: 'net.minecraftforge.gradle' +plugins { + id "java" + id "java-library" + id "com.diffplug.spotless" version "6.1.2" + id "com.palantir.git-version" version "0.12.3" + id "com.github.node-gradle.node" version "3.0.1" + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +apply plugin: "net.minecraftforge.gradle" + +def git = versionDetails() + +def releaseProperties = new Properties() +releaseProperties.load(new FileInputStream(file("../../release.properties"))) + +group = "de.bluecolored.bluemap.forge" +version = releaseProperties.version.toString() +archivesBaseName = 'bluemap' + +def javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} minecraft { - mappings channel: 'snapshot', version: '20190719-1.14.3' + mappings channel: 'snapshot', version: '20190719-1.14.3' + + runs { + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + bluemap { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } } configurations { - implementation.extendsFrom include + implementation.extendsFrom(shadowInclude) } dependencies { minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' - - include (project(':BlueMapCommon')) { - //exclude dependencies provided by forge - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } + + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group: "com.google.guava", module: "guava") + exclude (group: "com.google.code.gson", module: "gson") + exclude (group: "org.apache.commons", module: "commons-lang3") + exclude (group: "commons-io", module: "commons-io") + exclude (group: "com.mojang", module: "brigadier") + } + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") } -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-forge-1.14.4.jar") - - configurations = [project.configurations.include] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +jar { + manifest { + attributes([ + "Specification-Title" : "bluemap", + "Specification-Vendor" : "bluemap", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "bluemap", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +tasks.withType(JavaCompile).configureEach { + options.encoding = "utf-8" +} + +tasks.withType(AbstractArchiveTask).configureEach { + setReproducibleFileOrder(true) + setPreserveFileTimestamps(false) +} + +test { + useJUnitPlatform() +} + +shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + configurations = [project.configurations.shadowInclude] + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info','META-INF/mods.toml' duplicatesStrategy = DuplicatesStrategy.WARN - + expand ( - version: project.version + version: project.version ) } } @@ -70,3 +166,7 @@ afterEvaluate { } } } + +task release { + dependsOn(build) +} diff --git a/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/forge-1.14.4/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/forge-1.14.4/gradlew b/implementations/forge-1.14.4/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/forge-1.14.4/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.14.4/gradlew.bat b/implementations/forge-1.14.4/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/forge-1.14.4/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/forge-1.14.4/settings.gradle.kts b/implementations/forge-1.14.4/settings.gradle.kts new file mode 100644 index 00000000..2a63bab8 --- /dev/null +++ b/implementations/forge-1.14.4/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "forge-1.14.4" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.15.2/build.gradle b/implementations/forge-1.15.2/build.gradle index e0aaa906..3880e94f 100644 --- a/implementations/forge-1.15.2/build.gradle +++ b/implementations/forge-1.15.2/build.gradle @@ -1,64 +1,160 @@ buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven/' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true - } + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true + } } -apply plugin: 'net.minecraftforge.gradle' +plugins { + id "java" + id "java-library" + id "com.diffplug.spotless" version "6.1.2" + id "com.palantir.git-version" version "0.12.3" + id "com.github.node-gradle.node" version "3.0.1" + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +apply plugin: "net.minecraftforge.gradle" + +def git = versionDetails() + +def releaseProperties = new Properties() +releaseProperties.load(new FileInputStream(file("../../release.properties"))) + +group = "de.bluecolored.bluemap.forge" +version = releaseProperties.version.toString() +archivesBaseName = 'bluemap' + +def javaTarget = 16 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} minecraft { - mappings channel: 'snapshot', version: '20190719-1.14.3' + mappings channel: 'snapshot', version: '20190719-1.14.3' + + runs { + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + bluemap { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } } configurations { - implementation.extendsFrom include + implementation.extendsFrom(shadowInclude) } dependencies { minecraft 'net.minecraftforge:forge:1.15.2-31.2.0' - - include (project(':BlueMapCommon')) { - //exclude dependencies provided by forge - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } + + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group: "com.google.guava", module: "guava") + exclude (group: "com.google.code.gson", module: "gson") + exclude (group: "org.apache.commons", module: "commons-lang3") + exclude (group: "commons-io", module: "commons-io") + exclude (group: "com.mojang", module: "brigadier") + } + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") } -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-forge-1.15.2.jar") - - configurations = [project.configurations.include] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +jar { + manifest { + attributes([ + "Specification-Title" : "bluemap", + "Specification-Vendor" : "bluemap", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "bluemap", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +tasks.withType(JavaCompile).configureEach { + options.encoding = "utf-8" +} + +tasks.withType(AbstractArchiveTask).configureEach { + setReproducibleFileOrder(true) + setPreserveFileTimestamps(false) +} + +test { + useJUnitPlatform() +} + +shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + configurations = [project.configurations.shadowInclude] + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info','META-INF/mods.toml' duplicatesStrategy = DuplicatesStrategy.WARN - + expand ( - version: project.version + version: project.version ) } } @@ -70,3 +166,7 @@ afterEvaluate { } } } + +task release { + dependsOn(build) +} diff --git a/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/forge-1.15.2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/forge-1.15.2/gradlew b/implementations/forge-1.15.2/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/forge-1.15.2/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.15.2/gradlew.bat b/implementations/forge-1.15.2/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/forge-1.15.2/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/forge-1.15.2/settings.gradle.kts b/implementations/forge-1.15.2/settings.gradle.kts new file mode 100644 index 00000000..bf0c46b4 --- /dev/null +++ b/implementations/forge-1.15.2/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "forge-1.15.2" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.16.2/build.gradle b/implementations/forge-1.16.2/build.gradle index 055843a5..c0056799 100644 --- a/implementations/forge-1.16.2/build.gradle +++ b/implementations/forge-1.16.2/build.gradle @@ -1,64 +1,160 @@ buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven/' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true - } + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.0.9', changing: true + } } -apply plugin: 'net.minecraftforge.gradle' +plugins { + id "java" + id "java-library" + id "com.diffplug.spotless" version "6.1.2" + id "com.palantir.git-version" version "0.12.3" + id "com.github.node-gradle.node" version "3.0.1" + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +apply plugin: "net.minecraftforge.gradle" + +def git = versionDetails() + +def releaseProperties = new Properties() +releaseProperties.load(new FileInputStream(file("../../release.properties"))) + +group = "de.bluecolored.bluemap.forge" +version = releaseProperties.version.toString() +archivesBaseName = 'bluemap' + +def javaTarget = 16 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} minecraft { - mappings channel: 'snapshot', version: '20200514-1.16' + mappings channel: 'snapshot', version: '20200514-1.16' + + runs { + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + bluemap { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } } configurations { - implementation.extendsFrom include + implementation.extendsFrom(shadowInclude) } dependencies { minecraft 'net.minecraftforge:forge:1.16.3-34.0.0' - - include (project(':BlueMapCommon')) { - //exclude dependencies provided by forge - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } + + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group: "com.google.guava", module: "guava") + exclude (group: "com.google.code.gson", module: "gson") + exclude (group: "org.apache.commons", module: "commons-lang3") + exclude (group: "commons-io", module: "commons-io") + exclude (group: "com.mojang", module: "brigadier") + } + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") } -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-forge-1.16.4.jar") - - configurations = [project.configurations.include] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +jar { + manifest { + attributes([ + "Specification-Title" : "bluemap", + "Specification-Vendor" : "bluemap", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "bluemap", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +tasks.withType(JavaCompile).configureEach { + options.encoding = "utf-8" +} + +tasks.withType(AbstractArchiveTask).configureEach { + setReproducibleFileOrder(true) + setPreserveFileTimestamps(false) +} + +test { + useJUnitPlatform() +} + +shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + configurations = [project.configurations.shadowInclude] + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info','META-INF/mods.toml' duplicatesStrategy = DuplicatesStrategy.WARN - + expand ( - version: project.version + version: project.version ) } } @@ -70,3 +166,7 @@ afterEvaluate { } } } + +task release { + dependsOn(build) +} diff --git a/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/forge-1.16.2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/forge-1.16.2/gradlew b/implementations/forge-1.16.2/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/forge-1.16.2/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.16.2/gradlew.bat b/implementations/forge-1.16.2/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/forge-1.16.2/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/forge-1.16.2/settings.gradle.kts b/implementations/forge-1.16.2/settings.gradle.kts new file mode 100644 index 00000000..9eb8579b --- /dev/null +++ b/implementations/forge-1.16.2/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "forge-1.16.2" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.17.1/build.gradle b/implementations/forge-1.17.1/build.gradle index 8e58bf38..6bd860cd 100644 --- a/implementations/forge-1.17.1/build.gradle +++ b/implementations/forge-1.17.1/build.gradle @@ -1,65 +1,160 @@ buildscript { - repositories { + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + } } -apply plugin: 'net.minecraftforge.gradle' +plugins { + id "java" + id "java-library" + id "com.diffplug.spotless" version "6.1.2" + id "com.palantir.git-version" version "0.12.3" + id "com.github.node-gradle.node" version "3.0.1" + id "com.github.johnrengelman.shadow" version "7.1.2" +} -targetCompatibility = 1.16 +apply plugin: "net.minecraftforge.gradle" + +def git = versionDetails() + +def releaseProperties = new Properties() +releaseProperties.load(new FileInputStream(file("../../release.properties"))) + +group = "de.bluecolored.bluemap.forge" +version = releaseProperties.version.toString() +archivesBaseName = 'bluemap' + +def javaTarget = 16 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} minecraft { - mappings channel: 'official', version: '1.17.1' + mappings channel: 'official', version: '1.17.1' + + runs { + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + bluemap { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } } configurations { - implementation.extendsFrom include + implementation.extendsFrom(shadowInclude) } dependencies { minecraft 'net.minecraftforge:forge:1.17.1-37.0.109' - - include (project(':BlueMapCommon')) { - //exclude dependencies provided by forge - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'commons-io', module: 'commons-io' - exclude group: 'com.mojang', module: 'brigadier' - } + + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group: "com.google.guava", module: "guava") + exclude (group: "com.google.code.gson", module: "gson") + exclude (group: "org.apache.commons", module: "commons-lang3") + exclude (group: "commons-io", module: "commons-io") + exclude (group: "com.mojang", module: "brigadier") + } + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") } -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-forge-1.17.1.jar") - - configurations = [project.configurations.include] - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' +spotless { + java { + target ("src/* /java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +jar { + manifest { + attributes([ + "Specification-Title" : "bluemap", + "Specification-Vendor" : "bluemap", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "bluemap", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +tasks.withType(JavaCompile).configureEach { + options.encoding = "utf-8" +} + +tasks.withType(AbstractArchiveTask).configureEach { + setReproducibleFileOrder(true) + setPreserveFileTimestamps(false) +} + +test { + useJUnitPlatform() +} + +shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + configurations = [project.configurations.shadowInclude] + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info','META-INF/mods.toml' duplicatesStrategy = DuplicatesStrategy.WARN - + expand ( - version: project.version + version: project.version ) } } @@ -71,3 +166,7 @@ afterEvaluate { } } } + +task release { + dependsOn(build) +} diff --git a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/forge-1.17.1/gradlew b/implementations/forge-1.17.1/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/forge-1.17.1/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.17.1/gradlew.bat b/implementations/forge-1.17.1/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/forge-1.17.1/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/forge-1.17.1/settings.gradle.kts b/implementations/forge-1.17.1/settings.gradle.kts new file mode 100644 index 00000000..3894f07f --- /dev/null +++ b/implementations/forge-1.17.1/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "forge-1.17.1" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.18.1/build.gradle b/implementations/forge-1.18.1/build.gradle new file mode 100644 index 00000000..fdd777ca --- /dev/null +++ b/implementations/forge-1.18.1/build.gradle @@ -0,0 +1,172 @@ +buildscript { + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below + maven { url = 'https://maven.minecraftforge.net' } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + } +} + +plugins { + id "java" + id "java-library" + id "com.diffplug.spotless" version "6.1.2" + id "com.palantir.git-version" version "0.12.3" + id "com.github.node-gradle.node" version "3.0.1" + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +apply plugin: "net.minecraftforge.gradle" + +def git = versionDetails() + +def releaseProperties = new Properties() +releaseProperties.load(new FileInputStream(file("../../release.properties"))) + +group = "de.bluecolored.bluemap.forge" +version = releaseProperties.version.toString() +archivesBaseName = 'bluemap' + +def javaTarget = 17 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +minecraft { + mappings channel: 'official', version: '1.18.1' + + runs { + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + + mods { + bluemap { + source sourceSets.main + } + } + } + } +} + +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } +} + +configurations { + implementation.extendsFrom(shadowInclude) +} + +dependencies { + minecraft 'net.minecraftforge:forge:1.18.1-39.0.19' + + shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by fabric + exclude (group: "com.google.guava", module: "guava") + exclude (group: "com.google.code.gson", module: "gson") + exclude (group: "org.apache.commons", module: "commons-lang3") + exclude (group: "commons-io", module: "commons-io") + exclude (group: "com.mojang", module: "brigadier") + } + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +jar { + manifest { + attributes([ + "Specification-Title" : "bluemap", + "Specification-Vendor" : "bluemap", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "bluemap", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +jar.finalizedBy('reobfJar') + +tasks.withType(JavaCompile).configureEach { + options.encoding = "utf-8" +} + +tasks.withType(AbstractArchiveTask).configureEach { + setReproducibleFileOrder(true) + setPreserveFileTimestamps(false) +} + +test { + useJUnitPlatform() +} + +shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + configurations = [project.configurations.shadowInclude] + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + + relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") + relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") + relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info','META-INF/mods.toml' + duplicatesStrategy = DuplicatesStrategy.WARN + + expand ( + version: project.version + ) + } +} + +afterEvaluate { + reobf { + shadowJar { + mappings = createMcpToSrg.output + } + } +} + +task release { + dependsOn(build) +} diff --git a/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2e6e5897 --- /dev/null +++ b/implementations/forge-1.18.1/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/forge-1.18.1/gradlew b/implementations/forge-1.18.1/gradlew new file mode 100644 index 00000000..c53aefaa --- /dev/null +++ b/implementations/forge-1.18.1/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.18.1/gradlew.bat b/implementations/forge-1.18.1/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/forge-1.18.1/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/forge-1.18.1/settings.gradle.kts b/implementations/forge-1.18.1/settings.gradle.kts new file mode 100644 index 00000000..86394273 --- /dev/null +++ b/implementations/forge-1.18.1/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "forge-1.18.1" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java new file mode 100644 index 00000000..e6c61e5f --- /dev/null +++ b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java @@ -0,0 +1,81 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.bluecolored.bluemap.forge; + +import com.flowpowered.math.vector.Vector3d; +import de.bluecolored.bluemap.common.plugin.Plugin; +import de.bluecolored.bluemap.common.plugin.serverinterface.CommandSource; +import de.bluecolored.bluemap.common.plugin.text.Text; +import de.bluecolored.bluemap.core.world.World; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.phys.Vec3; + +import java.io.IOException; +import java.util.Optional; + +public class ForgeCommandSource implements CommandSource { + + private ForgeMod mod; + private Plugin plugin; + private CommandSourceStack delegate; + + public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delegate) { + this.mod = mod; + this.plugin = plugin; + this.delegate = delegate; + } + + @Override + public void sendMessage(Text text) { + Component component = TextComponent.Serializer.fromJsonLenient(text.toJSONString()); + if (component == null) component = new TextComponent(text.toPlainString()); + delegate.sendSuccess(component, false); + } + + @Override + public boolean hasPermission(String permission) { + return delegate.hasPermission(1); + } + + @Override + public Optional getPosition() { + Vec3 pos = delegate.getPosition(); + return Optional.of(new Vector3d(pos.x, pos.y, pos.z)); + } + + @Override + public Optional getWorld() { + try { + ServerLevel world = delegate.getLevel(); + return Optional.ofNullable(plugin.getWorld(mod.getUUIDForWorld(world))); + } catch (IOException ignore) {} + + return Optional.empty(); + } + +} diff --git a/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java new file mode 100644 index 00000000..3766e872 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java @@ -0,0 +1,67 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.bluecolored.bluemap.forge; + +import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent; +import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.UUID; + +public class ForgeEventForwarder { + + private final Collection eventListeners; + + public ForgeEventForwarder() { + this.eventListeners = new ArrayList<>(1); + + MinecraftForge.EVENT_BUS.register(this); + } + + public synchronized void addEventListener(ServerEventListener listener) { + this.eventListeners.add(listener); + } + + public synchronized void removeAllListeners() { + this.eventListeners.clear(); + } + + @SubscribeEvent + public synchronized void onPlayerJoin(PlayerLoggedInEvent evt) { + UUID uuid = evt.getPlayer().getUUID(); + for (ServerEventListener listener : eventListeners) listener.onPlayerJoin(uuid); + } + + @SubscribeEvent + public synchronized void onPlayerLeave(PlayerLoggedOutEvent evt) { + UUID uuid = evt.getPlayer().getUUID(); + for (ServerEventListener listener : eventListeners) listener.onPlayerLeave(uuid); + } + +} diff --git a/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java new file mode 100644 index 00000000..cf14beb0 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java @@ -0,0 +1,295 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.bluecolored.bluemap.forge; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import de.bluecolored.bluemap.common.plugin.Plugin; +import de.bluecolored.bluemap.common.plugin.commands.Commands; +import de.bluecolored.bluemap.common.plugin.serverinterface.Player; +import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener; +import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface; +import de.bluecolored.bluemap.core.BlueMap; +import de.bluecolored.bluemap.core.MinecraftVersion; +import de.bluecolored.bluemap.core.logger.Logger; +import de.bluecolored.bluemap.core.resourcepack.ParseResourceException; +import net.minecraft.DetectedVersion; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.storage.LevelResource; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.TickEvent.ServerTickEvent; +import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent; +import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent; +import net.minecraftforge.event.server.ServerStartedEvent; +import net.minecraftforge.event.server.ServerStartingEvent; +import net.minecraftforge.event.server.ServerStoppingEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.IExtensionPoint; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.network.NetworkConstants; +import org.apache.logging.log4j.LogManager; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; + +@Mod(Plugin.PLUGIN_ID) +public class ForgeMod implements ServerInterface { + + private final Plugin pluginInstance; + private MinecraftServer serverInstance = null; + + private final Map worldUUIDs; + private final ForgeEventForwarder eventForwarder; + + private final LoadingCache worldUuidCache; + + private int playerUpdateIndex = 0; + private final Map onlinePlayerMap; + private final List onlinePlayerList; + + public ForgeMod() { + Logger.global = new Log4jLogger(LogManager.getLogger(Plugin.PLUGIN_NAME)); + + this.onlinePlayerMap = new ConcurrentHashMap<>(); + this.onlinePlayerList = Collections.synchronizedList(new ArrayList<>()); + + String versionString = DetectedVersion.tryDetectVersion().getId(); + MinecraftVersion mcVersion; + try { + mcVersion = MinecraftVersion.of(versionString); + } catch (IllegalArgumentException ex) { + mcVersion = new MinecraftVersion(1, 18, 1); + Logger.global.logWarning("Failed to derive version from version-string '" + versionString + + "', falling back to version: " + mcVersion.getVersionString()); + } + this.pluginInstance = new Plugin(mcVersion, "forge-1.16.2", this); + + this.worldUUIDs = new ConcurrentHashMap<>(); + this.eventForwarder = new ForgeEventForwarder(); + this.worldUuidCache = Caffeine.newBuilder() + .executor(BlueMap.THREAD_POOL) + .weakKeys() + .maximumSize(1000) + .build(this::loadUUIDForWorld); + + MinecraftForge.EVENT_BUS.register(this); + + //Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible + ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true)); + } + + @SubscribeEvent + public void onServerStarting(ServerStartingEvent event) { + this.serverInstance = event.getServer(); + + //register commands + new Commands<>(pluginInstance, event.getServer().getCommands().getDispatcher(), forgeSource -> new ForgeCommandSource(this, pluginInstance, forgeSource)); + } + + @SubscribeEvent + public void onServerStarted(ServerStartedEvent event) { + //save worlds to generate level.dat files + serverInstance.saveAllChunks(false, true, true); + + new Thread(() -> { + Logger.global.logInfo("Loading..."); + + try { + pluginInstance.load(); + if (pluginInstance.isLoaded()) Logger.global.logInfo("Loaded!"); + } catch (IOException | ParseResourceException e) { + Logger.global.logError("Failed to load bluemap!", e); + pluginInstance.unload(); + } + }).start(); + } + + @SubscribeEvent + public void onServerStopping(ServerStoppingEvent event) { + pluginInstance.unload(); + Logger.global.logInfo("BlueMap unloaded!"); + } + + @SubscribeEvent + public void onTick(ServerTickEvent evt) { + updateSomePlayers(); + } + + @Override + public void registerListener(ServerEventListener listener) { + eventForwarder.addEventListener(listener); + } + + @Override + public void unregisterAllListeners() { + eventForwarder.removeAllListeners(); + } + + @Override + public UUID getUUIDForWorld(File worldFolder) throws IOException { + worldFolder = worldFolder.getCanonicalFile(); + + UUID uuid = worldUUIDs.get(worldFolder); + if (uuid == null) { + uuid = UUID.randomUUID(); + worldUUIDs.put(worldFolder, uuid); + } + + return uuid; + } + + public UUID getUUIDForWorld(ServerLevel world) throws IOException { + try { + return worldUuidCache.get(world); + } catch (RuntimeException e) { + throw new IOException(e); + } + } + + private UUID loadUUIDForWorld(ServerLevel world) throws IOException { + File key = getFolderForWorld(world); + + UUID uuid = worldUUIDs.get(key); + if (uuid == null) { + uuid = UUID.randomUUID(); + worldUUIDs.put(key, uuid); + } + + return uuid; + } + + private File getFolderForWorld(ServerLevel world) throws IOException { + MinecraftServer server = world.getServer(); + File worldFolder = world.getServer().getServerDirectory().toPath().resolve(server.getWorldPath(LevelResource.ROOT)).toFile(); + File dimensionFolder = DimensionType.getStorageFolder(world.dimension(), worldFolder.toPath()).toFile(); + return dimensionFolder.getCanonicalFile(); + } + + @Override + public boolean persistWorldChanges(UUID worldUUID) throws IOException, IllegalArgumentException { + final CompletableFuture taskResult = new CompletableFuture<>(); + + serverInstance.execute(() -> { + try { + for (ServerLevel world : serverInstance.getAllLevels()) { + if (getUUIDForWorld(world).equals(worldUUID)) { + world.save(null, true, false); + } + } + + taskResult.complete(true); + } catch (Exception e) { + taskResult.completeExceptionally(e); + } + }); + + try { + return taskResult.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new IOException(e); + } catch (ExecutionException e) { + Throwable t = e.getCause(); + if (t instanceof IOException) throw (IOException) t; + if (t instanceof IllegalArgumentException) throw (IllegalArgumentException) t; + throw new IOException(t); + } + } + + @Override + public File getConfigFolder() { + return new File("config/bluemap"); + } + + @SubscribeEvent + public void onPlayerJoin(PlayerLoggedInEvent evt) { + net.minecraft.world.entity.player.Player playerInstance = evt.getPlayer(); + if (!(playerInstance instanceof ServerPlayer)) return; + + ForgePlayer player = new ForgePlayer(this, playerInstance.getUUID()); + onlinePlayerMap.put(player.getUuid(), player); + onlinePlayerList.add(player); + } + + @SubscribeEvent + public void onPlayerLeave(PlayerLoggedOutEvent evt) { + net.minecraft.world.entity.player.Player player = evt.getPlayer(); + if (!(player instanceof ServerPlayer)) return; + + UUID playerUUID = player.getUUID(); + onlinePlayerMap.remove(playerUUID); + synchronized (onlinePlayerList) { + onlinePlayerList.removeIf(p -> p.getUuid().equals(playerUUID)); + } + } + + public MinecraftServer getServer() { + return this.serverInstance; + } + + public Plugin getPlugin() { + return this.pluginInstance; + } + + @Override + public Collection getOnlinePlayers() { + return onlinePlayerMap.values(); + } + + @Override + public Optional getPlayer(UUID uuid) { + return Optional.ofNullable(onlinePlayerMap.get(uuid)); + } + + /** + * Only update some of the online players each tick to minimize performance impact on the server-thread. + * Only call this method on the server-thread. + */ + private void updateSomePlayers() { + int onlinePlayerCount = onlinePlayerList.size(); + if (onlinePlayerCount == 0) return; + + int playersToBeUpdated = onlinePlayerCount / 20; //with 20 tps, each player is updated once a second + if (playersToBeUpdated == 0) playersToBeUpdated = 1; + + for (int i = 0; i < playersToBeUpdated; i++) { + playerUpdateIndex++; + if (playerUpdateIndex >= 20 && playerUpdateIndex >= onlinePlayerCount) playerUpdateIndex = 0; + + if (playerUpdateIndex < onlinePlayerCount) { + onlinePlayerList.get(playerUpdateIndex).update(); + } + } + } + +} diff --git a/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java new file mode 100644 index 00000000..6d78bf02 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java @@ -0,0 +1,151 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.bluecolored.bluemap.forge; + +import com.flowpowered.math.vector.Vector3d; +import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode; +import de.bluecolored.bluemap.common.plugin.serverinterface.Player; +import de.bluecolored.bluemap.common.plugin.text.Text; +import net.minecraft.client.renderer.EffectInstance; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.level.GameType; +import net.minecraft.world.phys.Vec3; + +import java.io.IOException; +import java.util.EnumMap; +import java.util.Map; +import java.util.UUID; + +public class ForgePlayer implements Player { + + private static final UUID UNKNOWN_WORLD_UUID = UUID.randomUUID(); + + private static final Map GAMEMODE_MAP = new EnumMap<>(GameType.class); + static { + GAMEMODE_MAP.put(GameType.ADVENTURE, Gamemode.ADVENTURE); + GAMEMODE_MAP.put(GameType.SURVIVAL, Gamemode.SURVIVAL); + GAMEMODE_MAP.put(GameType.CREATIVE, Gamemode.CREATIVE); + GAMEMODE_MAP.put(GameType.SPECTATOR, Gamemode.SPECTATOR); + } + + private UUID uuid; + private Text name; + private UUID world; + private Vector3d position; + private boolean online; + private boolean sneaking; + private boolean invisible; + private Gamemode gamemode; + + private ForgeMod mod; + + public ForgePlayer(ForgeMod mod, UUID playerUuid) { + this.uuid = playerUuid; + this.mod = mod; + + update(); + } + + @Override + public UUID getUuid() { + return this.uuid; + } + + @Override + public Text getName() { + return this.name; + } + + @Override + public UUID getWorld() { + return this.world; + } + + @Override + public Vector3d getPosition() { + return this.position; + } + + @Override + public boolean isOnline() { + return this.online; + } + + @Override + public boolean isSneaking() { + return this.sneaking; + } + + @Override + public boolean isInvisible() { + return this.invisible; + } + + @Override + public Gamemode getGamemode() { + return this.gamemode; + } + + /** + * Only call on server thread! + */ + public void update() { + MinecraftServer server = mod.getServer(); + if (server == null) { + this.online = false; + return; + } + + ServerPlayer player = server.getPlayerList().getPlayer(uuid); + if (player == null) { + this.online = false; + return; + } + + this.gamemode = GAMEMODE_MAP.getOrDefault(player.gameMode.getGameModeForPlayer(), Gamemode.SURVIVAL); + if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL; + + MobEffectInstance invis = player.getEffect(MobEffects.INVISIBILITY); + this.invisible = invis != null && invis.getDuration() > 0; + + this.name = Text.of(player.getName().getString()); + this.online = true; + + Vec3 pos = player.getPosition(1f); + this.position = new Vector3d(pos.x(), pos.y(), pos.z()); + this.sneaking = player.isCrouching(); + + try { + this.world = mod.getUUIDForWorld((ServerLevel) player.getCommandSenderWorld()); + } catch (IOException | ClassCastException e) { + this.world = UNKNOWN_WORLD_UUID; + } + } + +} diff --git a/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java new file mode 100644 index 00000000..fa6664ec --- /dev/null +++ b/implementations/forge-1.18.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java @@ -0,0 +1,69 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.bluecolored.bluemap.forge; + +import org.apache.logging.log4j.Logger; + +import de.bluecolored.bluemap.core.logger.AbstractLogger; + +public class Log4jLogger extends AbstractLogger { + + private Logger out; + + public Log4jLogger(Logger out) { + this.out = out; + } + + @Override + public void logError(String message, Throwable throwable) { + out.error(message, throwable); + } + + @Override + public void logWarning(String message) { + out.warn(message); + } + + @Override + public void logInfo(String message) { + out.info(message); + } + + @Override + public void logDebug(String message) { + if (out.isDebugEnabled()) out.debug(message); + } + + @Override + public void noFloodDebug(String message) { + if (out.isDebugEnabled()) super.noFloodDebug(message); + } + + @Override + public void noFloodDebug(String key, String message) { + if (out.isDebugEnabled()) super.noFloodDebug(key, message); + } + +} diff --git a/implementations/forge-1.18.1/src/main/resources/META-INF/mods.toml b/implementations/forge-1.18.1/src/main/resources/META-INF/mods.toml new file mode 100644 index 00000000..2ddbaaf1 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/META-INF/mods.toml @@ -0,0 +1,26 @@ +modLoader="javafml" +loaderVersion="[39,)" +license="MIT" +issueTrackerURL="https://github.com/BlueMap-Minecraft/BlueMap/issues" +[[mods]] +modId="bluemap" +version="${version}" +displayName="BlueMap" +displayURL="https://github.com/BlueMap-Minecraft/BlueMap" +authors="Blue (TBlueF, Lukas Rieger)" +description=''' +A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL) +''' + +[[dependencies.bluemap]] + modId="forge" + mandatory=true + versionRange="[39,)" + ordering="NONE" + side="SERVER" +[[dependencies.bluemap]] + modId="minecraft" + mandatory=true + versionRange="[1.18.1,)" + ordering="NONE" + side="SERVER" diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core-defaults.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core-defaults.conf new file mode 100644 index 00000000..ace808ab --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core-defaults.conf @@ -0,0 +1,4 @@ +accept-download: false +renderThreadCount: -2 +metrics: true +data: "bluemap" \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core.conf new file mode 100644 index 00000000..0be0b0a2 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/core.conf @@ -0,0 +1,30 @@ +## ## +## BlueMap ## +## Core-Config ## +## ## + +# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula), +# you confirm that you own a license to Minecraft (Java Edition) +# and you agree that BlueMap will download and use a minecraft-client file (depending on the minecraft-version) from mojangs servers (https://launcher.mojang.com/) for you. +# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA. +# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.) +# %datetime-iso% +accept-download: false + +# This changes the amount of threads that BlueMap will use to render the maps. +# A higher value can improve render-speed but could impact performance on the host machine. +# This should be always below or equal to the number of available processor-cores. +# Zero or a negative value means the amount of of available processor-cores subtracted by the value. +# (So a value of -2 with 6 cores results in 4 render-processes) +# Default is -2 +renderThreadCount: -2 + +# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/ +# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :) +# An example report looks like this: {"implementation":"bukkit","version":"%version%"} +# Default is true +metrics: true + +# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later. +# Default is "bluemap" +data: "bluemap" \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin-defaults.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin-defaults.conf new file mode 100644 index 00000000..eb00e77c --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin-defaults.conf @@ -0,0 +1,7 @@ +liveUpdates: true +skinDownload: true +hiddenGameModes: [] +hideInvisible: true +hideSneaking: false +playerRenderLimit: -1 +fullUpdateInterval: 1440 \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin.conf new file mode 100644 index 00000000..c4261219 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/plugin.conf @@ -0,0 +1,39 @@ +## ## +## BlueMap ## +## Plugin-Config ## +## ## + +# If the server should send live-updates and player-positions. +# This only works if the integrated webserver is enabled. +# Default is true +liveUpdates: true + +# Download the skin from mojang-serves when a player joins your server, so it can be used for the player-markers. +# Default is true +skinDownload: true + +# A list of gamemodes that will prevent a player from appearing on the map. +# Possible values are: survival, creative, spectator, adventure +hiddenGameModes: [ + "spectator" +] + +# If this is true, players that have an invisibility (potion-)effect will be hidden on the map. +# Default is true +hideInvisible: true + +# If this is true, players that are sneaking will be hidden on the map. +# Default is false +hideSneaking: false + +# The amount of players that is needed to pause BlueMap's render-threads. +# -> If this amount of players or more is online, bluemap will stop rendering map-updates until enough players +# have logged off again +# Setting this to 0 or -1 will disable this feature -> bluemap will not pause rendering +# Default is -1 +playerRenderLimit: -1 + +# The interval in minutes in which a full map-update will be triggered. +# This is additionally!! to the normal map-update process (in case that fails to detect any file-changes). +# Default is 1440 (24 hours) +fullUpdateInterval: 1440 diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render-defaults.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render-defaults.conf new file mode 100644 index 00000000..3b775ae3 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render-defaults.conf @@ -0,0 +1,4 @@ +webroot: "bluemap/web" +useCookies: true +enableFreeFlight: true +maps: [] diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render.conf new file mode 100644 index 00000000..5a0ff02f --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/render.conf @@ -0,0 +1,147 @@ +## ## +## BlueMap ## +## Render-Config ## +## ## + +# The folder (webroot) where the map-data and web-application files will be saved. +# Default is "bluemap/web" +webroot: "bluemap/web" + +# If the web-application should use cookies to save the configurations of a user. +# Default is true +useCookies: true + +# If the free-flight-mode in the web-application is enabled or not. +# Default is true +enableFreeFlight: true + +# This is an array with multiple configured maps. +# You can define multiple maps, for different worlds with different render-settings here +maps: [ + + { + # The id of this map + # Should only contain word-charactes: [a-zA-Z0-9_] + # Changing this value breaks your existing renders. + id: "world" + + # The name of this map + # This defines the display name of this map, you can change this at any time. + # Default is the id of this map + name: "World" + + # The path to the save-folder of the world to render. + world: "world" + + # The position on the world where the map will be centered if you open it. + # You can change this at any time. + # This defaults to the world-spawn if you don't set it. + #startPos: [500, -820] + + # The color of thy sky as a hex-color + # You can change this at any time. + # Default is "#7dabff" + skyColor: "#7dabff" + + # Defines the ambient light-strength that every block is recieving, regardless of the sunlight/blocklight. + # 0 is no ambient light, 1 is fully lighted. + # Changing this value requires a re-render of the map. + # Default is 0 + ambientLight: 0.1 + + # Defines the skylight level that the sky of the world is emitting. + # This should always be equivalent to the maximum ingame sky-light for that world! + # If this is a normal overworld dimension, set this to 15 (max). + # If this is a normal nether or end dimension, set this to 0 (min). + # Changing this value requires a re-render of the map. + # Default is 15 + worldSkyLight: 15 + + # BlueMap tries to omit all blocks that are below this Y-level and are not visible from above-ground. + # More specific: Block-Faces that have a sunlight/skylight value of 0 are removed. + # This improves the performance of the map on slower devices by a lot, but might cause some blocks to disappear that should normally be visible. + # Changing this value requires a re-render of the map. + # Set to a very high value to remove caves everywhere (e.g. 10000) + # Set to a very low value to remove nothing and render all caves (e.g. -10000) + # Default is 55 (slightly below water-level) + removeCavesBelowY: 55 + + # With this value set to true, BlueMap uses the block-light value instead of the sky-light value to "detect caves". + # (See: removeCavesBelowY) + # Default is false + caveDetectionUsesBlockLight: false + + # With the below values you can limit the map-render. + # This can be used to ignore the nethers ceiling or render only a certain part of a world. + # Changing this values might require a re-render of the map, already rendered tiles outside the limits will not be deleted. + # Default is no min or max value (= infinite bounds) + #minX: -4000 + #maxX: 4000 + #minZ: -4000 + #maxZ: 4000 + #minY: 50 + #maxY: 126 + + # Using this, BlueMap pretends that every Block out of the defined render-bounds is AIR, + # this means you can see the blocks where the world is cut (instead of having a see-through/xray view). + # This has only an effect if you set some render-bounds above. + # Changing this value requires a re-render of the map. + # Default is true + renderEdges: true + + # With this set to true, the generated files for this world are compressed using gzip to save A LOT of space. + # Files will be only 5% as big with compression! + # Note: If you are using NGINX or Apache to host your map, you can configure them to serve the compressed files directly. + # This is much better than disabling the compression. + # Changing this value requires a re-render of the map. + # Default is true + useCompression: true + + # Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks. + # If this is set to true BlueMap will render Chunks even if there is no light-data! + # This can be usefull for example if some mod prevents light-data from being saved correctly. + # However, this also has a few drawbacks: + # - For those chunks, every block will always be fully lit + # - Night-mode might not work correctly + # - Caves will always be rendered (ignoring the 'renderCaves' setting) + # Default is false + ignoreMissingLightData: false + } + + # Here another example for the End-Map + # Things we don't want to change from default we can just omit + { + id: "end" + name: "End" + world: "world/DIM1" + + # We dont want a blue sky in the end + skyColor: "#080010" + + # In the end is no sky-light, so we need to set this or we won't see anything. + removeCavesBelowY: -10000 + worldSkyLight: 0 + + # Same here, we don't want a dark map. But not completely lighted, so we see the effect of e.g torches. + ambientLight: 0.6 + } + + # Here another example for the Nether-Map + { + id: "nether" + name: "Nether" + world: "world/DIM-1" + + skyColor: "#290000" + worldSkyLight: 0 + + removeCavesBelowY: -10000 + ambientLight: 0.6 + + # We slice the whole world at y:90 so every block above 90 will be air. + # This way we don't render the nethers ceiling. + maxY: 90 + renderEdges: true + } + +] diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver-defaults.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver-defaults.conf new file mode 100644 index 00000000..55e8c255 --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver-defaults.conf @@ -0,0 +1,4 @@ +enabled: true +webroot: "bluemap/web" +port: 8100 +maxConnectionCount: 100 \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver.conf b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver.conf new file mode 100644 index 00000000..8c14fd9d --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/de/bluecolored/bluemap/webserver.conf @@ -0,0 +1,33 @@ +## ## +## BlueMap ## +## Webserver-Config ## +## ## + +# With this setting you can disable the integrated web-server. +# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver. +# Default is enabled +enabled: true + +# The webroot that the server will host to the web. +# Usually this should be set to the same directory like in the render.conf! +# Default is "bluemap/web" +webroot: "bluemap/web" + +# The IP-Address that the webserver binds to. +# Use "0.0.0.0" to bind to all available local addresses. +# If you only want to access it locally use "localhost". +# +# LEAVE THIS SETTING AS IT IS if you don't have a good reason to change it! +# The default setting (0.0.0.0) is working on almost all servers. +# +# Default is "0.0.0.0" +#ip: "localhost" +#ip: "123.45.6.78" + +# The port that the webserver listens to. +# Default is 8100 +port: 8100 + +# Max number of simultaneous connections that the webserver allows +# Default is 100 +maxConnectionCount: 100 \ No newline at end of file diff --git a/implementations/forge-1.18.1/src/main/resources/pack.mcmeta b/implementations/forge-1.18.1/src/main/resources/pack.mcmeta new file mode 100644 index 00000000..0f95ce1c --- /dev/null +++ b/implementations/forge-1.18.1/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "BlueMap - A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)", + "pack_format": 8 + } +} diff --git a/implementations/spigot/build.gradle b/implementations/spigot/build.gradle deleted file mode 100644 index 61caed4e..00000000 --- a/implementations/spigot/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -repositories { - maven { - url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - - content { - includeGroup 'org.spigotmc' - } - } -} - -dependencies { - shadow "org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT" - - implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' - - implementation (project(':BlueMapCommon')) { - //exclude dependencies provided by bukkit - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - } -} - -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-spigot.jar") - - //relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'org.apache.commons.io', 'de.bluecolored.shadow.apache.commons.io' - relocate 'org.apache.commons.lang3', 'de.bluecolored.shadow.apache.commons.lang3' - relocate 'org.bstats', 'de.bluecolored.shadow.bstats' - relocate 'com.mojang.brigadier', 'de.bluecolored.shadow.mojang.brigadier' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'javax.inject', 'de.bluecolored.shadow.javax.inject' - relocate 'com.google.inject', 'de.bluecolored.shadow.google.inject' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -processResources { - from(sourceSets.main.resources.srcDirs) { - include 'plugin.yml' - duplicatesStrategy = DuplicatesStrategy.WARN - - expand ( - version: project.version - ) - } -} diff --git a/implementations/spigot/build.gradle.kts b/implementations/spigot/build.gradle.kts new file mode 100644 index 00000000..4b67553b --- /dev/null +++ b/implementations/spigot/build.gradle.kts @@ -0,0 +1,119 @@ +import java.util.Properties + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.bukkit" +version = releaseProperties["version"].toString() + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + content { + includeGroup ("org.spigotmc") + } + } + maven { + setUrl("https://oss.sonatype.org/content/repositories/snapshots") + } +} + +dependencies { + api ("de.bluecolored.bluemap.common:BlueMapCommon") { + //exclude dependencies provided by bukkit + exclude( group = "com.google.guava", module = "guava" ) + exclude( group = "com.google.code.gson", module = "gson" ) + } + + shadow ("org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT") + implementation ("org.bstats:bstats-bukkit:2.2.1") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + from("src/main/resources") { + include("plugin.yml") + duplicatesStrategy = DuplicatesStrategy.INCLUDE + + expand ( + "version" to project.version + ) + } +} + +tasks.shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("org.bstats", "de.bluecolored.shadow.bstats") + relocate ("com.mojang.brigadier", "de.bluecolored.shadow.mojang.brigadier") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") + relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + relocate ("org.apache.commons", "de.bluecolored.shadow.apache.commons") +} + +tasks.register("release") { + dependsOn(tasks.shadowJar) +} diff --git a/implementations/spigot/gradle/wrapper/gradle-wrapper.jar b/implementations/spigot/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/spigot/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/spigot/gradle/wrapper/gradle-wrapper.properties b/implementations/spigot/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..69a97150 --- /dev/null +++ b/implementations/spigot/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/spigot/gradlew b/implementations/spigot/gradlew new file mode 100644 index 00000000..744e882e --- /dev/null +++ b/implementations/spigot/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/implementations/spigot/gradlew.bat b/implementations/spigot/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/spigot/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/spigot/settings.gradle.kts b/implementations/spigot/settings.gradle.kts new file mode 100644 index 00000000..72805d80 --- /dev/null +++ b/implementations/spigot/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "spigot" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/sponge-8.0.0/build.gradle b/implementations/sponge-8.0.0/build.gradle deleted file mode 100644 index d3e1c67f..00000000 --- a/implementations/sponge-8.0.0/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -import org.spongepowered.gradle.plugin.config.PluginLoaders -import org.spongepowered.plugin.metadata.model.PluginDependency - -plugins { - id 'org.spongepowered.gradle.plugin' version '2.0.0' -} - -sponge { - apiVersion("8.0.0-SNAPSHOT") - license("MIT") - loader { - name(PluginLoaders.JAVA_PLAIN) - version("1.0") - } - plugin("bluemap") { - displayName("bluemap") - entrypoint("de.bluecolored.bluemap.sponge8.SpongePlugin") - description("A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)") - contributor("Blue (TBlueF, Lukas Rieger)") { - description("Lead Developer") - } - dependency("spongeapi") { - loadOrder(PluginDependency.LoadOrder.AFTER) - version("8.0.0-SNAPSHOT") - optional(false) - } - } -} - -dependencies { - implementation group: 'org.bstats', name: 'bstats-sponge', version: '2.2.1' - - implementation (project(':BlueMapCommon')) { - //exclude dependencies provided by sponge - exclude group: 'com.google.guava', module: 'guava' - exclude group: 'com.google.code.gson', module: 'gson' - exclude group: 'org.apache.commons', module: 'commons-lang3' - exclude group: 'javax.inject' - exclude group: 'com.google.inject' - } -} - - -build.dependsOn shadowJar { - destinationDirectory = file '../../build/release' - archiveFileName.set("BlueMap-${archiveVersion.get()}-sponge-8.0.0.jar") - - relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt' - relocate 'org.apache.commons.io', 'de.bluecolored.shadow.apache.commons.io' - relocate 'com.mojang.brigadier', 'de.bluecolored.shadow.mojang.brigadier' - relocate 'com.github.benmanes.caffeine', 'de.bluecolored.shadow.benmanes.caffeine' - relocate 'com.google.errorprone', 'de.bluecolored.shadow.google.errorprone' - relocate 'org.spongepowered.configurate', 'de.bluecolored.shadow.configurate' - relocate 'org.aopalliance', 'de.bluecolored.shadow.aopalliance' - relocate 'org.bstats', 'de.bluecolored.shadow.bstats' - relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config' - relocate 'org.checkerframework', 'de.bluecolored.shadow.checkerframework' - relocate 'org.codehaus', 'de.bluecolored.shadow.codehaus' - relocate 'io.leangen.geantyref', 'de.bluecolored.shadow.geantyref' -} - -processResources { - from(sourceSets.main.resources.srcDirs) { - include 'META-INF/plugins.json' - duplicatesStrategy = DuplicatesStrategy.WARN - - expand ( - version: project.version - ) - } -} diff --git a/implementations/sponge-8.0.0/build.gradle.kts b/implementations/sponge-8.0.0/build.gradle.kts new file mode 100644 index 00000000..0a6a3729 --- /dev/null +++ b/implementations/sponge-8.0.0/build.gradle.kts @@ -0,0 +1,133 @@ +import java.util.Properties +import org.spongepowered.gradle.plugin.config.PluginLoaders + +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" + id ("com.palantir.git-version") version "0.12.3" + id ("com.github.node-gradle.node") version "3.0.1" + id ("com.github.johnrengelman.shadow") version "7.1.2" + id ("org.spongepowered.gradle.plugin") version "2.0.0" +} + +val versionDetails: groovy.lang.Closure by extra +val git = versionDetails() + +val releaseProperties = Properties() +releaseProperties.load(file("../../release.properties").inputStream()) + +group = "de.bluecolored.bluemap.bukkit" +version = releaseProperties["version"].toString() + +val javaTarget = 16 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() + maven { + setUrl("https://libraries.minecraft.net") + } + maven { + setUrl("https://jitpack.io") + } +} + +dependencies { + api ("de.bluecolored.bluemap.common:BlueMapCommon"){ + //exclude dependencies provided by sponge + exclude( group = "com.google.guava", module = "guava" ) + exclude( group = "com.google.code.gson", module = "gson" ) + exclude( group = "org.apache.commons", module = "commons-lang3" ) + exclude( group = "javax.inject" ) + exclude( group = "com.google.inject" ) + } + + implementation ("org.bstats:bstats-sponge:2.2.1") + + testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") + testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") +} + +sponge { + apiVersion("8.0.0-SNAPSHOT") + license("MIT") + loader { + name(PluginLoaders.JAVA_PLAIN) + version("1.0") + } + plugin("bluemap") { + displayName("bluemap") + entrypoint("de.bluecolored.bluemap.sponge8.SpongePlugin") + description("A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)") + contributor("Blue (TBlueF, Lukas Rieger)") { + description("Lead Developer") + } + dependency("spongeapi") { + version("8.0.0-SNAPSHOT") + optional(false) + } + } +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("../../HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.test { + useJUnitPlatform() +} + +tasks.processResources { + from("src/main/resources") { + include("META-INF/plugins.json") + duplicatesStrategy = DuplicatesStrategy.INCLUDE + + expand ( + "version" to project.version + ) + } +} + +tasks.shadowJar { + destinationDirectory.set(file("../../build/release")) + archiveFileName.set("BlueMap-${archiveVersion.get()}-${project.name}.jar") + + //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it + relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") + relocate ("com.mojang.brigadier", "de.bluecolored.shadow.mojang.brigadier") + relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") + relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") + relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") + relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") + relocate ("org.bstats", "de.bluecolored.shadow.bstats") + relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") + relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") + relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") + relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") + relocate ("org.apache.commons", "de.bluecolored.shadow.apache.commons") +} + +tasks.register("release") { + dependsOn(tasks.shadowJar) +} diff --git a/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.jar b/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.jar differ diff --git a/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.properties b/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..69a97150 --- /dev/null +++ b/implementations/sponge-8.0.0/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/implementations/sponge-8.0.0/gradlew b/implementations/sponge-8.0.0/gradlew new file mode 100644 index 00000000..744e882e --- /dev/null +++ b/implementations/sponge-8.0.0/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/implementations/sponge-8.0.0/gradlew.bat b/implementations/sponge-8.0.0/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/implementations/sponge-8.0.0/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" "-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 execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/implementations/sponge-8.0.0/settings.gradle.kts b/implementations/sponge-8.0.0/settings.gradle.kts new file mode 100644 index 00000000..678b2608 --- /dev/null +++ b/implementations/sponge-8.0.0/settings.gradle.kts @@ -0,0 +1,3 @@ +rootProject.name = "sponge-8.0.0" + +includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/release.properties b/release.properties new file mode 100644 index 00000000..55c09049 --- /dev/null +++ b/release.properties @@ -0,0 +1 @@ +version=1.7.2 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e8f33ce1..00000000 --- a/settings.gradle +++ /dev/null @@ -1,56 +0,0 @@ -pluginManagement { - repositories { - jcenter() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } -} - -rootProject.name = 'BlueMap' - - -include ':BlueMapAPI' -include ':BlueMapCore' -include ':BlueMapCommon' - -include ':cli' - -include ':sponge-8.0.0' - -include ':spigot' - -//include ':forge-1.14.4' -//include ':forge-1.15.2' -include ':forge-1.16.2' -include ':forge-1.17.1' - -//include ':fabric-1.15.2' -//include ':fabric-1.16.1' -include ':fabric-1.16.2' -include ':fabric-1.17' -include ':fabric-1.18' - - -project(':BlueMapAPI').projectDir = "$rootDir/BlueMapAPI" as File -project(':BlueMapCore').projectDir = "$rootDir/BlueMapCore" as File -project(':BlueMapCommon').projectDir = "$rootDir/BlueMapCommon" as File - -project(':cli').projectDir = "$rootDir/implementations/cli" as File - -project(':sponge-8.0.0').projectDir = "$rootDir/implementations/sponge-8.0.0" as File - -project(':spigot').projectDir = "$rootDir/implementations/spigot" as File - -//project(':forge-1.14.4').projectDir = "$rootDir/implementations/forge-1.14.4" as File -//project(':forge-1.15.2').projectDir = "$rootDir/implementations/forge-1.15.2" as File -project(':forge-1.16.2').projectDir = "$rootDir/implementations/forge-1.16.2" as File -project(':forge-1.17.1').projectDir = "$rootDir/implementations/forge-1.17.1" as File - -//project(':fabric-1.15.2').projectDir = "$rootDir/implementations/fabric-1.15.2" as File -//project(':fabric-1.16.1').projectDir = "$rootDir/implementations/fabric-1.16.1" as File -project(':fabric-1.16.2').projectDir = "$rootDir/implementations/fabric-1.16.2" as File -project(':fabric-1.17').projectDir = "$rootDir/implementations/fabric-1.17" as File -project(':fabric-1.18').projectDir = "$rootDir/implementations/fabric-1.18" as File diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..24de94a0 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,19 @@ +rootProject.name = "BlueMap" + +includeBuild("implementations/cli") + +includeBuild("implementations/fabric-1.15.2") +includeBuild("implementations/fabric-1.16.1") +includeBuild("implementations/fabric-1.16.2") +includeBuild("implementations/fabric-1.17") +includeBuild("implementations/fabric-1.18") + +includeBuild("implementations/forge-1.14.4") +includeBuild("implementations/forge-1.15.2") +includeBuild("implementations/forge-1.16.2") +includeBuild("implementations/forge-1.17.1") +includeBuild("implementations/forge-1.18.1") + +includeBuild("implementations/spigot") + +includeBuild("implementations/sponge-8.0.0")