diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml index fcc5b35..d362b06 100644 --- a/.github/workflows/build-prs.yml +++ b/.github/workflows/build-prs.yml @@ -7,22 +7,15 @@ on: - opened - ready_for_review - reopened + push: + branches: + - 'feature/**' + workflow_dispatch: jobs: build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1000 - fetch-tags: true - - name: Setup JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'temurin' - - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: build \ No newline at end of file + uses: neoforged/actions/.github/workflows/build-prs.yml@main + with: + java: 17 + gradle_tasks: build + jar_compatibility: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a84abc..107acbd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: build: uses: neoforged/actions/.github/workflows/gradle-publish.yml@main with: - java: 8 + java: 17 version_task: 'configureGitHubActions' gradle_tasks: 'publish publishPlugins' secrets: @@ -21,4 +21,4 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} GPP_KEY: ${{ secrets.GPP_KEY }} - GPP_SECRET: ${{ secrets.GPP_SECRET }} \ No newline at end of file + GPP_SECRET: ${{ secrets.GPP_SECRET }} diff --git a/build.gradle b/build.gradle index df217f7..cf4dbf8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,13 +2,13 @@ plugins { id 'java-gradle-plugin' id 'groovy' id 'maven-publish' - id 'org.cadixdev.licenser' version '0.6.1' - id 'com.gradle.plugin-publish' version '1.1.0' + id 'net.neoforged.licenser' version '0.7.5' + id 'com.gradle.plugin-publish' version '2.0.0' } java { toolchain { - languageVersion = JavaLanguageVersion.of(8) + languageVersion = JavaLanguageVersion.of(17) } withSourcesJar() } @@ -25,18 +25,6 @@ repositories { gradlePluginPortal() } -// Immaculate runs on J17 -tasks.named('compileImmaculateJava', JavaCompile).configure { - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(17) - } -} -tasks.named('compileImmaculateGroovy', GroovyCompile).configure { - javaLauncher = javaToolchains.launcherFor { - languageVersion = JavaLanguageVersion.of(17) - } -} - if (System.getenv('GPP_KEY')) { project.ext { set('gradle.publish.key', System.getenv('GPP_KEY')) @@ -49,7 +37,7 @@ configurations { } dependencies { - api 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r' + api 'org.eclipse.jgit:org.eclipse.jgit:7.6.0.202603022253-r' api 'io.github.gradle-nexus:publish-plugin:2.0.0' api("net.neoforged:groovydslimprover:${gdi_version}") { @@ -59,7 +47,7 @@ dependencies { } immaculateImplementation(gradleApi()) - immaculateImplementation "dev.lukebemish.immaculate:dev.lukebemish.immaculate.gradle.plugin:0.1.6" + immaculateImplementation "dev.lukebemish.immaculate:dev.lukebemish.immaculate.gradle.plugin:0.2.4" } sourceSets { @@ -77,22 +65,20 @@ tasks.named(sourceSets.main.processResourcesTaskName, Copy) { } tasks.named('jar', Jar) { - try { - final ByteArrayOutputStream bos = new ByteArrayOutputStream() - project.exec { - commandLine('git', 'rev-parse', 'HEAD') - standardOutput(bos) - }.rethrowFailure().assertNormalExitValue() - - final gitCommit = new String(bos.toByteArray()) - // Store the git commit as the Implementation-Version of the tasks package - // TODO - re-evaluate: find a better way of storing this sha for use in template generation - manifest.attributes([ - 'Implementation-Version': gitCommit - ], 'net/neoforged/gradleutils/tasks/') - } catch (Exception ex) { - throw new IllegalStateException("Failed to determine the latest commit hash; check if 'git' is on the PATH", ex) + var gitCommitResult = project.providers.exec { + commandLine('git', 'rev-parse', 'HEAD') } + var gitCommit = gitCommitResult.result.zip(gitCommitResult.standardOutput.asText) { result, stdout -> + result.rethrowFailure() + result.assertNormalExitValue() + stdout + } + + // Store the git commit as the Implementation-Version of the tasks package + // TODO - re-evaluate: find a better way of storing this sha for use in template generation + manifest.attributes([ + 'Implementation-Version': gitCommit.get() + ], 'net/neoforged/gradleutils/tasks/') } license { @@ -110,7 +96,7 @@ license { gradlePlugin { website = 'https://github.com/neoforged/GradleUtils' - vcsUrl = 'https://github.com/neoforged/GradleUtils.git' + vcsUrl = 'https://github.com/neoforged/GradleUtils.git' plugins { gradleutils { @@ -225,7 +211,8 @@ abstract class GenerateChangelogTask extends DefaultTask { @OutputFile abstract RegularFileProperty getChangelogFile() - @javax.inject.Inject // This might look like a compile error in IDE, but it actually compiles okay + @javax.inject.Inject + // This might look like a compile error in IDE, but it actually compiles okay abstract ExecOperations getExecOperations() @TaskAction diff --git a/gradle.properties b/gradle.properties index f8f2166..f584167 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,3 @@ -gdi_version=1.0.15 +gdi_version=2.0.0 + +org.gradle.configuration-cache=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..d997cfc 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 6f7a6eb..c82ad3f 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-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1..739907d 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/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/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/. @@ -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,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. @@ -170,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" ) @@ -203,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 25da30d..c4bdd3a 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,10 @@ 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 %* +"%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 diff --git a/settings.gradle b/settings.gradle index ff4a36a..89a99a7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,12 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = 'https://maven.neoforged.net/releases' } + } +} + plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } rootProject.name = 'GradleUtils' diff --git a/src/main/groovy/net/neoforged/gradleutils/GradleUtilsExtension.groovy b/src/main/groovy/net/neoforged/gradleutils/GradleUtilsExtension.groovy index 2471f21..3ccaee6 100644 --- a/src/main/groovy/net/neoforged/gradleutils/GradleUtilsExtension.groovy +++ b/src/main/groovy/net/neoforged/gradleutils/GradleUtilsExtension.groovy @@ -25,8 +25,8 @@ import groovy.transform.NamedVariant import groovy.transform.PackageScope import io.github.gradlenexus.publishplugin.NexusPublishExtension import io.github.gradlenexus.publishplugin.NexusPublishPlugin -import net.minecraftforge.gdi.annotations.DSLProperty -import net.minecraftforge.gdi.annotations.ProjectGetter +import net.neoforged.gdi.annotations.DSLProperty +import net.neoforged.gdi.annotations.ProjectGetter import net.neoforged.gradleutils.specs.VersionSpec import org.gradle.api.Action import org.gradle.api.Project diff --git a/src/main/groovy/net/neoforged/gradleutils/specs/VersionBranchesSpec.groovy b/src/main/groovy/net/neoforged/gradleutils/specs/VersionBranchesSpec.groovy index 342abe2..0d4fe59 100644 --- a/src/main/groovy/net/neoforged/gradleutils/specs/VersionBranchesSpec.groovy +++ b/src/main/groovy/net/neoforged/gradleutils/specs/VersionBranchesSpec.groovy @@ -6,7 +6,7 @@ package net.neoforged.gradleutils.specs import groovy.transform.CompileStatic -import net.minecraftforge.gdi.annotations.DSLProperty +import net.neoforged.gdi.annotations.DSLProperty import org.gradle.api.provider.Property import org.gradle.api.provider.SetProperty import org.gradle.api.tasks.Input diff --git a/src/main/groovy/net/neoforged/gradleutils/specs/VersionSpec.groovy b/src/main/groovy/net/neoforged/gradleutils/specs/VersionSpec.groovy index a3e6923..4c04324 100644 --- a/src/main/groovy/net/neoforged/gradleutils/specs/VersionSpec.groovy +++ b/src/main/groovy/net/neoforged/gradleutils/specs/VersionSpec.groovy @@ -6,9 +6,8 @@ package net.neoforged.gradleutils.specs import groovy.transform.CompileStatic -import net.minecraftforge.gdi.annotations.DSLProperty +import net.neoforged.gdi.annotations.DSLProperty import net.neoforged.gradleutils.InternalAccessor -import org.gradle.api.Action import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.Nested diff --git a/src/main/groovy/net/neoforged/gradleutils/specs/VersionTagsSpec.groovy b/src/main/groovy/net/neoforged/gradleutils/specs/VersionTagsSpec.groovy index b651e05..752a231 100644 --- a/src/main/groovy/net/neoforged/gradleutils/specs/VersionTagsSpec.groovy +++ b/src/main/groovy/net/neoforged/gradleutils/specs/VersionTagsSpec.groovy @@ -6,7 +6,7 @@ package net.neoforged.gradleutils.specs import groovy.transform.CompileStatic -import net.minecraftforge.gdi.annotations.DSLProperty +import net.neoforged.gdi.annotations.DSLProperty import org.gradle.api.provider.Property import org.gradle.api.provider.SetProperty import org.gradle.api.tasks.Input diff --git a/src/main/groovy/net/neoforged/gradleutils/tasks/CIConfigExtractionTask.java b/src/main/groovy/net/neoforged/gradleutils/tasks/CIConfigExtractionTask.java index 37a166f..f84ceac 100644 --- a/src/main/groovy/net/neoforged/gradleutils/tasks/CIConfigExtractionTask.java +++ b/src/main/groovy/net/neoforged/gradleutils/tasks/CIConfigExtractionTask.java @@ -15,6 +15,7 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; import org.gradle.jvm.toolchain.JavaLanguageVersion; +import org.gradle.work.DisableCachingByDefault; import java.io.File; import java.io.FileOutputStream; @@ -27,6 +28,7 @@ import java.util.List; import java.util.zip.ZipEntry; +@DisableCachingByDefault(because = "Task deletes its output directory") public abstract class CIConfigExtractionTask extends DefaultTask { private final String templateZipName, targetDirName; protected CIConfigExtractionTask(String templateZipName, String targetDirName) { diff --git a/src/main/groovy/net/neoforged/gradleutils/tasks/ExtractActionsWorkflowsTask.java b/src/main/groovy/net/neoforged/gradleutils/tasks/ExtractActionsWorkflowsTask.java index f7ee174..4c55f68 100644 --- a/src/main/groovy/net/neoforged/gradleutils/tasks/ExtractActionsWorkflowsTask.java +++ b/src/main/groovy/net/neoforged/gradleutils/tasks/ExtractActionsWorkflowsTask.java @@ -9,6 +9,7 @@ import org.gradle.api.plugins.BasePluginExtension; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.options.Option; +import org.gradle.work.DisableCachingByDefault; import java.io.File; import java.io.FileInputStream; @@ -25,6 +26,7 @@ /** * Task to extract the GitHub Action workflows from the included template zip file. */ +@DisableCachingByDefault(because = "Task deletes its output directory") public abstract class ExtractActionsWorkflowsTask extends CIConfigExtractionTask { public ExtractActionsWorkflowsTask() {