Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ tools_flags: &tools_flags
? "--incompatible_enable_android_toolchain_resolution=false"
# Sandboxed SDK tools depend on libraries that require Java runtime 17 or higher.
? "--java_runtime_version=17"
? "--android_platforms=//:armeabi-v7a"
rules_flags: &rules_flags
? "--enable_bzlmod=false"
? "--incompatible_enable_android_toolchain_resolution=false"
? "--android_platforms=//:armeabi-v7a"

tools: &tools
name: "Tools"
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use_repo(
)

# python-related dependency setup
bazel_dep(name = "rules_python", version = "0.28.0", repo_name = "rules_python")
bazel_dep(name = "rules_python", version = "0.29.0", repo_name = "rules_python")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand Down
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ maybe(
name = "androidndk",
)

load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

load("defs_dev.bzl", "rules_android_workspace")

rules_android_workspace()
Expand Down
4 changes: 1 addition & 3 deletions defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_jav
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load("@rules_python//python:pip.bzl", "pip_parse")
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
load("@rules_python//python:repositories.bzl", "python_register_toolchains")

# Handle python pip requirements.
load("//py_support:vendored_py_requirements.bzl", pip_install_deps = "install_deps")
Expand Down Expand Up @@ -103,8 +103,6 @@ def rules_android_workspace():
rules_proto_dependencies()
rules_proto_toolchains()

py_repositories()

python_register_toolchains(
name = "python3_11",
# Available versions are listed in @rules_python//python:versions.bzl.
Expand Down
8 changes: 4 additions & 4 deletions prereqs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ def rules_android_prereqs(dev_mode = False):
maybe(
http_archive,
name = "rules_python",
strip_prefix = "rules_python-0.23.1",
sha256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580",
strip_prefix = "rules_python-0.29.0",
urls = [
"https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz",
"https://github.com/bazelbuild/rules_python/releases/download/0.29.0/rules_python-0.29.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.29.0/rules_python-0.29.0.tar.gz",
],
sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
)

_apksig_archive()
Expand Down
3 changes: 3 additions & 0 deletions rules/android_binary_internal/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ ATTRS = _attrs.replace(
default = "native",
values = ["native", "legacy", "manual_main_dex"],
),
user_link_flags = attr.string(
default = "-Wl,-soname",
),
_java_toolchain = attr.label(
default = Label("//tools/jdk:toolchain_android_only"),
),
Expand Down
7 changes: 7 additions & 0 deletions rules/android_binary_internal/rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,11 @@ def android_binary_internal_macro(**attrs):
Args:
**attrs: Rule attributes
"""
user_link_flags = select({
"@bazel_tools//src/conditions:darwin_x86_64": "-Wl,-install_name,lib{target_name}",
"@bazel_tools//src/conditions:darwin_arm64": "-Wl,-install_name,lib{target_name}",
"//conditions:default": "-Wl,-soname=lib{target_name}",
})
# if 'user_link_flags' not in attrs:
# attrs["user_link_flags"] = user_link_flags
android_binary_internal(**sanitize_attrs(attrs))
2 changes: 1 addition & 1 deletion rules/native_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def process(ctx, filename, merged_native_libs = {}):
)
linker_input = cc_common.create_linker_input(
owner = ctx.label,
user_link_flags = ["-Wl,-soname=lib" + actual_target_name],
user_link_flags = [ ctx.attr.user_link_flags.format(target_name = actual_target_name) ]
)
cc_info = cc_common.merge_cc_infos(
cc_infos = _concat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ dummy_json_file="$(mktemp)"
echo "{\"shrinker_config\": [\"-keepclassmembers a b c\", \"foobar\", \"-someflag 1 2 3\"], \"foo\": \"bar\"}" > "$dummy_json_file"

# Dummy output dummy output file
test_output_file="$(mktemp -p /tmp test.XXXX)"
expected_output_file="$(mktemp -p /tmp golden.XXXX)"
test_output_file="$(mktemp /tmp/test.XXXX)"
expected_output_file="$(mktemp /tmp/golden.XXXX)"
# Expected outcome is a\nb\nc
echo -ne "-keepclassmembers a b c\nfoobar\n-someflag 1 2 3" > "$expected_output_file"

Expand Down