-
Notifications
You must be signed in to change notification settings - Fork 4k
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
android_import_external #4654
Comments
There's I'm not sure what's the future is on resolving remote AAR and JAR dependencies. @cgrushko, are you still planning on deprecating |
cc @aj-michael |
It doesn't seem too nontrivial to adapt the |
I’d recommend considering not adopting the java_import_external API which
is somewhat low-level (for example no attribute for coordinates) but only
taking the implementation (maybe exposing part of the current
implementation for reuse) and thinking of a maven_import_external rule
which also supports aar. You can see the “design a publish story” for some
more thoughts on the subject
…On Mon, 19 Feb 2018 at 7:28 Jingwen ***@***.***> wrote:
It doesn't seem too nontrivial to adapt the java_import_external
implementation to use aar_import.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4654 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF01sSQOQ81JXfD6LMX5iiZ8Mo_1bks5tWQZpgaJpZM4SJ-i0>
.
|
I've implemented The use case is specific to gmaven_rules because gmaven_rules resolves and generates targets automatically. I agree with @ittaiz that it's low-level and there can be an intermediary abstraction to resolve coordinates to URLs. In gmaven_rules, there's a |
My colleague @natansil also started work on this direction here (
bazelbuild/rules_scala#473) and we'll probably send
upstream the majority of it.
There's also someone interested in working on maven_import which is like
java_import but will expose a MavenCoordinates provider for consumption
…On Mon, Apr 16, 2018 at 5:13 PM Jingwen ***@***.***> wrote:
I've implemented aar_import_external for use in gmaven_rules
<https://github.com/bazelbuild/gmaven_rules/blob/master/import_external.bzl>.
I'll see how I can bring this upstream to either Bazel or the upcoming
Skylark home at https://github.com/bazelbuild/rules_android
The use case is specific to gmaven_rules because gmaven_rules resolves and
generates targets automatically. I agree with @ittaiz
<https://github.com/ittaiz> that it's low-level and there can be an
intermediary abstraction to resolve coordinates to URLs. In gmaven_rules,
there's a gmaven_artifact macro
<https://github.com/bazelbuild/gmaven_rules#usage-instructions> that
converts an artifact coordinate to the generated target name.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4654 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIFy8_3UpOgu4GRuGufqpbD6VEA67gks5tpKb7gaJpZM4SJ-i0>
.
|
I recommend using |
This PR copies "upstream" a change made to java_import_external in`rules_scala` (see [PR](bazelbuild/rules_scala#473)) This change was originally proposed by @dslomov [here](#3528) (search for 'jvm_import_external') java_import_external was changed to `jvm_import_external` 'template like' rule + `java_import_external` macro in order to allow for other jvm languages (e.g. scala and kotlin) to utilize the 'import_external' functionality without copying the boiler plate again and again. This has already been used in `rules_scala` with the introduction of `scala_import_external` and `scala_maven_import_external` In addition to the `import rule name`, `jvm_import_external` can also be called with custom attributes needed by the underlying import rules, as well as a custom load statement. `java_import_external` is used as a macro in rules_scala to make sure it's still functioning properly after the change. `jvm_maven_import_external` exposes maven artifact terminology. This will also allow to create a `maven_import_external` macro that will delegate to `jvm_maven_import_external` with a `maven_import` rule which will have `MavenCoordinates` Provider as discussed [here](#4654) Closes #5068. PiperOrigin-RevId: 198398621
Usage example: ```python # In WORKSPACE load("@bazel_tools//tools/build_defs/repo:android.bzl", "aar_import_external", "aar_maven_import_external") # Specify the URL directly: aar_import_external( name = "com_android_support_preference_v14_25_1_0", # required licenses = ["notice"], # required aar_urls = [ # required "https://dl.google.com/dl/android/maven2/com/android/support/preference-v14/25.1.0/preference-v14-25.1.0.aar" ], aar_sha256 = "442473fe5c395ebef26c14eb01d17ceda33ad207a4cc23a32a2ad95b87edfabb", # optional or empty string deps = [ # optional or empty list "@com_android_support_recyclerview_v7_25_1_0//aar", "@com_android_support_appcompat_v7_25_1_0//aar", "@com_android_support_preference_v7_25_1_0//aar", "@com_android_support_support_v4_25_1_0//aar", ], ) # Or, specify the artifact coordinate: aar_maven_import_external( name = "com_android_support_preference_v14_25_1_0", # required artifact = "com.android.support.test:preference-v14:25.1.0", # required sha256 = "442473fe5c395ebef26c14eb01d17ceda33ad207a4cc23a32a2ad95b87edfabb" # optional or empty string licenses = ["notice"], # required server_urls = ["https://maven.google.com"], # required deps = [ # optional or empty list "@com_android_support_recyclerview_v7_25_1_0//aar", "@com_android_support_appcompat_v7_25_1_0//aar", "@com_android_support_preference_v7_25_1_0//aar", "@com_android_support_support_v4_25_1_0//aar", ], ) # In BUILD.bazel android_library( name = "foo", srcs = [...], deps = [ "@com_android_support_preference_v14_25_1_0//aar", ], ) ``` To test this out with gmaven_rules, change the `load` statement in https://github.com/bazelbuild/gmaven_rules/blob/master/gmaven.bzl to ``` load('@bazel_tools//tools/build_defs/repo:android.bzl', 'aar_import_external') load('@bazel_tools//tools/build_defs/repo:java.bzl', 'java_import_external') ``` Fixes bazelbuild#4654 RELNOTES: New rules for importing Android dependencies: `aar_import_external` and `aar_maven_import_external`. `aar_import_external` enables specifying external AAR dependencies using a list of HTTP URLs for the artifact. `aar_maven_import_external` enables specifying external AAR dependencies using the artifact coordinate and a list of server URLs. Closes bazelbuild#5319. Change-Id: I9517e68ab78f2e30fb6ceabfe3b35061c585d607 PiperOrigin-RevId: 199839047
Description of the problem / feature request:
java_import_external
is awesome. We should add an Android equivalent for.aar
files.Have you found anything relevant by searching the web?
Somewhat related: https://groups.google.com/d/msg/bazel-discuss/t0BOBD9UYn0/1YEvlZQHAwAJ
The text was updated successfully, but these errors were encountered: