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

Java: use java_source vs java_sources #12962

Closed
Eric-Arellano opened this issue Sep 20, 2021 · 0 comments · Fixed by #12976
Closed

Java: use java_source vs java_sources #12962

Eric-Arellano opened this issue Sep 20, 2021 · 0 comments · Fixed by #12976
Assignees

Comments

@Eric-Arellano
Copy link
Contributor

Because Java is experimental, we can fully implement https://docs.google.com/document/d/1HpJn2jTWf5sKob6zhe4SqHZ7KWBlX4a6OJOwnuw-IHo/edit#heading=h.7dq13i2i8pzd.

Already, Java is using target generation:

@rule
async def generate_targets_from_junit_tests(
request: GenerateTargetsFromJunitTests, union_membership: UnionMembership
) -> GeneratedTargets:
paths = await Get(SourcesPaths, SourcesPathsRequest(request.generator[JavaTestsSources]))
return generate_file_level_targets(
JunitTests,
request.generator,
paths.files,
union_membership,
# TODO(#12790): set to false when dependency inference is disabled.
add_dependencies_on_all_siblings=True,
)

Right now, java_tests is generating java_tests. What we really want is to generate java_test (singular). The fix is going to look almost exactly like #12957, only that you can rename the alias for the targets to what we want, whereas in that PR we have to use some hackery to keep the old target names. tl;dr:

  • define new targets for java_source and java_test
  • rename java_library to java_sources & update help
  • update production call sites to always operate on java_source and java_test. Nothing in prod should be using java_sources and java_tests except for the target generation rules and tailor.py. It's totally fine for tests to keep using those target generators for less boilerplate.

No need to implement the overrides mechanism yet.

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 a pull request may close this issue.

2 participants