Move test books to the test source directory [Fabric] - #428
Conversation
This might help IDEs innocently trying to guess where things are supposed to be
| useJUnitPlatform() | ||
| } | ||
|
|
||
| sourceSets.main.resources.srcDirs(sourceSets.test.resources.srcDirs) // include test books |
There was a problem hiding this comment.
I'm confused. I thought you were going to move the test data to the test sourceset, then remove the ad-hoc exclude directives from the jar task below. Not sure what this change is supposed to do.
There was a problem hiding this comment.
The way directories are scanned (this on Fabric) requires that book resources are in the same directory as the mod metadata file mods.toml/fabric.mod.json.
So, without code changes, the test resources have to be in the resource dir that the mod metadata file is in.
Some options are:
- Add test source set resources to the main source set. This still requires the resources to be excluded from the final jar. (current)
- Make a new source set, include test and main classes and resources, and run from that. Possible, but slightly hacky and loader dependent.
- Make code changes so books can be scanned in additional directories. Possibly by environmental variables or such.
There was a problem hiding this comment.
or you can make the test source set depend on main and run with the test source set when you want the test data
There was a problem hiding this comment.
I don't see much benefit of either of the other approaches compared to what we have now, which is a bit of a hassle to exclude at build time but it works.
Especially now that we have RP-based books, most of our test books should probably be moved there anyways.
Equivalent of #427 for Fabric.