diff --git a/build.gradle b/build.gradle index ae5d883dd..b2acfbc94 100644 --- a/build.gradle +++ b/build.gradle @@ -1,33 +1,24 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - jcenter() - maven { url = 'https://repo.spongepowered.org/repository/maven-public' } - maven { url = 'https://maven.parchmentmc.org' } - } - dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:${forgegradle_version}" - classpath "org.spongepowered:mixingradle:${mixingradle_version}" - classpath "org.parchmentmc:librarian:${librarian_version}" - } -} - plugins { + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.minecraftforge.gradle' version "${forgegradle_version}" + id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}" + id 'org.spongepowered.mixin' version "${mixingradle_version}" id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.parchmentmc.librarian.forgegradle' -apply plugin: 'eclipse' -apply plugin: 'maven-publish' -apply plugin: 'org.spongepowered.mixin' jarJar.enable() boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false'); // jozu: I use a gradle workspace with both projects. // The project is named Flywheel-Forge, but sub-projects are named by folder. -boolean inWorkspace = findProject(':Flywheel') != null +Project flywheelProject = findProject(':Flywheel') +boolean flywheelInWorkspace = flywheelProject != null + +if (flywheelInWorkspace) { + println('Workspace detected, using Flywheel sibling project') +} ext.buildNumber = System.getenv('BUILD_NUMBER') @@ -39,8 +30,19 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) +mixin { + add sourceSets.main, 'create.refmap.json' + + config 'flywheel.mixins.json' + config 'flywheel.sodium.mixins.json' + config 'create.mixins.json' + + debug.verbose = true + debug.export = true +} + minecraft { - if (Boolean.parseBoolean(project.use_parchment)) { + if (Boolean.parseBoolean(use_parchment)) { mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" } else { mappings channel: 'official', version: "${minecraft_version}" @@ -49,19 +51,26 @@ minecraft { accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { - client { - workingDirectory project.file('run') - arg '-mixin.config=create.mixins.json' - //jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling + configureEach { + property 'forge.logging.markers', '' property 'forge.logging.console.level', 'info' + + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" + mods { create { source sourceSets.main } + } + } - if (inWorkspace) { + client { + workingDirectory project.file('run') + mods { + if (flywheelInWorkspace) { flywheel { - source project(":Flywheel").sourceSets.main + source flywheelProject.sourceSets.main } } } @@ -69,29 +78,17 @@ minecraft { server { workingDirectory project.file('run/server') - arg '-mixin.config=create.mixins.json' - property 'forge.logging.console.level', 'info' - mods { - create { - source sourceSets.main - } - } } data { workingDirectory project.file('run') - arg '-mixin.config=create.mixins.json' property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources') mods { - create { - source sourceSets.main - } - - if (inWorkspace) { + if (flywheelInWorkspace) { flywheel { - source project(":Flywheel").sourceSets.main + source flywheelProject.sourceSets.main } } } @@ -99,13 +96,6 @@ minecraft { gameTestServer { workingDirectory project.file('run/gametest') - arg '-mixin.config=create.mixins.json' - property 'forge.logging.console.level', 'info' - mods { - create { - source sourceSets.main - } - } // setForceExit false <- FIXME 1.20 } } @@ -156,6 +146,7 @@ repositories { } } + mavenCentral() mavenLocal() flatDir { dirs 'libs' @@ -174,8 +165,8 @@ dependencies { implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") - if (inWorkspace) { - implementation project(':Flywheel') + if (flywheelInWorkspace) { + implementation flywheelProject } else { implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") } @@ -223,10 +214,6 @@ sourceSets.main.resources { exclude '.cache/' } -mixin { - add sourceSets.main, 'create.refmap.json' -} - // Workaround for SpongePowered/MixinGradle#38 afterEvaluate { tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) diff --git a/gradle.properties b/gradle.properties index e20117fbc..c52cd825a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,22 +8,22 @@ mod_version = 0.5.1.f artifact_minecraft_version = 1.20.1 minecraft_version = 1.20.1 -forge_version = 47.1.43 +forge_version = 47.2.6 # build dependency versions -forgegradle_version = 6.0.6 -mixingradle_version = 0.7-SNAPSHOT +forgegradle_version = [6.0.16,6.2) +mixingradle_version = 0.7.+ mixin_version = 0.8.5 librarian_version = 1.+ cursegradle_version = 1.4.0 -parchment_version = 2023.06.26 +parchment_version = 2023.09.03 use_parchment = true # dependency versions registrate_version = MC1.20-1.3.3 -flywheel_minecraft_version = 1.20.1 -flywheel_version = 0.6.10-7 +flywheel_minecraft_version = 1.20 +flywheel_version = 1.0.0-alpha-2 jei_minecraft_version = 1.20.1 jei_version = 15.2.0.22 curios_minecraft_version = 1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa..c1962a79e 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 37aef8d3f..309b4e18d 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.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d6..aeb74cbb4 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# 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"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,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=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,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=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done 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 diff --git a/settings.gradle b/settings.gradle index ecc4e7182..c339a6321 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,18 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + maven { url = 'https://repo.spongepowered.org/repository/maven-public' } + maven { url = 'https://maven.parchmentmc.org' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + rootProject.name = 'Create'