Support all Android platforms version syntax, not just int version,…#433
Support all Android platforms version syntax, not just int version,…#433anlexN wants to merge 1 commit intobazelbuild:mainfrom
int version,…#433Conversation
… for example: 36-ext18, 36-ext19, 36.1, Baklava, Baklava-ext19, CANARY
|
I have use Android platforms 36.1 to run Bazel Tutorial: Build an Android App successfully. anlexn@project:/mnt/e/workspace/github.com/anlexN/examples/android/tutorial
$ USE_BAZEL_VERSION=8.5.0 bazel build //src/main:app --override_module=rules_android=/home/anlexn/workspace/github.com/anlexN/rules_android/
...
DEBUG: /home/anlexn/.cache/bazel/_bazel_anlexn/86fc1533b577d4f9cad86e46247cdf62/external/rules_jvm_external+/private/lib/coordinates.bzl:76:18: Assuming androidx.test:monitor:aar:3.141.59-fake should be interpreted as androidx.test:monitor:3.141.59-fake@aar
DEBUG: /home/anlexn/.cache/bazel/_bazel_anlexn/86fc1533b577d4f9cad86e46247cdf62/external/rules_jvm_external+/private/lib/coordinates.bzl:76:18: Assuming androidx.test:monitor:aar:3.141.59-fake should be interpreted as androidx.test:monitor:3.141.59-fake@aar
DEBUG: /home/anlexn/.cache/bazel/_bazel_anlexn/86fc1533b577d4f9cad86e46247cdf62/external/rules_jvm_external+/private/lib/coordinates.bzl:76:18: Assuming androidx.test:monitor:aar:3.141.59-fake should be interpreted as androidx.test:monitor:3.141.59-fake@aar
DEBUG: /home/anlexn/.cache/bazel/_bazel_anlexn/86fc1533b577d4f9cad86e46247cdf62/external/rules_jvm_external+/private/lib/coordinates.bzl:76:18: Assuming androidx.test:monitor:aar:3.141.59-fake should be interpreted as androidx.test:monitor:3.141.59-fake@aar
DEBUG: /home/anlexn/.cache/bazel/_bazel_anlexn/86fc1533b577d4f9cad86e46247cdf62/external/rules_jvm_external+/private/lib/coordinates.bzl:76:18: Assuming androidx.test:monitor:aar:3.141.59-fake should be interpreted as androidx.test:monitor:3.141.59-fake@aar
INFO: Analyzed target //src/main:app (1 packages loaded, 428 targets configured).
INFO: Found 1 target...
Target //src/main:app up-to-date:
bazel-bin/src/main/app_deploy.jar
bazel-bin/src/main/app_unsigned.apk
bazel-bin/src/main/app.apk
INFO: Elapsed time: 345.378s, Critical Path: 67.54s
INFO: 406 processes: 907 action cache hit, 17 internal, 356 linux-sandbox, 33 worker.
INFO: Build completed successfully, 406 total actions
anlexn@project:/mnt/e/workspace/github.com/anlexN/examples/android/tutorial
$ USE_BAZEL_VERSION=8.5.0 bazelisk mobile-install //src/main:app --java_runtime_version=17 --java_language_version=17 --tool_java_runtime_version=17 --tool_java_language_version=17 --override_module=rules_android=/home/anlexn/workspace/github.com/anlexN/rules_android/
INFO: Analyzed target //src/main:app (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Aspect @@rules_android+//mobile_install:mi.bzl%MIASPECT of //src/main:app up-to-date:
bazel-bin/src/main/app_mi/launcher
...
arg[ 37] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/split_mi_32.apk
arg[ 38] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/split_mi_desugar_globals.apk
arg[ 39] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/split_mi_00.apk
arg[ 40] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/split_mi_native_libs_host_platform.apk
arg[ 41] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/split_jresources.apk
arg[ 42] = bazel-out/k8-fastbuild/bin/src/main/app_mi/splits/base.apk
arg[ 43] = --create_adblib_session
INFO: Took 7.14 seconds to sync changes
INFO: Finished deploying changes. Launching app
WARNING: No or multiple main activities found, falling back to Monkey launcher. Specify the activity you want with `-- --launch_activity` or `-- --nolaunch_app` to launch nothing.
INFO: Elapsed time: 10.224s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total actionBut some tests can not pass, what happened? I think anlexn@project:~/workspace/github.com/anlexN/rules_android
$ USE_BAZEL_VERSION=8.5.0 bazel test //test/rules/...
WARNING: For repository 'platforms', the root module requires module version platforms@0.0.5, but got platforms@0.0.11 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_java', the root module requires module version rules_java@8.13.0, but got rules_java@8.14.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_shell', the root module requires module version rules_shell@0.1.2, but got rules_shell@0.3.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_jvm_external', the root module requires module version rules_jvm_external@6.6, but got rules_jvm_external@6.7 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.0.3, but got bazel_skylib@1.7.1 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_python', the root module requires module version rules_python@0.37.1, but got rules_python@1.0.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_proto', the root module requires module version rules_proto@6.0.2, but got rules_proto@7.0.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'cgrindel_bazel_starlib', the root module requires module version cgrindel_bazel_starlib@0.17.0, but got cgrindel_bazel_starlib@0.18.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
ERROR: /home/anlexn/workspace/github.com/anlexN/rules_android/test/rules/resources/BUILD:1247:22: in starlark_process_test rule //test/rules/resources:test_exports_manifest_without_resources:
Traceback (most recent call last):
File "/home/anlexn/workspace/github.com/anlexN/rules_android/test/rules/resources/test.bzl", line 149, column 58, in _starlark_process_test_impl
_asserts.provider.starlark_android_resources_info(
File "/home/anlexn/workspace/github.com/anlexN/rules_android/test/utils/asserts.bzl", line 497, column 39, in _assert_starlark_android_resources_info
_assert_resources_node_info_depset(
File "/home/anlexn/workspace/github.com/anlexN/rules_android/test/utils/asserts.bzl", line 477, column 13, in _assert_resources_node_info_depset
fail(
Error in fail: Error for StarlarkAndroidResourcesInfo.transitive_resources_nodes, expected size of list to be 1, got 0:
Expected: [Label("//test/rules/resources:manifest_without_resources")]
Actual: []
ERROR: /home/anlexn/workspace/github.com/anlexN/rules_android/test/rules/resources/BUILD:1247:22: Analysis of target '//test/rules/resources:test_exports_manifest_without_resources' (config: 21d465d) failed
ERROR: Analysis of target '//test/rules/resources:test_exports_manifest_without_resources' failed; build aborted
INFO: Elapsed time: 8.092s, Critical Path: 0.12s
INFO: 29 processes: 100 action cache hit, 29 internal.
ERROR: Build did NOT complete successfully
//test/rules/android_revision:compare_1.0.1_1.0.0 (cached) PASSED in 0.3s
//test/rules/android_revision:compare_1.1.0_1.0.0 (cached) PASSED in 0.2s
//test/rules/android_revision:compare_1.1.1_1.0.1 (cached) PASSED in 0.2s
//test/rules/android_revision:compare_12.0.0_11.0.0 (cached) PASSED in 0.1s
//test/rules/android_revision:compare_2.0.0_1.0.0 (cached) PASSED in 0.2s
//test/rules/android_revision:compare_2.1_2 (cached) PASSED in 0.4s
//test/rules/android_revision:compare_2_1 (cached) PASSED in 0.3s
//test/rules/android_revision:compare_2_1.0 (cached) PASSED in 0.3s
//test/rules/android_revision:micro_missing (cached) PASSED in 0.2s
//test/rules/android_revision:minor_missing (cached) PASSED in 0.2s
//test/rules/android_revision:version_1.2.3 (cached) PASSED in 0.3s
//test/rules/resources:test_filtering_with_multiple_cpus (cached) PASSED in 0.2s
//test/rules/resources:test_filtering_with_single_cpu (cached) PASSED in 0.2s
//test/rules/resources:test_instrument_xslt_without_xsltproc_specified NO STATUS
//test/rules/resources:test_res_without_manifest NO STATUS
//test/rules/resources:test_resource_package_with_wrong_res_type NO STATUS
//test/rules/resources:test_resource_processing_with_wrong_res_type NO STATUS
//test/rules/resources:test_stamping_manifest_without_java_package NO STATUS
//test/rules/resources:test_xsltproc_without_instrument_xslt_specified NO STATUS
Executed 0 out of 19 tests: 13 tests pass and 6 were skipped.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.@ |
| build_tools_directory = "__build_tools_directory__", | ||
| api_levels = [__api_levels__], | ||
| default_api_level = __default_api_level__, | ||
| api_levels = str(__api_levels__).split(","), |
There was a problem hiding this comment.
per your comments, there are a lot of unrelated errors on CI, but all (most?) of these should be fixed now.
However this looks like a problem:
https://buildkite.com/bazel/rules-android/builds/4101/steps/canvas?sid=019b20c8-bea2-4ca8-8ceb-c5ff88a07928
|
|
||
| for api_level in api_levels: | ||
| if api_level >= 23: | ||
| if api_level >= "23": |
There was a problem hiding this comment.
These checks are worrisome with strings, because while "30" >= "23" is true, so is "Baklava" >= "23" , or anything starting with a letter, and then there are the problems with major/minor, like "30" >= "30.0" and "30.10" >= "30.3" are false
There was a problem hiding this comment.
This also breaks for situations like "123" >= "23", which evaluates to false.
… for example: 36-ext18, 36-ext19, 36.1, Baklava, Baklava-ext19, CANARY