diff --git a/.travis.yml b/.travis.yml index f5225b8..e85ab9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ dist: trusty language: groovy jdk: - - openjdk8 + - openjdk17 notifications: email: false diff --git a/build.gradle b/build.gradle index 7c7bf59..5ca2fa8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,131 +1,114 @@ +import buildSrc.GroovydocForking + plugins { + id 'java-gradle-plugin' + id 'groovy' + id 'idea' id 'eclipse' id 'maven-publish' - id 'org.cadixdev.licenser' version '0.6.1' - id 'net.minecraftforge.gradleutils' version '2.+' - id 'dev.gradleplugins.groovy-gradle-plugin' version '1.6.9' + alias libs.plugins.gradleutils + alias libs.plugins.gitversion + alias libs.plugins.licenser } -defaultTasks 'updateLicenses', 'build' - -ext.buildType = project.hasProperty("buildType") ? buildType : 'RELEASE' -ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0' -ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown' -ext.commit = project.hasProperty("commit") ? commit : 'unknown' +ext.buildType = project.hasProperty('buildType') ? buildType : 'RELEASE' +ext.buildNumber = project.hasProperty('buildNumber') ? buildNumber : '0' +ext.ciSystem = project.hasProperty('ciSystem') ? ciSystem : 'unknown' +ext.commit = project.hasProperty('commit') ? commit : 'unknown' +gradleutils.displayName = 'SpongePowered Mixin Gradle Plugin' +gradleutils.vendor = 'SpongePowered' +description = 'Gradle plugin for SpongePowered Mixin' group = 'org.spongepowered' -version = buildType == 'SNAPSHOT' ? "$buildVersion-SNAPSHOT" : gradleutils.tagOffsetVersion -archivesBaseName = 'mixingradle' -sourceCompatibility = targetCompatibility = '1.8' +version = buildType == 'SNAPSHOT' ? "${gitversion.info.tag}-SNAPSHOT" : gitversion.tagOffset +final projectUrl = 'https://www.spongepowered.org' -if (JavaVersion.current() != JavaVersion.VERSION_1_8) { - throw new GradleException("The use of the groovydoc task requires the Gradle JVM to be JRE 1.8; please change your Gradle JVM to 1.8") -} +println "Version: $version" + +java.toolchain.languageVersion = JavaLanguageVersion.of(8) repositories { mavenCentral() - maven { - url 'https://repo.gradle.org/gradle/libs-releases-local/' - } + maven gradleutils.forgeMaven } dependencies { - implementation 'com.google.guava:guava:21.0' - implementation 'org.ow2.asm:asm-tree:9.2' + compileOnly libs.gradle + + implementation libs.guava + implementation libs.asm.tree } -processResources { - from 'LICENSE.txt' - duplicatesStrategy 'INCLUDE' +tasks.named('processResources', ProcessResources) { + from 'LICENSE.txt' + + duplicatesStrategy = 'INCLUDE' } license { ext { - name = project.name - organization = project.organization - url = project.url + name = 'MixinGradle' + organization = gradleutils.vendor.get() + url = projectUrl } include '**/*.groovy' - header = file('HEADER.txt') - ignoreFailures = false + header = rootProject.file('HEADER.txt') +} + +tasks.named('groovydoc', Groovydoc) { + enabled = false } -jar { - manifest.mainAttributes ( - "Built-By": System.properties['user.name'], - "Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")", +tasks.register('groovydocForked', GroovydocForking) { + description = 'Generates Groovydoc API documentation for the main source code.' + group = JavaBasePlugin.DOCUMENTATION_GROUP + + classpath = sourceSets.main.output + sourceSets.main.compileClasspath + + source = sourceSets.main.groovy + + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + } +} + +tasks.named('jar', Jar) { + manifest.mainAttributes( + 'Built-By': System.properties['user.name'], + 'Created-By': "${System.properties['java.vm.version']} (${System.properties['java.vm.vendor']})", "Implementation-Title": project.name, - "Implementation-Version": project.version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit, + "Implementation-Version": "${project.version}+${ciSystem}-b${buildNumber}.git-${commit}", ) } -task groovydocJar(type: Jar, dependsOn: groovydoc) { - from groovydoc.destinationDir +tasks.register('groovydocJar', Jar) { + dependsOn groovydocForked + from groovydocForked.destinationDir + archiveClassifier = 'groovydoc' } -artifacts { - archives jar - archives groovydocJar +tasks.named('assemble') { + dependsOn groovydocJar } gradlePlugin { - compatibility { - minimumGradleVersion = '6.6' - } - website = 'http://www.gradle.org/' - vcsUrl = 'https://github.com/SpongePowered/MixinGradle' - plugins { - patcher { - id = 'org.spongepowered.mixin' - implementationClass = 'org.spongepowered.asm.gradle.plugins.MixinGradlePlugin' - displayName = 'SpongePowered Mixin Gradle Plugin' - description = 'Gradle plugin for SpongePowered Mixin' - tags.addAll('spongepowered', 'sponge', 'mixin') - } + website = gitversion.url + vcsUrl = gitversion.url + '.git' + + plugins.register('mixingradle') { + id = 'org.spongepowered.mixin' + implementationClass = 'org.spongepowered.asm.gradle.plugins.MixinGradlePlugin' + displayName = 'SpongePowered Mixin Gradle Plugin' + description = 'Gradle plugin for SpongePowered Mixin' + tags = ['spongepowered', 'sponge', 'mixin'] } - automatedPublishing = true } publishing { - publications { - pluginMaven(MavenPublication) { - // Automated publishing declares the java component for us - - groupId = project.group - version = project.version - artifactId = project.archivesBaseName - - pom { - name = project.archivesBaseName - packaging = 'jar' - description = 'MixinGradle' - url = 'http://www.spongepowered.org/' - - scm { - url = 'https://github.com/SpongePowered/MixinGradle' - connection = 'scm:git:git://github.com/SpongePowered/MixinGradle.git' - developerConnection = 'scm:git:git@github.com:SpongePowered/MixinGradle.git' - } - - issueManagement { - system = 'GitHub Issues' - url = 'https://github.com/SpongePowered/MixinGradle/issues' - } - - licenses { - license { - name = 'MIT license' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } repositories { if (buildType == 'RELEASE') { - if (project.hasProperty("releaseRepo")) { + if (project.hasProperty('releaseRepo')) { maven { credentials { username = project.releaseRepoUsername @@ -134,7 +117,7 @@ publishing { url project.releaseRepo } } - if (project.hasProperty("spongeReleaseRepo")) { + if (project.hasProperty('spongeReleaseRepo')) { maven { credentials { username = project.spongeUsername @@ -143,7 +126,7 @@ publishing { url project.spongeReleaseRepo } } - } else if (project.hasProperty("spongeSnapshotRepo")) { + } else if (project.hasProperty('spongeSnapshotRepo')) { maven { credentials { username = project.spongeUsername @@ -153,4 +136,19 @@ publishing { } } } + + publications.register('pluginMaven', MavenPublication) { + artifact groovydocJar + + pom { pom -> + name = gradleutils.displayName + description = project.description + + gradleutils.pom.addRemoteDetails(pom) + + licenses { + license gradleutils.pom.licenses.MIT + } + } + } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..edc7c91 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' + alias libs.plugins.licenser +} + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +license { + ext { + name = 'MixinGradle' + organization = 'SpongePowered' + url = 'https://www.spongepowered.org' + } + + header = rootProject.file('../HEADER.txt') +} diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 0000000..ed2581d --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'buildSrc' + +dependencyResolutionManagement.versionCatalogs.register('libs') { + plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' +} diff --git a/buildSrc/src/main/java/buildSrc/GroovydocForking.java b/buildSrc/src/main/java/buildSrc/GroovydocForking.java new file mode 100644 index 0000000..978191e --- /dev/null +++ b/buildSrc/src/main/java/buildSrc/GroovydocForking.java @@ -0,0 +1,105 @@ +/* + * This file is part of MixinGradle, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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 buildSrc; + +import org.gradle.api.InvalidUserDataException; +import org.gradle.api.file.FileSystemOperations; +import org.gradle.api.internal.tasks.GroovydocAntAction; +import org.gradle.api.provider.Property; +import org.gradle.api.resources.TextResource; +import org.gradle.api.tasks.CacheableTask; +import org.gradle.api.tasks.Nested; +import org.gradle.api.tasks.javadoc.Groovydoc; +import org.gradle.jvm.toolchain.JavaLauncher; +import org.gradle.workers.WorkQueue; +import org.jspecify.annotations.Nullable; + +import javax.inject.Inject; +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.Collection; + +// This is a Groovydoc task but the Groovydoc ant action runs in a forked JVM using getJavaLauncher() +@CacheableTask +public abstract class GroovydocForking extends Groovydoc { + public abstract @Nested Property getJavaLauncher(); + + protected abstract @Inject FileSystemOperations getFileSystemOperations(); + + @Override + protected void generate() { + this.checkGroovyClasspathNonEmpty(this.getGroovyClasspath().getFiles()); + File destinationDir = this.getDestinationDir(); + + try { + this.getDeleter().ensureEmptyDirectory(destinationDir); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + + FileSystemOperations fsOperations = this.getFileSystemOperations(); + File tmpDir = this.getTemporaryDir(); + fsOperations.delete((spec) -> spec.delete(tmpDir)); + fsOperations.copy((spec) -> spec.from(this.getSource()).into(tmpDir)); + + WorkQueue queue = this.getWorkerExecutor().processIsolation(spec -> spec.forkOptions(fork -> { + fork.setExecutable(getJavaLauncher().get().getExecutablePath().toString()); + })); + + queue.submit(GroovydocAntAction.class, (parameters) -> { + parameters.getAntLibraryClasspath().from(this.getClasspath()); + parameters.getAntLibraryClasspath().from(this.getGroovyClasspath()); + parameters.getSource().convention(this.getSource()); + parameters.getDestinationDirectory().fileValue(destinationDir); + parameters.getUse().convention(this.isUse()); + parameters.getNoTimestamp().convention(this.isNoTimestamp()); + parameters.getNoVersionStamp().convention(this.isNoVersionStamp()); + parameters.getWindowTitle().convention(this.getWindowTitle()); + parameters.getDocTitle().convention(this.getDocTitle()); + parameters.getHeader().convention(this.getHeader()); + parameters.getFooter().convention(this.getFooter()); + parameters.getOverview().convention(this.getPathToOverview()); + parameters.getAccess().convention(this.getAccess()); + parameters.getLinks().convention(this.getLinks()); + parameters.getTmpDir().fileValue(this.getTemporaryDir()); + parameters.getIncludeAuthor().convention(this.getIncludeAuthor()); + parameters.getProcessScripts().convention(this.getProcessScripts()); + parameters.getIncludeMainForScripts().convention(this.getIncludeMainForScripts()); + }); + } + + private void checkGroovyClasspathNonEmpty(Collection classpath) { + if (classpath.isEmpty()) { + throw new InvalidUserDataException("You must assign a Groovy library to the groovy configuration!"); + } + } + + private @Nullable String getPathToOverview() { + TextResource overview = this.getOverviewText(); + return overview != null ? overview.asFile().getAbsolutePath() : null; + } +} diff --git a/gradle.properties b/gradle.properties index 91d5538..727776d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,12 @@ -name=MixinGradle -inceptionYear=2015 -packaging=jar -description=MixinGradle -url=https://www.spongepowered.org -organization=SpongePowered -buildVersion=0.7 +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true + +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn + +systemProp.org.gradle.unsafe.suppress-gradle-api=true + +net.minecraftforge.gradleutils.ide.automatic.sources=true +net.minecraftforge.gradleutils.compilation.defaults=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..8bdaf60 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 37aef8d..bad7c24 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..adff685 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. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# 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\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -111,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. @@ -130,10 +132,13 @@ 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. + if ! command -v java >/dev/null 2>&1 + then + 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 fi # Increase the maximum file descriptors if we can. @@ -141,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -166,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" ) @@ -198,16 +202,15 @@ fi # 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"' -# 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. +# Collect all arguments for the java command: +# * 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 93e3f59..e509b2d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +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 - -@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. -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% 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 diff --git a/settings.gradle b/settings.gradle index 3703f36..da954b0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,22 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { url = 'https://maven.minecraftforge.net/' } - } -} \ No newline at end of file +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' +} + +rootProject.name = 'mixingradle' + +//@formatter:off +dependencyResolutionManagement.versionCatalogs.register('libs') { + plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' + plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.3.21' + plugin 'gitversion', 'net.minecraftforge.gitversion' version '3.1.6' + plugin 'changelog', 'net.minecraftforge.changelog' version '3.1.3' + + // Gradle API + version 'gradle', '6.6' + library 'gradle', 'name.remal.gradle-api', 'gradle-api' versionRef 'gradle' + + library 'guava', 'com.google.guava', 'guava' version '21.0' + + library 'asm-tree', 'org.ow2.asm', 'asm-tree' version '9.2' +} +//@formatter:on diff --git a/src/main/groovy/org/spongepowered/asm/gradle/plugins/struct/DynamicProperties.groovy b/src/main/groovy/org/spongepowered/asm/gradle/plugins/struct/DynamicProperties.groovy index f2c3218..001df20 100644 --- a/src/main/groovy/org/spongepowered/asm/gradle/plugins/struct/DynamicProperties.groovy +++ b/src/main/groovy/org/spongepowered/asm/gradle/plugins/struct/DynamicProperties.groovy @@ -1,29 +1,29 @@ -/* - * This file is part of MixinGradle, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * 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 org.spongepowered.asm.gradle.plugins.struct +/* + * This file is part of MixinGradle, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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 org.spongepowered.asm.gradle.plugins.struct /** * A collection of String-to-whatever properties which supports a value at