bazel_maven_repository
bazel_maven_repository copied to clipboard
Reduce build_snippet use by adding some common configuration features.
Tracking bug to expand configuration to support (not exhaustive). (Might move this to be just a project).
- [ ] global aliasing (rewrite all references of
@maven//foo/bar
to@maven//foo/bar:other
). Package level aliases (only for dependency references) are already implemented, this is a feature for public consumption of the dep. - [x] shallow deps exclusions (e.g., trimming out deps not declared optional, but which are not necessary for the intended uses.
- [ ] data dependencies (e.g. data = ["//my/dep/to/generate:robolectric-deps.properties"])
- [ ] exports (exported dependencies)
- [ ] extra build snippet logic (e.g. build_prefix) which can be useful for alias targets where the generated targets are perfectly serviceable and there is no reason to modify them. e.g. adding an aggregation target for hamcrest so
@maven//org/hamcrest
both works, and exports hamcrest-core and hamcrest-library (a very common setup). - [ ] annotation processing hookups
- [ ] Two-artifact (dep on annotations, processor in a separate artifact, e.g. dagger)
- [ ] One-artifact (core annotations and processor in one artifact, e.g. autofactory)
- [x] testonly
- [x] dependency exclusions
Probably more than this, but shallow deps and data deps are needed, for instance, to avoid having a build_snippet.
The criteria for this feature is that the configuration can't be worse/harder than just using a build_snippet. That's probably true anyway, but it really depends on specifics. with build_snippets you need to maintain the deps list, so even just getting that while doing some of these other features should make things simpler, but it definitely makes the master artifact list harder to keep as one-liner. ...though technically we could just encourage people to do:
ROBOLECTRIC_CONFIG = {
"sha256" = "deadbeefabcdef1234567890",
"data" : [
"//path/to/generated:robolectric-deps.properties",
],
"excluded_deps" : [
"all.the.maven:crap",
],
}
and then in the artifact list it's just:
maven_repository_specification(
name = "maven",
artifacts = {
"org.robolectric:robolectric:3.8": ROBOLECTRIC_CONFIG
},
)