[7.0] Migrate Mavenizer to ValueSource#1033
Merged
Jonathing merged 3 commits intoMinecraftForge:FG_7.0from Jan 26, 2026
Merged
Conversation
c1bf7ec to
94c4c9c
Compare
Member
Author
|
Removed SyncMavenizer task. |
Member
|
Related conversation on Slack: https://imgur.com/a/ZyjD6Le These aren't meant to be receipts or anything, it's just to get around Slack's 90-day retention for non-paying users. It will be important to reference this later. |
Member
|
Build successful on macOS x64, macOS arm64, and linux x64. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Long story short the Configuration cache is a fucking nightmare.
All dependencies are resolved before any tasks are run when using the configuration cache if they are used as part of a task's configuration.
The recommended solution from Gradle's slack is to migrate to using ValueSource to create anything that needs to be used in the Configuration Cache.
This actually isn't to big of a deal, ValueSource's are given access to ExecOperations which can launch java processes.
The ToolChainService can resolve toolchains during configuration time.
Detached Configurations can resolve interdependence during ValueSource time, so we can resolve our tools.
Changing
minecraft.dependencyto return a Provider allows us to force invoke our ValueSource's obtain method before the Minecraft dependency is even told that it exists to Gradle. this should once and for all force Mavenizer to run before any dependecy it creates is asked for.The only real weirdness is that we can not resolve SourceSets that our dependency is being used in to magically find the accesstransformer.cfg file. So I just search ALL source sets.
This can cause weird behavior, but modders can work around that by doing something like:
dependencies { implementation_1_21_11 minecraft.dependency('net.minecraftforge:forge:1.21.11') { accessTransformer = file('src/1_21_11/resources/accesstransformer.cfg') } implementation_1_20_1 minecraft.dependency('net.minecraftforge:forge:1.20.1') { accessTransformer = file('src/1_20_1/resources/accesstransformer.cfg') } }Also I did express concerns about ordering of the buildscript's repository blocks.
This seems to work fine:
repositories { maven minecraft.mavenizer maven fg.forgeMaven maven fg.minecraftLibsMaven mavenCentral() } dependencies { implementation minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version") } repositories { maven { name = 'Test', url = 'https://testing/shit/' } }I added some temporary debug printing to illustrate things:
Note that the repository list includes the one added after the dependency block
Also note that "Access Transformer" is written twice, this is because the parameters for the ValueSource is configured twice, this is a behavior of the ConfigCache, I don't really care to dig into it. The main thing is that the execution is only invoked once.
This should fix #1031 once and for all, while maintaining compatibility with Config cache. I'm able to continuously run
gradlew clean&&gradlew buildand everything works.There are some future cleanups that need to be done, Right now, SyncMavenizer still exists and still gets configured/envoked. I just nooped the TaskAction. Could cleanup a lot of config time stuff by de-implementing that task.
MinecraftDependencyImpl.handle can be removed.
All the flowScope stuff can probably be yeeted.
But thats all just future cleanup that in theory can be done without breaking DSL. So we can talk about after we get things functional and in production.