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 a redirect system to allow non-snippet interdiction of generated targets #124

Open
cgruber opened this issue Jul 7, 2020 · 0 comments
Labels
Priority-2 Useful feature, and should be on the roadmap Type-enhancement New feature or request

Comments

@cgruber
Copy link
Collaborator

cgruber commented Jul 7, 2020

Right now, to configure an annotation processor or kt_compiler_plugin you need to use a build snippet, voiding the warranty (so to speak) on the other features of BMR, such as deps computation. You also have to fiddle with group-level substitutions, etc.

A more powerful approach would be to allow a redirection, in the following sense. If you, say, put in:

   "com.google.dagger:dagger.2.16": { "redirect": "//third_party/dagger" }

The following would happen:

  • the regular artifact raw_jvm_import would be generated under an alternate name iwth a standard convention
    • e.g. "dagger__original"
    • Unless modified, the visibility of the target would be the present package and the redirect target.
  • All local (in same generated package build file) references to that target would point at "dagger_original"
  • In place of the normal target location (e.g. @maven//com/google/dagger:dagger) would be an alias to the
    redirection target.

Thus, one could define in //third_party/dagger:

java_library(
    name = "dagger",
    exported_plugins = [":compiler_plugin"],
    exports = [ "@maven//com/google/dagger:dagger__original" ],
    visibility = ["//visibility:public"],
)

java_plugin(
    name = "compiler_plugin",
    processor_name = "a.b.c.whatever",
    deps = [ "@maven//com/google/dagger:dagger_compiler" ],
)

And any uses outside of the external workspace "maven"'s com/google/dagger package could reference @maven//com/google/dagger and the alias would point them at //third_party/dagger.

A subtask of #52

@cgruber cgruber added Priority-2 Useful feature, and should be on the roadmap Type-enhancement New feature or request labels Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority-2 Useful feature, and should be on the roadmap Type-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant