google / bazel-common

Common functionality for Google's open-source libraries that are built with bazel.
Apache License 2.0
85 stars 40 forks source link

Unable to set custom api_level and build_tools_version #93

Open changusmc opened 4 years ago

changusmc commented 4 years ago

Hello, I'm trying to use this rule in my Workspace as such

http_archive(
    name = "google_bazel_common",
    strip_prefix = "bazel-common-9e3880428c1837db9fb13335ed390b7e33e346a7",
    urls = ["https://github.com/google/bazel-common/archive/9e3880428c1837db9fb13335ed390b7e33e346a7.zip"],
)

load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")

google_common_workspace_rules()

I want to set the api_level to 28 and build_tools_version to 28.0.3, I don't see any way to do that currently.

If I add android_sdk_repository after loading google_common_workspace_rules, I get this error:

Error:/Users/changd/dev/xplat/WORKSPACE:87:1: Cannot redefine repository after any load statement in the WORKSPACE file (for repository 'androidsdk')

Can we parameterize google_common_workspace_rules()?

jingtang10 commented 4 years ago

+1

This is a blocker for us as well.

jingtang10 commented 4 years ago

I'd like to post our workaround for this issue. We have essentially made a copy of https://github.com/google/bazel-common/blob/master/workspace_defs.bzl and stripped out the native.android_sdk_repository in the definition google_common_workspace_rules.

It's awfully hacky - so yes would very much like to see this resolved.

Thanks.