Jingwen Chen | 0b36a7c | 2021-02-03 08:29:55 -0500 | [diff] [blame] | 1 | # Platforms and toolchains for AOSP. |
| 2 | # |
Jingwen Chen | 3b3e56b | 2021-10-07 10:28:45 +0000 | [diff] [blame] | 3 | # Set default target platform for builds to rely on product config's arch and os variables |
| 4 | build --platforms //build/bazel/platforms:android_target |
Jingwen Chen | 0b36a7c | 2021-02-03 08:29:55 -0500 | [diff] [blame] | 5 | |
Jingwen Chen | 81608a1 | 2021-11-09 11:54:52 +0000 | [diff] [blame] | 6 | # Use the target platform (android_x86, android_arm) in the bazel-out/ output |
| 7 | # directory name fragment instead of the CPU (darwin, k8). This avoids |
| 8 | # thrashing the output directory when switching between top level target |
| 9 | # --platforms values. |
| 10 | build --experimental_platform_in_output_dir |
| 11 | |
Jingwen Chen | 3b3e56b | 2021-10-07 10:28:45 +0000 | [diff] [blame] | 12 | # Use toolchain resolution to find the cc toolchain. |
Jingwen Chen | 0b36a7c | 2021-02-03 08:29:55 -0500 | [diff] [blame] | 13 | build --incompatible_enable_cc_toolchain_resolution |
| 14 | |
Jingwen Chen | 9135d6b | 2021-04-07 13:53:14 +0000 | [diff] [blame] | 15 | # Ensure that the host_javabase always use @local_jdk, the checked-in JDK. |
Alex Humesky | 32596dd | 2021-08-13 02:06:23 +0000 | [diff] [blame] | 16 | build --tool_java_runtime_version=local_jdk |
Romain Jobredeaux | 9d3fe1c | 2021-08-26 14:44:30 +0000 | [diff] [blame] | 17 | build --java_runtime_version=local_jdk |
Jingwen Chen | 9135d6b | 2021-04-07 13:53:14 +0000 | [diff] [blame] | 18 | |
Jingwen Chen | 14e8903 | 2020-10-12 10:32:35 +0000 | [diff] [blame] | 19 | # Lock down the PATH variable in actions to /usr/bin and /usr/local/bin. |
| 20 | build --experimental_strict_action_env |
| 21 | |
| 22 | # Explicitly allow unresolved symlinks (it's an experimental Bazel feature) |
| 23 | build --experimental_allow_unresolved_symlinks |
| 24 | |
Chris Parsons | cebcbe2 | 2021-05-25 12:22:58 -0400 | [diff] [blame] | 25 | # Enable usage of experimental cc-related build APIs |
Jingwen Chen | 14e8903 | 2020-10-12 10:32:35 +0000 | [diff] [blame] | 26 | build --experimental_cc_shared_library |
Chris Parsons | cebcbe2 | 2021-05-25 12:22:58 -0400 | [diff] [blame] | 27 | build --experimental_starlark_cc_import |
Jingwen Chen | 14e8903 | 2020-10-12 10:32:35 +0000 | [diff] [blame] | 28 | |
Jingwen Chen | fcb0c32 | 2021-05-12 10:45:51 +0000 | [diff] [blame] | 29 | # Do not tokenize copts, other than strings that consist of a single Make |
| 30 | # variable. This prevents the need to double-escape characters like backslashes |
| 31 | # and quotes in copts. |
| 32 | build --features no_copts_tokenization |
| 33 | |
Chris Parsons | 6c70b3c | 2021-03-01 19:34:56 -0500 | [diff] [blame] | 34 | # Disable local cpp toolchain detection, as it is explicitly declared in AOSP. |
| 35 | build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| 36 | |
Liz Kammer | 296a481 | 2021-11-15 08:58:45 -0500 | [diff] [blame] | 37 | build --proto_compiler=//external/protobuf:aprotoc |
| 38 | |
Chris Parsons | 200cd8f | 2021-04-22 12:21:48 -0400 | [diff] [blame] | 39 | # Disable sandboxing for CppCompile actions, as headers are not fully specified. |
| 40 | # TODO(b/186116353): This is a temporary fix, as appropriately-sandboxed actions |
| 41 | # are a long term goal. |
| 42 | build --strategy=CppCompile=standalone |
| 43 | |
Chris Parsons | dfa069e | 2021-05-18 13:46:27 -0400 | [diff] [blame] | 44 | # Enable use of the implementation_deps attribute in native cc rules |
Jingwen Chen | 4c9bf6f | 2021-05-18 23:38:28 +0000 | [diff] [blame] | 45 | build --experimental_cc_implementation_deps |
Chris Parsons | dfa069e | 2021-05-18 13:46:27 -0400 | [diff] [blame] | 46 | |
Jingwen Chen | 14e8903 | 2020-10-12 10:32:35 +0000 | [diff] [blame] | 47 | # Enable building targets in //external:__subpackages__. |
| 48 | common --experimental_sibling_repository_layout |
| 49 | common --experimental_disable_external_package |
Jingwen Chen | 2c11916 | 2020-10-13 22:52:53 +0000 | [diff] [blame] | 50 | |
| 51 | # Enable toplevel_output_directories and Ninja executor in Bazel |
| 52 | common --experimental_ninja_actions |
Jingwen Chen | 730a4b6 | 2020-11-05 03:29:34 -0500 | [diff] [blame] | 53 | |
| 54 | # Increase refresh rate of command line UI for improved perceived responsiveness. |
| 55 | common --show_progress_rate_limit=0.05 |
| 56 | |
| 57 | # These are disabled when running under soong_ui (default = auto). Force enable them here. |
| 58 | common --color=yes |
| 59 | common --curses=yes |
| 60 | |
| 61 | # Show the full set of flags for observability and debuggability. |
| 62 | common --announce_rc |
| 63 | |
Jingwen Chen | 5671a1e | 2020-11-05 04:23:13 -0500 | [diff] [blame] | 64 | # Run bazel query from the workspace, without cd'ing into out/soong/queryview |
| 65 | # Note that this hardcodes the output dir. It will not work if $OUT_DIR != out. |
| 66 | common:queryview --package_path=%workspace%/out/soong/queryview |
| 67 | |
Chris Parsons | 360632d | 2021-04-21 18:45:12 -0400 | [diff] [blame] | 68 | # Run bazel query from the workspace, without cd'ing into out/soong/workspace |
Jingwen Chen | e43ad63 | 2020-12-02 04:37:31 -0500 | [diff] [blame] | 69 | # Note that this hardcodes the output dir. It will not work if $OUT_DIR != out. |
Chris Parsons | 360632d | 2021-04-21 18:45:12 -0400 | [diff] [blame] | 70 | common:bp2build --package_path=%workspace%/out/soong/workspace |
Jingwen Chen | e43ad63 | 2020-12-02 04:37:31 -0500 | [diff] [blame] | 71 | |
Jingwen Chen | 7461e3e | 2022-02-09 10:52:46 +0000 | [diff] [blame] | 72 | # Configurations specific to CI builds, generally to improve signal-to-noise ratio in server logs. |
| 73 | common:ci --color=no |
| 74 | common:ci --curses=no |
| 75 | common:ci --show_progress_rate_limit=5 |
| 76 | common:ci --noshow_loading_progress |
| 77 | test:ci --keep_going |
| 78 | test:ci --test_output=errors |
| 79 | |
Jingwen Chen | 730a4b6 | 2020-11-05 03:29:34 -0500 | [diff] [blame] | 80 | # Support a local user-specific bazelrc file. |
| 81 | try-import %workspace%/user.bazelrc |
Alex Humesky | a8d3f7c | 2021-03-18 01:28:38 -0400 | [diff] [blame] | 82 | |
| 83 | build --android_sdk=//prebuilts/sdk:android_sdk |
| 84 | build --experimental_enable_android_migration_apis |
| 85 | build --experimental_google_legacy_api |
| 86 | build --incompatible_java_common_parameters |
| 87 | build --android_databinding_use_v3_4_args |
| 88 | build --experimental_android_databinding_v2 |
Romain Jobredeaux | 86499f4 | 2021-08-02 17:22:32 +0000 | [diff] [blame] | 89 | build --define=android_incremental_dexing_tool=d8_dexbuilder |
| 90 | build --define=android_dexmerger_tool=d8_dexmerger |
| 91 | build --nouse_workers_with_dexbuilder |
Romain Jobredeaux | 9d3fe1c | 2021-08-26 14:44:30 +0000 | [diff] [blame] | 92 | build --fat_apk_cpu=k8 |
Jingwen Chen | edb7db0 | 2021-04-13 08:16:03 +0000 | [diff] [blame] | 93 | |
Jingwen Chen | 0a831a6 | 2022-01-07 14:57:16 +0000 | [diff] [blame] | 94 | # TODO(b/199038020): Use a python_toolchain when we have Starlark rules_python. |
| 95 | # This also means all python scripts are using py3 runtime. |
| 96 | build --python_top=//prebuilts/build-tools:python3 |
| 97 | build --noincompatible_use_python_toolchains |
| 98 | |
Jingwen Chen | edb7db0 | 2021-04-13 08:16:03 +0000 | [diff] [blame] | 99 | # Developer instance for result storage. This only works if you have access |
| 100 | # to the Bazel GCP project. Follow the GCP gcloud client's auth instructions to |
| 101 | # use --google_default_credentials. |
| 102 | build:results --remote_instance_name=projects/bazel-untrusted/instances/default_instance |
| 103 | build:results --project_id=bazel-untrusted |
| 104 | build:results --remote_timeout=600 |
| 105 | build:results --google_default_credentials |
| 106 | build:results --test_summary=detailed |
| 107 | build:results --bes_backend=buildeventservice.googleapis.com |
| 108 | build:results --bes_results_url=https://source.cloud.google.com/results/invocations |
| 109 | build:results --show_progress_rate_limit=5 |