Skip to content
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

Add ImportOption DoNotIncludeGradleTestFixtures #1010

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

codecholeric
Copy link
Collaborator

Gradle provides the java-test-fixtures plugin out of the box, which will add a separate source set for creating test fixtures (i.e. test support code). This source set can see the main sources and be seen by the test sources. Depending on how the tests are run they might be put onto the classpath as folder path (containing the compiled sources) or JAR archive. Thus, we have to exclude both, the folder where Gradle compiles the files to by convention and archives that follow the Gradle convention to end in -test-fixtures.jar. However, this can of course only be a heuristic. Custom modules that mimic the convention will e.g. also be excluded. But in these cases users have to customize their import options then, instead of using the predefined one.

Resolves: #949

Gradle provides the `java-test-fixtures` plugin out of the box, which will add a separate source set for creating test fixtures (i.e. test support code). This source set can see the main sources and be seen by the test sources. Depending on how the tests are run they might be put onto the classpath as folder path (containing the compiled sources) or JAR archive. Thus, we have to exclude both, the folder where Gradle compiles the files to by convention and archives that follow the Gradle convention to end in `-test-fixtures.jar`.
However, this can of course only be a heuristic. Custom modules that mimic the convention will e.g. also be excluded. But in these cases users have to customize their import options then, instead of using the predefined one.

Signed-off-by: Peter Gafert <[email protected]>
@codecholeric codecholeric self-assigned this Nov 28, 2022
@codecholeric codecholeric requested a review from hankem November 28, 2022 04:59
@codecholeric codecholeric added this to the 1.1.0 milestone Nov 28, 2022
@britter
Copy link

britter commented Nov 29, 2022

@codecholeric I can confirm that this code works in my project by copying the DoNotIncludeGradleTestFixtures to my code base. Thanks for looking into this!

Copy link
Member

@hankem hankem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hankem hankem merged commit 6f32fbd into main Dec 2, 2022
@hankem hankem deleted the add-DoNotIncludeTestFixtures branch December 2, 2022 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to include/exclude Gradle testFixtures via importOptions
3 participants