Skip to content

Move test books to the test source directory [Fabric] - #428

Open
eutro wants to merge 2 commits into
VazkiiMods:1.17-fabricfrom
eutro:test-books-in-test-source-fabric
Open

Move test books to the test source directory [Fabric]#428
eutro wants to merge 2 commits into
VazkiiMods:1.17-fabricfrom
eutro:test-books-in-test-source-fabric

Conversation

@eutro

@eutro eutro commented Jul 22, 2021

Copy link
Copy Markdown

Equivalent of #427 for Fabric.

eutro added 2 commits July 22, 2021 14:26
This might help IDEs innocently trying to guess where things are supposed to be
Comment thread build.gradle
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants