Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ test {
useJUnitPlatform()
}

sourceSets.main.resources.srcDirs(sourceSets.test.resources.srcDirs) // include test books

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Member

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.


processResources {
inputs.property "version", project.version

Expand Down