-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The runDatagen
task can never be cached by gradle, as it depends on its own outputs
#1120
Comments
Do you have an idea on how to fix this? I dont think there is a solution as unfortunately there is a funimental circular dependency issue with datagen. Datagen requires the mod to be built to run, but the mod requires datagen to be ran to build. By default we suggest mod devs manually run datagen to work around this. |
I was going to suggest manually adding the resources to the classpath of the required In the past, I believe I've seen similar things where a new source set is created, named smth like Looking at how ksp deals with smth similar, it seems that what they do is they filter the inputs to exclude any of the output directories. although, do keep in mind that technically this can lead to invalid results, if, for whatever reason, the classes that do the data generation depend on some of the files they generate. (eg. attempt to load them and then use that to determine what is generated), then this can lead to incorrectly marking it as not needing to be re-run, when it does actually need to be re-run. |
I have noticed that inputs also depends on arguments containing a practically guaranteed to be random field, This is shown by
Disclaimer; I have found this through archloom, although if it is present in upstream (here), it would be contributing to the cache invalidation, which it seems to be here: fabric-loom/src/main/java/net/fabricmc/loom/task/AbstractRunTask.java Lines 127 to 133 in 097fd98
|
Oh wow, nice job spotting that. That can indeed be fixed! Would you mind opening an issue on the loom repo? One thing to keep in mind is we wouldn't want to start skipping the normal run game tasks if their inputs havent changed, only the data generation tasks. |
The run datagen task can never be cached by gradle, as its inputs will always depend on its outputs.
Reproducing:
runDatagen
task several times without changing anything.Expected:
All runs after the first are cached.
Actual:
None of the runs are cached.
Using the print statements, you can see that the
runDatagen
task depends on its own outputs in the following manner:processResources
-> takes/src/main/generated/
as an inputprocessResources
-> outputs to/build/resources/main/
runDatagen
-> takes/build/resources/main/
as an inputrunDatagen
-> outputs to/src/main/generated/
Since
processResources
is never cached and always re-run, this causesrunDatagen
to always be re-run.This is quite annoying for people who don't want to check
src/main/generated/*
into VCS, and instead have theirjar
task depend onrunDatagen
(to ensure the generated resources always remain up to date), as it will causerunDatagen
to constantly be re-run, even when no changes have been made.The text was updated successfully, but these errors were encountered: