Cleanup mod remapping wiring#249
Conversation
Last commit published: 76b8b2775029fd957c90965df9cdd162c0376136. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #249' // https://github.com/neoforged/ModDevGradle/pull/249
url 'https://prmaven.neoforged.net/ModDevGradle/pr249'
content {
includeModule('net.neoforged.moddev.legacyforge', 'net.neoforged.moddev.legacyforge.gradle.plugin')
includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin')
includeModule('net.neoforged.moddev.repositories', 'net.neoforged.moddev.repositories.gradle.plugin')
includeModule('net.neoforged', 'moddev-gradle')
}
}
} |
lukebemish
left a comment
There was a problem hiding this comment.
This looks by and large fine -- since there is no possibility of consuming something "in the wild" with that attribute the transform should work out fine and all. My one worry is the rampant use of constraints in general may introduce weird behaviour in a few edge cases. For instance, if one does the following:
dependencies {
modRuntimeOnly 'org.example:abc:0.1.0'
runtimeOnly 'org.example:abc:0.1.0:someclassifier'
}The runtimeOnly one is remapped alongside the one that normally should be. I believe this would also apply if a feature variant were used there as well as constraints apply to a whole module with no capability selector. That's enough of an edge case, it perhaps doesn't matter. I have a few other worries implementation-wise but mostly stuff easily fixed.
| spec.setDescription("Configuration for dependencies of " + parent.getName() + " that needs to be remapped"); | ||
| spec.setCanBeConsumed(false); | ||
| spec.setCanBeResolved(true); | ||
| spec.setCanBeResolved(false); |
There was a problem hiding this comment.
The combination of canBeConsumed = false and canBeResolved = false means it should probably just be dependencyScope to begin with.
| @@ -175,19 +173,12 @@ public Configuration createRemappingConfiguration(Configuration parent) { | |||
| // Additionally, we force dependencies to be non-transitive since we cannot apply the attribute hack to transitive dependencies. | |||
| spec.withDependencies(dependencies -> dependencies.forEach(dep -> { | |||
There was a problem hiding this comment.
Hmm. I... really don't like this because it relies on the modXyz configuration being non-lazy -- which it hopefully will not be! Instead, this whole thing should probably be a parent.getDependencyConstraints().addLater(...) block, outside of (after) the create block for remappingConfig, probably .map-ing remappingConfig.getAllDependencies(), so that this still works if remappingConfig is lazy.
|
🚀 This PR has been released as ModDevGradle version |
mod*configurations.jartype gets the SRG mapping attribute.mod*configuration will add a dependency constraint on the NAMED mapping attribute, thus triggering the artifact transform. This seems to work for classifiers too.apiElementsandruntimeElementsvariants still receive the NAMED attribute; the obf ones do not receive any. This keeps cross-project dependencies behaving reasonably:obfvariants, which is what we want.MinecraftMappingsattribute by adding a.v2because the previous one was published and is therefore broken forever in published mods.Fixes #240 and hopefully does not reintroduce previously fixed issues. 😓
TODO: