-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maven_install is strongly superior to previous forms of grabbing dependencies from Maven as it computes the appropriate versions to use from the full transitive dependencies of all libraries used by an application. It also has much less boilerplate and includes dependencies with generated targets. In the future we will drop the jvm_maven_import_external usages and require maven_install, at which point we can swap to using the `@maven' repository and no longer depend on compat_repositories. Fixes #5359
- Loading branch information
Showing
9 changed files
with
121 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
workspace(name = "io_grpc_grpc_java") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "rules_jvm_external", | ||
sha256 = "62133c125bf4109dfd9d2af64830208356ce4ef8b165a6ef15bbff7460b35c3a", | ||
strip_prefix = "rules_jvm_external-3.0", | ||
url = "https://github.com/bazelbuild/rules_jvm_external/archive/3.0.zip", | ||
) | ||
|
||
load("@rules_jvm_external//:defs.bzl", "maven_install") | ||
load("//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS") | ||
load("//:repositories.bzl", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS") | ||
|
||
maven_install( | ||
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS, | ||
generate_compat_repositories = True, | ||
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS, | ||
repositories = [ | ||
"https://repo.maven.apache.org/maven2/", | ||
], | ||
) | ||
|
||
load("@maven//:compat.bzl", "compat_repositories") | ||
|
||
compat_repositories() | ||
|
||
load("//:repositories.bzl", "grpc_java_repositories") | ||
|
||
grpc_java_repositories() | ||
|
||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
|
||
protobuf_deps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c606519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW for those having trouble integrating this patch, here's a patch file you can specify with
patches
to use only maven_install targets: https://gist.github.com/Mythra/c73c3accf416aeb2beda32d656d28651 . This will prevent you from needing to usemaven_compat
with the latest release. An example rule may look something like:We had the following problems with maven_compat for reference:
maven_compat
rules.c606519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mythra, interesting. If you use pinned versions via
maven_install_json
, I'd expect that wouldn't be necessary.c606519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ejona86 is possible, I didn't dig into using
maven_install_json
as it didn't seem relevant. Wasn't mentioned as far as I can tell in any release docs/the example, other than in rules_jvm_external which mentioned "pinning" dependencies. I guess in hindsight it makes sense as to it also being a potential fix, but at the same time I'm not too concerned with a patch for my usecase. Good to know for future reference though.