diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbb6cfd4..3aa323bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,5 +12,5 @@ jobs: options: --user root steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 + - uses: gradle/actions/wrapper-validation@v4 - run: ./gradlew build publishToMavenLocal --stacktrace --warning-mode fail \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dcf2bd6..0043dfa8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: options: --user root steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 + - uses: gradle/actions/wrapper-validation@v4 - run: ./gradlew checkVersion build publish --stacktrace env: MAVEN_URL: ${{ secrets.MAVEN_URL }} diff --git a/HEADER.txt b/HEADER.txt index 3f213880..08c1f7a1 100644 --- a/HEADER.txt +++ b/HEADER.txt @@ -1,22 +1,24 @@ -This file is part of ${name}, licensed under the MIT License (MIT). - -Copyright (c) ${organization} <${url}> -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. \ No newline at end of file +/* + * This file is part of Mixin, 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. + */ diff --git a/build.gradle b/build.gradle index 141b8076..45d0a84d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,21 +5,19 @@ buildscript { mavenCentral() } dependencies { - classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1' classpath 'com.guardsquare:proguard-gradle:' + (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11) ? '7.5.0' : '7.1.0') } } plugins { - id "me.modmuss50.remotesign" version "0.4.0" - id "io.github.goooler.shadow" version "8.1.7" + id "me.modmuss50.remotesign" version "0.5.0" + id "com.gradleup.shadow" version "9.0.0-beta17" } import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar // Apply plugin apply plugin: 'java' -apply plugin: 'com.github.hierynomus.license' apply plugin: 'checkstyle' apply plugin: 'maven-publish' apply plugin: 'eclipse' @@ -27,7 +25,7 @@ apply plugin: 'idea' apply plugin: 'potemkin-modules' // Default tasks -defaultTasks 'licenseFormat', 'check', 'build' +defaultTasks 'check', 'build' // Basic project information group = 'net.fabricmc' @@ -298,22 +296,13 @@ processResources { } // License header formatting -license { - ext { - name = "Mixin" - organization = "SpongePowered" - url = "https://www.spongepowered.org" - } - include '**/*.java' - header file("HEADER.txt") - sourceSets = project.sourceSets - ignoreFailures false - strictCheck true - mapping { - java = 'SLASHSTAR_STYLE' - } +def validateHeaders = tasks.register("validateHeaders", org.spongepowered.asm.mixin.build.ValidateLicenseHeadersTasks) { + header = resources.text.fromFile("HEADER.txt") + source = sourceSets.collect { it.allJava } } +tasks.check.dependsOn validateHeaders + checkstyle { configProperties = [ "name" : project.name, @@ -463,9 +452,9 @@ ext.excludePomDeps = [ publishing { publications { developer(MavenPublication) { publication -> - groupId project.group - artifactId project.base.archivesName.get() - version project.version + groupId = project.group + artifactId = project.base.archivesName.get() + version = project.version artifact sourceJar artifact javadocJar @@ -542,10 +531,10 @@ publishing { repositories { if (ENV.MAVEN_URL) { maven { - url ENV.MAVEN_URL + url = ENV.MAVEN_URL credentials { - username ENV.MAVEN_USERNAME - password ENV.MAVEN_PASSWORD + username = ENV.MAVEN_USERNAME + password = ENV.MAVEN_PASSWORD } } } @@ -553,10 +542,10 @@ publishing { if (ENV.MAVEN_CENTRAL_URL) { repositories.maven { name "central" - url ENV.MAVEN_CENTRAL_URL + url = ENV.MAVEN_CENTRAL_URL credentials { - username ENV.MAVEN_CENTRAL_USERNAME - password ENV.MAVEN_CENTRAL_PASSWORD + username = ENV.MAVEN_CENTRAL_USERNAME + password = ENV.MAVEN_CENTRAL_PASSWORD } } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index e7001a07..6450ea90 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -4,8 +4,8 @@ plugins { repositories { maven { - name 'sponge' - url 'https://repo.spongepowered.org/repository/maven-public' + name = 'sponge' + url = 'https://repo.spongepowered.org/repository/maven-public' } } diff --git a/buildSrc/src/main/groovy/org/spongepowered/asm/mixin/build/ValidateLicenseHeadersTasks.groovy b/buildSrc/src/main/groovy/org/spongepowered/asm/mixin/build/ValidateLicenseHeadersTasks.groovy new file mode 100644 index 00000000..2b30598c --- /dev/null +++ b/buildSrc/src/main/groovy/org/spongepowered/asm/mixin/build/ValidateLicenseHeadersTasks.groovy @@ -0,0 +1,56 @@ +/* + * This file is part of Mixin, 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.mixin.build + +import org.gradle.api.resources.TextResource +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.SourceTask +import org.gradle.api.tasks.TaskAction + +abstract class ValidateLicenseHeadersTasks extends SourceTask { + @Input + TextResource header + + @TaskAction + void run() { + def headerStr = header.asString() + def javaSources = getSource().matching(pattern -> pattern.include("**/*.java")).files + + def failedFiles = [] + + for (def source : javaSources) { + if (!source.text.startsWith(headerStr)) { + failedFiles.add(source.name) + logger.warn("File {} does not have the correct license header", source.path) + } + } + + if (!failedFiles.isEmpty()) { + throw new RuntimeException("License header validation failed for the following files:\n" + + failedFiles.join("\n")) + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136..1b33c55b 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 a4413138..ff23a68d 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.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf13..23d15a93 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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 @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ 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. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 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 25da30db..db3a6ac2 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @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 ########################################################################## @@ -68,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell