Skip to content

Commit

Permalink
Update to Gradle 8.10 (#1157)
Browse files Browse the repository at this point in the history
* Update to Gradle 8.10

* 8.10 for real
  • Loading branch information
modmuss50 authored Aug 15, 2024
1 parent efe6607 commit 4fef156
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 31 deletions.
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.8";
private static final String MIN_SUPPORTED_GRADLE_VERSION = "8.10";
private static final int MIN_SUPPORTED_MAJOR_JAVA_VERSION = 17;
private static final int MIN_SUPPORTED_MAJOR_IDEA_VERSION = 2021;

Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ if (ENV.BUILD_NUMBER) {
}

// We must build against the version of Kotlin Gradle ships with.
def kotlinVersion = KotlinDslVersion.current().getKotlinVersion()
def props = new Properties()
Project.class.getClassLoader().getResource("gradle-kotlin-dsl-versions.properties").openStream().withCloseable {
props.load(it)
}
def kotlinVersion = props.getProperty("kotlin")
if (libs.versions.kotlin.get() != kotlinVersion) {
throw new IllegalStateException("Requires Kotlin version: ${kotlinVersion}")
}
Expand Down Expand Up @@ -306,7 +310,6 @@ tasks.withType(Test).configureEach {


import org.gradle.api.internal.artifacts.configurations.ConfigurationRoles
import org.gradle.launcher.cli.KotlinDslVersion
import org.gradle.util.GradleVersion
import org.w3c.dom.Document
import org.w3c.dom.Element
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.9.22"
kotlin = "1.9.24"
asm = "9.6"
commons-io = "2.15.1"
gson = "2.10.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/test.libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mockito = "5.12.0"
java-debug = "0.52.0"
mixin = "0.12.5+mixin.0.8.5"

gradle-nightly = "8.10-20240613003017+0000"
gradle-nightly = "8.11-20240814172604+0000"
fabric-loader = "0.15.11"
fabric-installer = "1.0.1"

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.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ 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
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ 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.configuration.DaemonPriority
import org.gradle.launcher.daemon.context.DefaultDaemonContext
import org.gradle.launcher.daemon.protocol.DaemonMessageSerializer
import org.gradle.launcher.daemon.protocol.Finished
Expand All @@ -52,7 +52,7 @@ import org.gradle.launcher.daemon.server.DaemonTcpServerConnector
import org.gradle.launcher.daemon.server.DefaultDaemonConnection
import org.gradle.launcher.daemon.server.IncomingConnectionHandler
import org.gradle.launcher.daemon.server.SynchronizedDispatchConnection
import org.gradle.launcher.daemon.server.api.DaemonStateControl
import org.gradle.launcher.daemon.server.api.DaemonState
import org.gradle.util.GradleVersion

import net.fabricmc.loom.util.gradle.daemon.DaemonUtils
Expand All @@ -78,7 +78,7 @@ class TestPlugin implements Plugin<Project> {

// Write it in the registry
def registry = new PersistentDaemonRegistry(registryBin.toFile(), services.get(FileLockManager.class), services.get(Chmod.class))
def daemonInfo = new DaemonInfo(address, createDaemonContext(), "token".bytes, DaemonStateControl.State.Busy)
def daemonInfo = new DaemonInfo(address, createDaemonContext(), "token".bytes, DaemonState.Busy)
registry.store(daemonInfo)

// When we get a connection, wait for a stop message and process it by responding with a success message
Expand All @@ -99,36 +99,19 @@ class TestPlugin implements Plugin<Project> {
}
}

// Thanks groovy for allowing me to do this :D
static DefaultDaemonContext createDaemonContext() {
int constructorArgsCount = DefaultDaemonContext.class.getConstructors()[0].getParameterCount()

if (constructorArgsCount == 10) {
// Gradle 8.9+ adds a JavaVersion and NativeServicesMode parameter to the constructor
//noinspection GroovyAssignabilityCheck
return new DefaultDaemonContext(
UUID.randomUUID().toString(),
new File("."),
JavaLanguageVersion.current(),
new File("."),
ProcessHandle.current().pid(),
0,
List.of(),
false,
NativeServices.NativeServicesMode.NOT_SET,
DaemonParameters.Priority.NORMAL
)
}

return new DefaultDaemonContext(
UUID.randomUUID().toString(),
new File("."),
JavaLanguageVersion.current(),
"",
new File("."),
ProcessHandle.current().pid(),
0,
List.of(),
false,
DaemonParameters.Priority.NORMAL
NativeServices.NativeServicesMode.NOT_SET,
DaemonPriority.NORMAL
)
}

Expand Down

0 comments on commit 4fef156

Please sign in to comment.