diff --git a/build.gradle b/build.gradle index da7b1db6..17c4683b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,21 +3,16 @@ import me.modmuss50.mpp.ReleaseType plugins { id("java-library") id("net.neoforged.moddev") - id("me.modmuss50.mod-publish-plugin") version "0.7.2" apply false + id("me.modmuss50.mod-publish-plugin") version "0.8.1" apply false } /* * Gets the version name from the latest Git tag */ // https://stackoverflow.com/questions/28498688/gradle-script-to-autoversion-and-include-the-commit-hash-in-android -def getGitCommit = { -> - def stdout = new ByteArrayOutputStream() - exec { - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = stdout - } - return stdout.toString().trim() -} +def getGitCommit = providers.exec { + commandLine 'git', 'rev-parse', '--short', 'HEAD' +}.standardOutput.getAsText().map { it.trim() } def aw2at = Aw2AtTask.configureDefault( getProject(), @@ -31,10 +26,24 @@ neoForge { accessTransformers.files.setFrom(aw2at.flatMap { t -> t.getOutputFile() }) } +class FixAsmRule implements ComponentMetadataRule { + @Override + void execute(ComponentMetadataContext ctx) { + ctx.details.allVariants { + it.withDependencies { + it.removeIf { + it.group == "org.ow2.asm" + } + } + } + } +} + dependencies { // todo: check versions - compileOnly "net.fabricmc:sponge-mixin:0.13.4+mixin.0.8.5" + compileOnly "net.fabricmc:sponge-mixin:0.15.4+mixin.0.8.7" compileOnly "io.github.llamalad7:mixinextras-common:0.4.1" + components.withModule("net.neoforged:minecraft-dependencies", FixAsmRule.class) api("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") api("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") @@ -46,7 +55,7 @@ dependencies { allprojects { group = rootProject.maven_group - version = rootProject.mod_version + "+" + getGitCommit() + version = rootProject.mod_version + "+" + getGitCommit.get() plugins.apply("java-library") @@ -94,6 +103,16 @@ allprojects { subprojects { plugins.apply("me.modmuss50.mod-publish-plugin") + plugins.apply 'java-library' + plugins.apply 'com.gradleup.shadow' + + configurations.create("libs") + configurations.shadow { + extendsFrom(configurations.libs) + } + configurations.implementation { + extendsFrom(configurations.libs) + } publishMods { if (project.version.contains("-beta.")) { diff --git a/fabric/build.gradle b/fabric/build.gradle index b37116d9..7c796da0 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,15 +1,6 @@ plugins { id("quiet-fabric-loom") id 'maven-publish' - id 'com.gradleup.shadow' -} - -configurations.create("libs") -configurations.shadow { - extendsFrom(configurations.libs) -} -configurations.implementation { - extendsFrom(configurations.libs) } dependencies { @@ -17,10 +8,9 @@ dependencies { mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - // todo: runs are broken (cannot find aw file) - //add('shadow', project([path: ":", configuration: "namedElements"])) - //runtimeOnly(project(":").sourceSets.main.output) - libs(project(":")) + runtimeOnly(project(":").sourceSets.main.output) + shadow(project(":")) + compileOnly(project(":")) libs("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") libs("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c352119..a4b76b95 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 dedd5d1e..c1d5e018 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.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/neoforge/build.gradle b/neoforge/build.gradle index f04449fb..1a6db22e 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -4,7 +4,6 @@ import java.nio.file.Files plugins { id("net.neoforged.moddev") id 'maven-publish' - id 'com.gradleup.shadow' } repositories { @@ -24,34 +23,43 @@ neoForge { version = rootProject.neoforge_version validateAccessTransformers = true accessTransformers.files.setFrom(aw2at.flatMap { t -> t.getOutputFile() }) + mods { + moonrise { + sourceSet sourceSets.main + sourceSet rootProject.sourceSets.main + } + } runs { + configureEach { + additionalRuntimeClasspathConfiguration.extendsFrom configurations.libs + systemProperties.put('mixin.debug', 'true') + } client { client() - mods.set([]) // Work around classpath issues by using the production jar for dev runs + // loadedMods.set([]) // Work around module issues by using the production jar for dev runs } server { server() - mods.set([]) // Work around classpath issues by using the production jar for dev runs + // loadedMods.set([]) // Work around module issues by using the production jar for dev runs } } } -configurations.implementation { - extendsFrom(configurations.shadow) -} - dependencies { - add('shadow', project(":")) + runtimeOnly(project(":").sourceSets.main.output) + shadow(project(":")) + compileOnly(project(":")) - shadow("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") - shadow("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") - shadow("org.yaml:snakeyaml:${rootProject.snakeyaml_version}") + libs("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") + libs("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") + libs("org.yaml:snakeyaml:${rootProject.snakeyaml_version}") implementation "me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_version}" jarJar "me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_version}" } -// Work around classpath issues by using the production jar for dev runs +// Work around module issues by using the production jar for dev runs +/* tasks.withType(RunGameTask).configureEach { dependsOn(tasks.shadowJar) doFirst { @@ -61,6 +69,7 @@ tasks.withType(RunGameTask).configureEach { Files.copy(tasks.shadowJar.archiveFile.get().asFile.toPath(), jar.toPath()) } } + */ processResources { inputs.property "version", project.version diff --git a/settings.gradle b/settings.gradle index 16e74c05..634c0b9c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,7 +13,6 @@ pluginManagement { maven { name = 'jmp' url = 'https://repo.jpenilla.xyz/snapshots' - mavenContent { snapshotsOnly() } } maven { name = 'architectury' @@ -26,7 +25,7 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" id("quiet-fabric-loom") version "1.8.306" apply false id("net.neoforged.moddev") version "2.0.49-beta" apply false - id 'com.gradleup.shadow' version '8.3.0' apply false + id 'com.gradleup.shadow' version '8.3.5' apply false } dependencyResolutionManagement { diff --git a/src/main/resources/moonrise.accesswidener b/src/main/resources/moonrise.accesswidener index b4415afe..103c46cf 100644 --- a/src/main/resources/moonrise.accesswidener +++ b/src/main/resources/moonrise.accesswidener @@ -312,3 +312,5 @@ accessible class net/minecraft/world/level/LocalMobCapCalculator$MobCounts # SectionStorage$PackedChunk accessible class net/minecraft/world/level/chunk/storage/SectionStorage$PackedChunk +# MDG requires we AT the constructor if we AT the class +accessible method net/minecraft/world/level/chunk/storage/SectionStorage$PackedChunk (Lit/unimi/dsi/fastutil/ints/Int2ObjectMap;Z)V