-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Move test books to the test source directory [Fabric] #428
base: 1.17-fabric
Are you sure you want to change the base?
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
@@ -77,6 +77,8 @@ test { | |||
useJUnitPlatform() | |||
} | |||
|
|||
sourceSets.main.resources.srcDirs(sourceSets.test.resources.srcDirs) // include test books |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.