Skip to content

Commit

Permalink
Fixes for windows, and a task to test building the basicapp example o…
Browse files Browse the repository at this point in the history
…n Windows with bazelci.

Closes #235

PiperOrigin-RevId: 638357222
Change-Id: I3aacf27ba2799294d3bbe2ca3ce72bf15bdc3d0f
  • Loading branch information
ahumesky authored and copybara-github committed May 29, 2024
1 parent 613b117 commit d25741d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,13 @@ tasks:
? "--enable_bzlmod"
build_targets:
- "//java/com/basicapp:basic_app"
windows_basicapp_bzlmod:
name: "Windows Basicapp Bzlmod"
platform: windows
name: basicapp
working_directory: examples/basicapp
build_flags:
<<: *rules_flags
? "--enable_bzlmod"
build_targets:
- "//java/com/basicapp:basic_app"
29 changes: 24 additions & 5 deletions rules/android_sdk_repository/helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _create_config_setting_rule():
if not native.existing_rule(name):
native.config_setting(
name = name,
values = {"host_cpu": "x64_" + name},
constraint_values = ["@platforms//os:windows"],
)

native.config_setting(
Expand Down Expand Up @@ -324,21 +324,40 @@ def create_android_sdk_rules(
],
)

native.sh_binary(
# For the default Android toolchain //toolchains/android:android_default
native.alias(
name = "aapt2",
actual = select({
":windows": "build-tools/%s/aapt2.exe" % build_tools_directory,
"//conditions:default": ":aapt2_binary",
}),
)

native.alias(
name = "fail",
srcs = select({
":windows": [":generate_fail_cmd"],
"//conditions:default": [":generate_fail_sh"],
actual = select({
":windows": ":windows_fail.cmd",
"//conditions:default": ":bash_fail",
}),
)

native.sh_binary(
name = "bash_fail",
srcs = [":generate_fail_sh"],
)

native.genrule(
name = "generate_fail_sh",
outs = ["fail.sh"],
cmd = "echo -e '#!/bin/bash\\nexit 1' >> $@; chmod +x $@",
executable = 1,
)

native.sh_binary(
name = "windows_fail.cmd",
srcs = [":generate_fail_cmd"],
)

native.genrule(
name = "generate_fail_cmd",
outs = ["fail.cmd"],
Expand Down
2 changes: 1 addition & 1 deletion toolchains/android/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ _ATTRS = dict(
aapt2 = attr.label(
allow_files = True,
cfg = "exec",
default = "@androidsdk//:aapt2_binary",
default = "@androidsdk//:aapt2",
),
aar_import_checks = attr.label(
allow_single_file = True,
Expand Down

0 comments on commit d25741d

Please sign in to comment.