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

Expose current repository name to Java with @AutoBazelRepository #16736

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Nov 10, 2022

Java targets depending on @bazel_tools//tools/java/runfiles can add the new @AutoBazelRepository to a class to have an annotation processor generate a companion class with a BAZEL_REPOSITORY constant containing the repository name of the target that compiled the class.

This requires a small addition to JavaBuilder to parse the repository name out of the target label and pass it to javac as a processor option.

Work towards #16124

Closes #16683.

PiperOrigin-RevId: 487573496
Change-Id: Id9b6526ce32268089c91c6d17363d1e7682f64a4

Java targets depending on `@bazel_tools//tools/java/runfiles` can add the new `@AutoBazelRepository` to a class to have an annotation processor generate a companion class with a `BAZEL_REPOSITORY` constant containing the repository name of the target that compiled the class.

This requires a small addition to JavaBuilder to parse the repository name out of the target label and pass it to javac as a processor option.

Work towards bazelbuild#16124

Closes bazelbuild#16534.

PiperOrigin-RevId: 487573496
Change-Id: Id9b6526ce32268089c91c6d17363d1e7682f64a4
@fmeum fmeum requested a review from ShreeM01 as a code owner November 10, 2022 18:24
@fmeum
Copy link
Collaborator Author

fmeum commented Nov 10, 2022

@Wyverald

@Wyverald Wyverald enabled auto-merge (squash) November 10, 2022 18:28
@Wyverald Wyverald merged commit 0f95c8a into bazelbuild:release-6.0.0 Nov 10, 2022
@fmeum fmeum deleted the release-6.0.0-16683 branch November 10, 2022 18:54
@ShreeM01 ShreeM01 added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants