diff --git a/.gitignore b/.gitignore index aff61aa60..d75be39d5 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ local.properties .settings/ .loadpath .recommenders +.classpath # External tool builders .externalToolBuilders/ @@ -98,6 +99,7 @@ local.properties # Package Files # *.jar +!gradle/wrapper/gradle-wrapper.jar *.war *.nar *.ear diff --git a/bootstrap/mod/fabric/build.gradle.kts b/bootstrap/mod/fabric/build.gradle.kts index 17192e1db..6b77303cf 100644 --- a/bootstrap/mod/fabric/build.gradle.kts +++ b/bootstrap/mod/fabric/build.gradle.kts @@ -8,6 +8,16 @@ architectury { fabric() } +loom { + mods { + create("geyser-fabric") { + sourceSet(sourceSets.main.get()) + sourceSet("main", projects.mod) + sourceSet("main", projects.core) + } + } +} + dependencies { modImplementation(libs.fabric.loader) modApi(libs.fabric.api) diff --git a/bootstrap/mod/neoforge/build.gradle.kts b/bootstrap/mod/neoforge/build.gradle.kts index dc2d96813..ba8daa13d 100644 --- a/bootstrap/mod/neoforge/build.gradle.kts +++ b/bootstrap/mod/neoforge/build.gradle.kts @@ -8,6 +8,16 @@ architectury { neoForge() } +loom { + mods { + create("geyser-neoforge") { + sourceSet(sourceSets.main.get()) + sourceSet("main", projects.mod) + sourceSet("main", projects.core) + } + } +} + // This is provided by "org.cloudburstmc.math.mutable" too, so yeet. // NeoForge's class loader is *really* annoying. provided("org.cloudburstmc.math", "api") diff --git a/bootstrap/mod/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/bootstrap/mod/neoforge/src/main/resources/META-INF/neoforge.mods.toml index cc27f1657..9169b382e 100644 --- a/bootstrap/mod/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/bootstrap/mod/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -3,7 +3,7 @@ loaderVersion="[1,)" license="MIT" [[mods]] modId="geyser_neoforge" -version="${version}" +version="${file.jarVersion}" displayName="Geyser" displayURL="https://geysermc.org/" logoFile= "../assets/geyser/icon.png" diff --git a/bootstrap/spigot/build.gradle.kts b/bootstrap/spigot/build.gradle.kts index 7d27971e8..2a3ec57fa 100644 --- a/bootstrap/spigot/build.gradle.kts +++ b/bootstrap/spigot/build.gradle.kts @@ -87,5 +87,6 @@ modrinth { tasks { runServer { minecraftVersion(libs.versions.runpaperversion.get()) + jvmArgs("-Dcom.mojang.eula.agree=true") } } diff --git a/bootstrap/standalone/build.gradle.kts b/bootstrap/standalone/build.gradle.kts index f7583436e..754c63ed7 100644 --- a/bootstrap/standalone/build.gradle.kts +++ b/bootstrap/standalone/build.gradle.kts @@ -34,6 +34,10 @@ tasks.withType { archiveBaseName.set("Geyser-Standalone") transform(Log4j2PluginsCacheFileTransformer()) + // https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy + filesMatching("META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat") { + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } } tasks.named("run") { diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index b87490880..6c135a340 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -25,4 +25,5 @@ dependencies { implementation(libs.architectury.plugin) implementation(libs.architectury.loom) implementation(libs.minotaur) + implementation(libs.loom.companion) } diff --git a/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts index 107068819..3311d5ddf 100644 --- a/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts @@ -22,7 +22,7 @@ indra { } dependencies { - compileOnly("org.checkerframework", "checker-qual", libs.checker.qual.get().version) + compileOnly("org.checkerframework:checker-qual:" + libs.checker.qual.get().version) } repositories { diff --git a/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts index 7a342783b..bbb18ff0e 100644 --- a/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts @@ -11,7 +11,11 @@ tasks { "id" to "geyser", "name" to "Geyser", "version" to project.version, - "description" to project.description, + // Must be this for gradle :neoforge:runServer task to work + "file" to mapOf( + "jarVersion" to project.version + ), + "description" to project.description as String, "url" to "https://geysermc.org", "author" to "GeyserMC" ) diff --git a/build-logic/src/main/kotlin/geyser.publish-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.publish-conventions.gradle.kts index eca587721..036ee803c 100644 --- a/build-logic/src/main/kotlin/geyser.publish-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.publish-conventions.gradle.kts @@ -7,9 +7,3 @@ indra { publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots") publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases") } - -publishing { - // skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651 - val javaComponent = project.components["java"] as AdhocComponentWithVariants - javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() } -} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts index c160e5ec6..dd25139cd 100644 --- a/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts @@ -2,35 +2,37 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { id("geyser.base-conventions") - id("com.github.johnrengelman.shadow") + id("com.gradleup.shadow") +} + +shadow { + addShadowVariantIntoJavaComponent = false } tasks { named("jar") { from(project.rootProject.file("LICENSE")) } + val shadowJar = named("shadowJar") { archiveBaseName.set(project.name) archiveVersion.set("") archiveClassifier.set("") + + val currentProjectName = project.name // Capture project name at config time - val sJar: ShadowJar = this - - doFirst { - providedDependencies[project.name]?.forEach { string -> - sJar.dependencies { - println("Excluding $string from ${project.name}") - exclude(dependency(string)) - } + dependencies { + providedDependencies[currentProjectName]?.forEach { string -> + println("Excluding $string from $currentProjectName") + exclude(dependency(string)) } - sJar.dependencies { - exclude(dependency("org.checkerframework:checker-qual:.*")) - exclude(dependency("org.jetbrains:annotations:.*")) - } + exclude(dependency("org.checkerframework:checker-qual:.*")) + exclude(dependency("org.jetbrains:annotations:.*")) } } + named("build") { dependsOn(shadowJar) } -} \ No newline at end of file +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index bd535a30d..fb62468d6 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,9 +1,18 @@ +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.revwalk.RevWalk +import net.kyori.indra.git.RepositoryValueSource + +import java.util.Properties + plugins { // Allow blossom to mark sources root of templates idea + eclipse alias(libs.plugins.blossom) id("geyser.publish-conventions") id("io.freefair.lombok") + // Allows fabric/neoforge runServer gradle tasks to work correctly + id("dev.architectury.loom-companion") } dependencies { @@ -69,9 +78,11 @@ dependencies { } // Test + testImplementation(platform("org.junit:junit-bom:6.0.0")) testImplementation(libs.junit) testImplementation(libs.gson.runtime) // Record support testImplementation(libs.mockito) + testRuntimeOnly("org.junit.platform:junit-platform-launcher") // Annotation Processors compileOnly(projects.ap) @@ -83,35 +94,114 @@ dependencies { api(libs.bstats) } -tasks.processResources { - // This is solely for backwards compatibility for other programs that used this file before the switch to gradle. - // It used to be generated by the maven Git-Commit-Id-Plugin - filesMatching("git.properties") { - val info = GitInfo() - expand( - "branch" to info.branch, - "buildNumber" to info.buildNumber, - "projectVersion" to info.version, - "commit" to info.commit, - "commitAbbrev" to info.commitAbbrev, - "commitMessage" to info.commitMessage, - "repository" to info.repository - ) +abstract class CommitMessageValueSource : RepositoryValueSource.Parameterless() { + override fun obtain(repository: Git): String? { + val headCommitId = repository.repository.resolve("HEAD") + + if (headCommitId == null) { + return "" + } + + RevWalk(repository.repository).use { walk -> + val commit = walk.parseCommit(headCommitId) + return commit.fullMessage + } } } +abstract class RepositoryUrlValueSource : RepositoryValueSource.Parameterless() { + override fun obtain(repository: Git): String? { + return repository.repository.config.getString("remote", "origin", "url") + } +} + +val gitBranch = indraGit.branchName().orElse("DEV") +val gitCommit = indraGit.commit() + +val gitCommitName = gitCommit.map { it?.name ?: "0".repeat(40) } +val gitCommitAbbrev = gitCommit.map { it?.name?.substring(0, 7) ?: "0".repeat(7) } + +val gitCommitMessage = indraGit.repositoryValue(CommitMessageValueSource::class.java).orElse("") +val gitRepositoryUrl = indraGit.repositoryValue(RepositoryUrlValueSource::class.java).orElse("").map { + it.replace("git@github.com:", "https://github.com/") +} + +val gitRepositoryIsDev = gitBranch.zip(gitRepositoryUrl) { branch, repo -> + isDevBuild(branch, repo) +} + +val gitVersion = gitBranch.zip(gitCommitAbbrev) { branch, commit -> + "git-${branch}-${commit}" +} + +val projectVersionProvider = gitRepositoryIsDev.map { isDev -> + if (isDev) project.version.toString() else projectVersion(project).toString() +} + +val finalVersion = projectVersionProvider.zip(gitVersion) { projVer, gitVer -> + "$projVer ($gitVer)" +} + +val buildNumber = provider { buildNumber().toString() } + +val gitPropertiesMap = mapOf( + "git.branch" to gitBranch, + "git.build.number" to buildNumber, + "git.build.version" to finalVersion, + "git.commit.id" to gitCommitName, + "git.commit.id.abbrev" to gitCommitAbbrev, + "git.commit.message.full" to gitCommitMessage, + "git.remote.origin.url" to gitRepositoryUrl +) + +val generateGitProperties = tasks.register("generateGitProperties") { + description = "Generates git.properties from Git information." + group = "build" + + inputs.properties(gitPropertiesMap) + + val generatedPropsFile = layout.buildDirectory.file("generated/git/git.properties") + outputs.file(generatedPropsFile) + + doLast { + val props = Properties() + gitPropertiesMap.forEach { (key, provider) -> + props[key] = provider.get() + } + + generatedPropsFile.get().asFile.apply { + parentFile.mkdirs() + writer().use { props.store(it, null) } + // remove comment line + val lines = readLines() + if (lines.isNotEmpty()) { + writeText(lines.drop(1).joinToString("\n", postfix = "\n")) + } + } + } +} + +tasks.processResources { + from(generateGitProperties) { + into(".") + } +} + +tasks.named("sourcesJar") { + dependsOn(tasks.named("processResources")) +} + sourceSets { main { blossom { - val info = GitInfo() javaSources { - property("version", info.version) - property("gitVersion", info.gitVersion) - property("buildNumber", info.buildNumber.toString()) - property("branch", info.branch) - property("commit", info.commit) - property("repository", info.repository) - property("devVersion", info.isDev.toString()) + property("version", finalVersion) + property("gitVersion", gitVersion) + property("buildNumber", buildNumber) + property("branch", gitBranch) + property("commit", gitCommitName) + property("repository", gitRepositoryUrl) + property("devVersion", gitRepositoryIsDev.map { it.toString() }) } } } @@ -121,40 +211,6 @@ fun isDevBuild(branch: String, repository: String): Boolean { return branch != "master" || repository.equals("https://github.com/GeyserMC/Geyser", ignoreCase = true).not() } -inner class GitInfo { - val branch: String - val commit: String - val commitAbbrev: String - - val gitVersion: String - val version: String - val buildNumber: Int - - val commitMessage: String - val repository: String - - val isDev: Boolean - - init { - branch = indraGit.branchName() ?: "DEV" - - val commit = indraGit.commit() - this.commit = commit?.name ?: "0".repeat(40) - commitAbbrev = commit?.name?.substring(0, 7) ?: "0".repeat(7) - - gitVersion = "git-${branch}-${commitAbbrev}" - - val git = indraGit.git() - commitMessage = git?.commit()?.message ?: "" - repository = git?.repository?.config?.getString("remote", "origin", "url") ?: "" - - buildNumber = buildNumber() - isDev = isDevBuild(branch, repository) - val projectVersion = if (isDev) project.version else projectVersion(project) - version = "$projectVersion ($gitVersion)" - } -} - // Manual task to download the bedrock data files from the CloudburstMC/Data repository // Invoke with ./gradlew :core:downloadBedrockData --suffix=1_20_70 // Set suffix to the current Bedrock version diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index b992534cd..90ee99e5f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -797,9 +797,10 @@ public class Entity implements GeyserEntity { @Override public void update(@NonNull GeyserEntityProperty property, @Nullable T value) { Objects.requireNonNull(property, "property must not be null!"); - if (!(property instanceof PropertyType propertyType)) { + if (!(property instanceof PropertyType)) { throw new IllegalArgumentException("Invalid property implementation! Got: " + property.getClass().getSimpleName()); } + PropertyType propertyType = (PropertyType) property; int index = propertyDefinitions.getPropertyIndex(property.identifier().toString()); if (index < 0) { throw new IllegalArgumentException("No property with the name " + property.identifier() + " has been registered."); diff --git a/core/src/main/resources/git.properties b/core/src/main/resources/git.properties deleted file mode 100644 index f14e55623..000000000 --- a/core/src/main/resources/git.properties +++ /dev/null @@ -1,7 +0,0 @@ -git.branch=${branch} -git.build.number=${buildNumber} -git.build.version=${projectVersion} -git.commit.id=${commit} -git.commit.id.abbrev=${commitAbbrev} -git.commit.message.full=${commitMessage} -git.remote.origin.url=${repository} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e0b6917be..feb1f8943 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ minecraftauth = "5.0.0" mcprotocollib = "1.21.11-20251210.192611-9" adventure = "4.25.0" adventure-platform = "4.4.1" -junit = "5.9.2" +junit = "6.0.0" checkerframework = "3.19.0" log4j = "2.20.0" jline = "3.21.0" @@ -45,18 +45,21 @@ mixin = "0.8.5" mixinextras = "0.3.5" minecraft = "1.21.11" mockito = "5.+" -runtask = "2.3.1" -runpaperversion = "1.21.11" -runvelocityversion = "3.4.0-SNAPSHOT" # plugin versions -indra = "3.1.3" -shadow = "8.1.1" -architectury-plugin = "3.4-SNAPSHOT" -architectury-loom = "1.13-SNAPSHOT" -minotaur = "2.8.7" -lombok = "8.4" -blossom = "2.1.0" +indra = "4.0.0" +shadow = "9.2.2" +architectury-plugin = "3.4.162" +architectury-loom = "1.13.457" +loom-companion = "1.13.467" +minotaur = "2.8.10" +lombok = "9.1.0" +blossom = "2.2.0" +runtask = "3.0.2" + +# run tasks versions +runpaperversion = "1.21.11" +runvelocityversion = "3.4.0-SNAPSHOT" [libraries] base-api = { group = "org.geysermc.api", name = "base-api", version.ref = "base-api" } @@ -159,10 +162,11 @@ mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" } # plugins lombok = { group = "io.freefair.gradle", name = "lombok-plugin", version.ref = "lombok" } indra = { group = "net.kyori", name = "indra-common", version.ref = "indra" } -shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" } +shadow = { group = "com.gradleup.shadow", name = "com.gradleup.shadow.gradle.plugin", version.ref = "shadow" } architectury-plugin = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" } architectury-loom = { group = "dev.architectury.loom", name = "dev.architectury.loom.gradle.plugin", version.ref = "architectury-loom" } minotaur = { group = "com.modrinth.minotaur", name = "Minotaur", version.ref = "minotaur" } +loom-companion = { group = "dev.architectury.loom-companion", name = "dev.architectury.loom-companion.gradle.plugin", version.ref = "loom-companion" } [plugins] indra = { id = "net.kyori.indra", version.ref = "indra" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b953..f8e1ee312 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da47..bad7c2462 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6d6..adff685a0 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 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. @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -115,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -173,7 +171,6 @@ fi # 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" ) @@ -206,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a2183..e509b2dd8 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,94 +1,93 @@ -@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 -@rem SPDX-License-Identifier: Apache-2.0 -@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=. -@rem This is normally unused -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% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -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% equ 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! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@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=. +@rem This is normally unused +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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega