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

Make Java source root configurable #6353

Open
cushon opened this issue Oct 10, 2018 · 8 comments
Open

Make Java source root configurable #6353

cushon opened this issue Oct 10, 2018 · 8 comments
Labels
not stale Issues or PRs that are inactive but not considered stale P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-Java Issues for Java rules type: feature request

Comments

@cushon
Copy link
Contributor

cushon commented Oct 10, 2018

Bazel hard-codes some conventions about Java source roots:

int rootIndex = path.getFirstSegment(ImmutableSet.of("java", "javatests", "src"));

This is used e.g. to infer java_test.test_class and to relativize java_library.resources.

We should make the source root configurable to support other repository layouts.

@cushon
Copy link
Contributor Author

cushon commented Oct 11, 2018

@lberki pointed out offline that the configuration for this would ideally be per-WORKSPACE, rather than a top-level flag or part of the toolchain.

@petroseskinder
Copy link
Member

petroseskinder commented Oct 11, 2018

Thank you for filing this @cushon. Also discussed with @katre, regarding the matter. Internally at Two Sigma, the change that we have made is simply adding "testsrc" to the list, and then adding a set of tests in the JavaUtilTest.java class that verified that testsrc worked.

@cushon
Copy link
Contributor Author

cushon commented Oct 12, 2018

I'm not sure exactly what the per-WORKSPACE config mechanism will look, and supporting testsrc seems like a good idea in the interim.

Do you want to open a PR for 2a8ff16 and db19ea1?

@lberki
Copy link
Contributor

lberki commented Oct 12, 2018

Yeah... I'm not sure we should have a knob for this in the first place, and I'd rather have a simple and almost correct fix (i.e. the above two commits) than a complex and almost correct one.

bazel-io pushed a commit that referenced this issue Oct 12, 2018
See discussion in #6353.
reviewers: @cushon @lberki

Closes #6371.

PiperOrigin-RevId: 216915838
@petroseskinder
Copy link
Member

This scratches my itch, so it is fine with me if this is not tunable.

@cushon cushon added the P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) label Oct 12, 2018
@jin jin removed the untriaged label Nov 5, 2018
@lberki
Copy link
Contributor

lberki commented Nov 19, 2018

Not in the short term -- I'd love to, but there probably won't be enough time before next ~June. It's not a trivial change...

@BlackIsTheNewBlack
Copy link

@lberki pointed out offline that the configuration for this would ideally be per-WORKSPACE, rather than a top-level flag or part of the toolchain.

It is fine to have a default per-WORKSPACE, but please consider that many projects are put together under the same workspace, some even from different companies, so it should at least be configurable per-BUILD file. It's fine to have standards, but the configuration should fit the status-quo, not viceversa.

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 3 years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 28, 2023
@cushon cushon added not stale Issues or PRs that are inactive but not considered stale and removed stale Issues or PRs that are stale (no activity for 30 days) labels Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not stale Issues or PRs that are inactive but not considered stale P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-Java Issues for Java rules type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants