Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Gradle 8.8 #1125

Merged
merged 7 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/publish-exp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:17-jdk
options: --user root
runs-on: ubuntu-24.04
steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:17-jdk
options: --user root
runs-on: ubuntu-24.04
steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2

Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ concurrency:

jobs:
build:
strategy:
fail-fast: false
matrix:
version: [8.7.0-jdk17]
runs-on: ubuntu-22.04
container:
image: gradle:${{ matrix.version }}
options: --user root
runs-on: ubuntu-24.04
steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- run: gradle build check -x test --stacktrace --warning-mode fail
- run: ./gradlew build check -x test --stacktrace --warning-mode fail

build_windows:
runs-on: windows-2022
Expand All @@ -27,7 +25,7 @@ jobs:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v2
- run: ./gradlew build check -x test --stacktrace --warning-mode fail
Expand All @@ -37,14 +35,16 @@ jobs:
# Lets wait to ensure it builds before going running tests
needs: build

runs-on: ubuntu-22.04
container:
image: gradle:8.7.0-jdk17
options: --user root
runs-on: ubuntu-24.04

steps:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- uses: actions/checkout@v4
- run: gradle writeActionsTestMatrix --stacktrace --warning-mode fail
- run: ./gradlew writeActionsTestMatrix --stacktrace --warning-mode fail
-
id: set-matrix
run: echo "matrix=$(cat build/test_matrix.json)" >> $GITHUB_OUTPUT
Expand All @@ -58,17 +58,18 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [8.7.0-jdk17]
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}

runs-on: ubuntu-22.04
container:
image: gradle:${{ matrix.version }}
options: --user root
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- run: gradle printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- run: ./gradlew printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
env:
TEST_WARNING_MODE: fail
id: test
Expand All @@ -90,17 +91,16 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [17]
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}

runs-on: windows-2022

steps:
- uses: actions/checkout@v4
- name: setup jdk ${{ matrix.java }}
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
java-version: 21
distribution: 'temurin'
- run: ./gradlew printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
env:
Expand All @@ -126,7 +126,7 @@ jobs:
fail-fast: false
matrix:
java: [ 17, 21 ]
os: [ windows-2022, ubuntu-22.04, macos-14 ]
os: [ windows-2022, ubuntu-24.04, macos-14 ]

runs-on: ${{ matrix.os }}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
@SuppressWarnings("unused")
public class LoomGradlePluginBootstrap implements Plugin<PluginAware> {
private static final String MIN_SUPPORTED_GRADLE_VERSION = "8.7";
private static final String MIN_SUPPORTED_GRADLE_VERSION = "8.8";
private static final int MIN_SUPPORTED_MAJOR_JAVA_VERSION = 17;
private static final int MIN_SUPPORTED_MAJOR_IDEA_VERSION = 2021;

Expand Down
18 changes: 12 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ configurations {
testRuntimeClasspath.extendsFrom bootstrap
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
failOnNonReproducibleResolution()
}

if (canBeConsumed) {
attributes {
attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, objects.named(GradlePluginApiVersion, GradleVersion.current().getVersion()))
}
}
}

