From 2e4d462744c009cb225d4ce2c41268044bd42b03 Mon Sep 17 00:00:00 2001 From: John Cater Date: Tue, 16 Jan 2024 09:52:07 -0500 Subject: [PATCH] Update Android examples to use new Android flags. Fixes #381. --- .bazelci/android.yml | 11 +++-------- android/jetpack-compose/BUILD.bazel | 8 ++++++++ android/ndk/BUILD.bazel | 15 +++++++++++++++ android/robolectric-testing/BUILD.bazel | 7 +++++++ 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 android/ndk/BUILD.bazel create mode 100644 android/robolectric-testing/BUILD.bazel diff --git a/.bazelci/android.yml b/.bazelci/android.yml index 761f718e5..e51ce04fe 100644 --- a/.bazelci/android.yml +++ b/.bazelci/android.yml @@ -5,7 +5,6 @@ common: bazel: last_green working_directory: ../android/firebase-cloud-messaging build_flags: - - "--incompatible_enable_android_toolchain_resolution" - "--android_platforms=//:arm64-v8a" build_targets: - "//app:app" @@ -14,11 +13,7 @@ common: bazel: 6.3.2 working_directory: ../android/ndk build_flags: - # TODO(https://github.com/bazelbuild/rules_android/issues/77): - # Enable Android Platforms. - - "--noincompatible_enable_android_toolchain_resolution" - - "--fat_apk_cpu=arm64-v8a,x86" - - "--android_crosstool_top=@androidndk//:toolchain" + - "--android_platforms=//:arm64-v8a,//:x86" - "--enable_bzlmod" build_targets: - "//app/src/main:app" @@ -28,7 +23,7 @@ common: bazel: 6.3.2 working_directory: ../android/jetpack-compose build_flags: - - "--noincompatible_enable_android_toolchain_resolution" + - "--android_platforms=//:arm64-v8a" - "--remote_download_outputs=all" - "--enable_bzlmod" build_targets: @@ -39,7 +34,7 @@ common: bazel: 6.3.2 working_directory: ../android/robolectric-testing test_flags: - - "--noincompatible_enable_android_toolchain_resolution" + - "--android_platforms=//:arm64-v8a" - "--enable_bzlmod" test_targets: - "//app:test" diff --git a/android/jetpack-compose/BUILD.bazel b/android/jetpack-compose/BUILD.bazel index 3dbf905e6..fe53afc3d 100644 --- a/android/jetpack-compose/BUILD.bazel +++ b/android/jetpack-compose/BUILD.bazel @@ -7,3 +7,11 @@ kt_compiler_plugin( visibility = ["//visibility:public"], deps = ["@maven//:androidx_compose_compiler_compiler"], ) + +platform( + name = "arm64-v8a", + constraint_values = [ + "@platforms//cpu:arm64", + "@platforms//os:android", + ], +) diff --git a/android/ndk/BUILD.bazel b/android/ndk/BUILD.bazel new file mode 100644 index 000000000..a0a7bb9a3 --- /dev/null +++ b/android/ndk/BUILD.bazel @@ -0,0 +1,15 @@ +platform( + name = "arm64-v8a", + constraint_values = [ + "@platforms//cpu:arm64", + "@platforms//os:android", + ], +) + +platform( + name = "x86", + constraint_values = [ + "@platforms//cpu:x86_32", + "@platforms//os:android", + ], +) diff --git a/android/robolectric-testing/BUILD.bazel b/android/robolectric-testing/BUILD.bazel new file mode 100644 index 000000000..47bc9d328 --- /dev/null +++ b/android/robolectric-testing/BUILD.bazel @@ -0,0 +1,7 @@ +platform( + name = "arm64-v8a", + constraint_values = [ + "@platforms//cpu:arm64", + "@platforms//os:android", + ], +)