Skip to content

Commit

Permalink
Work on fixing runs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Dec 2, 2024
1 parent 2413a0e commit ac0acad
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 40 deletions.
41 changes: 30 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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}")
Expand All @@ -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")

Expand Down Expand Up @@ -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.")) {
Expand Down
16 changes: 3 additions & 13 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
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 {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
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}")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.daemon=false
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.3
loader_version=0.16.7
loader_version=0.16.9
supported_minecraft_versions=1.21.3
neoforge_version=21.3.31-beta
fabric_api_version=0.107.0+1.21.3
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.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
33 changes: 21 additions & 12 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import java.nio.file.Files
plugins {
id("net.neoforged.moddev")
id 'maven-publish'
id 'com.gradleup.shadow'
}

repositories {
Expand All @@ -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 {
Expand All @@ -61,6 +69,7 @@ tasks.withType(RunGameTask).configureEach {
Files.copy(tasks.shadowJar.archiveFile.get().asFile.toPath(), jar.toPath())
}
}
*/

processResources {
inputs.property "version", project.version
Expand Down
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pluginManagement {
maven {
name = 'jmp'
url = 'https://repo.jpenilla.xyz/snapshots'
mavenContent { snapshotsOnly() }
}
maven {
name = 'architectury'
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/moonrise.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (Lit/unimi/dsi/fastutil/ints/Int2ObjectMap;Z)V

0 comments on commit ac0acad

Please sign in to comment.