sourceSets {
Expand Down Expand Up @@ -354,7 +360,7 @@ publishing {
}

// Need to tweak this file to pretend we are compatible with j8 so the bootstrap will run.
tasks.withType(GenerateModuleMetadata) {
tasks.withType(GenerateModuleMetadata).configureEach {
doLast {
def file = outputFile.get().asFile

Expand All @@ -369,7 +375,7 @@ tasks.withType(GenerateModuleMetadata) {
}

// A task to output a json file with a list of all the test to run
task writeActionsTestMatrix() {
tasks.register('writeActionsTestMatrix') {
doLast {
def testMatrix = []
file('src/test/groovy/net/fabricmc/loom/test/integration').eachFile {
Expand Down Expand Up @@ -409,7 +415,7 @@ tasks.named('wrapper') {
/**
* Run this task to download the gradle sources next to the api jar, you may need to manually attach the sources jar
*/
task downloadGradleSources() {
tasks.register('downloadGradleSources') {
doLast {
// Awful hack to find the gradle api location
def gradleApiFile = project.configurations.detachedConfiguration(dependencies.gradleApi()).files.stream()
Expand All @@ -427,13 +433,13 @@ task downloadGradleSources() {
}
}

task printActionsTestName(type: PrintActionsTestName) {
tasks.register('printActionsTestName', PrintActionsTestName) {
}

/**
* Replaces invalid characters in test names for GitHub Actions artifacts.
*/
class PrintActionsTestName extends DefaultTask {
abstract class PrintActionsTestName extends DefaultTask {
@Input
@Option(option = "name", description = "The test name")
String testName
Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ loom-native = "0.2.0"
# Plugins
spotless = "6.25.0"
test-retry = "1.5.6"
checkstyle = "10.13.0"
checkstyle = "10.17.0"
codenarc = "3.4.0"
jacoco = "0.8.11"

[libraries]
# Loom compile libraries
Expand Down
8 changes: 4 additions & 4 deletions gradle/test.libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
spock = "2.3-groovy-3.0"
junit = "5.10.2"
javalin = "6.1.3"
mockito = "5.11.0"
javalin = "6.1.6"
mockito = "5.12.0"
java-debug = "0.52.0"
mixin = "0.12.5+mixin.0.8.5"

gradle-nightly = "8.9-20240505002558+0000"
fabric-loader = "0.15.10"
gradle-nightly = "8.10-20240613003017+0000"
fabric-loader = "0.15.11"
fabric-installer = "1.0.1"

[libraries]
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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/.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public LoomProblemReporter(Problems problems) {

public void reportSelfResolvingDependencyUsage() {
problemReporter.reporting(spec -> spec
.label("SelfResolvingDependency is deprecated")
.id("loom-deprecated-selfresolvingdependency", "SelfResolvingDependency is deprecated")
.details("SelfResolvingDependency has been deprecated for removal in Gradle 9")
.solution("Please replace usages of SelfResolvingDependency")
.documentedAt("https://github.com/gradle/gradle/pull/27420")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ public static boolean stopIdleJVM(WorkerDaemonClientsManager manager, String jvm
return Collections.emptyList();
};

//noinspection unchecked
manager.selectIdleClientsToStop((Transformer) transformer);
try {
Method selectIdleClientsToStop = manager.getClass().getDeclaredMethod("selectIdleClientsToStop", Transformer.class);
selectIdleClientsToStop.setAccessible(true);
selectIdleClientsToStop.invoke(manager, transformer);
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
throw new RuntimeException("Failed to selectIdleClientsToStop", e);
}

return stopped.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FabricAPITest extends Specification implements GradleProjectTestTrait {
setup:
def gradle = gradleProject(
repo: "https://github.com/FabricMC/fabric.git",
commit: "efa5891941a32589207dc58c2e77183d599465b8",
commit: "41bc64cd617f03d49ecc4a4f7788cb65d465415c",
version: version,
patch: "fabric_api"
)
Expand All @@ -60,7 +60,7 @@ class FabricAPITest extends Specification implements GradleProjectTestTrait {
""".stripIndent()
}

def minecraftVersion = "23w51b"
def minecraftVersion = "1.21"
def server = ServerRunner.create(gradle.projectDir, minecraftVersion)
.withMod(gradle.getOutputFile("fabric-api-999.0.0.jar"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import java.nio.file.Path
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit

import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.cache.FileLockManager
Expand All @@ -39,6 +38,7 @@ import org.gradle.internal.nativeintegration.services.NativeServices
import org.gradle.internal.remote.internal.inet.InetAddressFactory
import org.gradle.internal.service.ServiceRegistry
import org.gradle.invocation.DefaultGradle
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.launcher.daemon.configuration.DaemonParameters
import org.gradle.launcher.daemon.context.DefaultDaemonContext
import org.gradle.launcher.daemon.protocol.DaemonMessageSerializer
Expand Down Expand Up @@ -109,7 +109,7 @@ class TestPlugin implements Plugin<Project> {
return new DefaultDaemonContext(
UUID.randomUUID().toString(),
new File("."),
JavaVersion.current(),
JavaLanguageVersion.current(),
new File("."),
ProcessHandle.current().pid(),
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import groovy.transform.Immutable
import org.apache.commons.io.FileUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.util.GradleVersion
import spock.lang.Shared

import net.fabricmc.loom.test.LoomTestConstants
Expand Down Expand Up @@ -201,7 +202,8 @@ trait GradleProjectTestTrait {
.withPluginClasspath()
.withGradleVersion(gradleVersion)
.forwardOutput()
.withDebug(enableDebugging)
// Only enable debugging when the current gradle version matches the version we are testing
.withDebug(enableDebugging && gradleVersion == GradleVersion.current().getVersion())
}

File getProjectDir() {
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/patches/fabric_api.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/build.gradle b/build.gradle
--- a/build.gradle (revision 23e8616e7457d7d4a65119b93952d134607ffc5c)
+++ b/build.gradle (date 1699535194191)
--- a/build.gradle (revision 41bc64cd617f03d49ecc4a4f7788cb65d465415c)
+++ b/build.gradle (date 1718312645477)
@@ -13,7 +13,7 @@

def ENV = System.getenv()
Expand All @@ -9,8 +9,8 @@ diff --git a/build.gradle b/build.gradle
+version = "999.0.0"
logger.lifecycle("Building Fabric: " + version)


@@ -22,24 +22,7 @@
def metaProjects = [
@@ -34,24 +34,7 @@
import org.apache.commons.codec.digest.DigestUtils

def getSubprojectVersion(project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.6
loader_version=0.11.3
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.11

# Mod Properties
mod_version = 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.6
loader_version=0.11.3
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.11

# Mod Properties
mod_version = 1.0.0
Expand Down
Loading