aboutsummaryrefslogtreecommitdiff
path: root/common.bazelrc
AgeCommit message (Collapse)Author
2023-04-13Stop using platform mapping and delete mapping fileRomain Jobredeaux
Bug: 249685973 Test: Presubmit Change-Id: I679e1195c689a35106df9efe31516544f06ac24c
2023-04-13Support sdk_version for java/android/kotlin targets.Romain Jobredeaux
This CL: - Defines a host-only java toolchains with support for switching versions - registers a device and host java toolchains whose attributes depend on java_version, sdk kind and sdk api level build settings. - creates java/android/kotlin rule wrappers that enforce the sdk_transition based on sdk_version and java_version. - enables platform-based toolchain resolution for the android rules. Bug: 240761789 Bug: 215230098 Bug: 186797556 Test: Presubmits Change-Id: If5e444ca4815fff6e80929d9360d6e568c9f49e7
2023-03-17Switch away from local_jdk (to jdk17)Romain Jobredeaux
the @local_jdk repository does not support platform-restrictions, which will become an issue when needing to switch java toolchains based on platform. In addition, there's a bit of inconsistency currently between usages of jdk17 and jdk11, as the default java home is set to jdk17 but we use some custom targets in prebuilts/jdk/jdk11. This CL has bazel stop using the local_jdk and instead specify a local_java_runtime under prebuilts/jdk/jdk17, which we'll be able to impose platform restrictions on later. The Kotlin rules directly refer to @local_jdk//jar, so a stub local_jdk repository is defined to keep this reference valid. Test: presubmits Bug: 215230098 Change-Id: Ifcf443ab9cf69bcc95a10ace2e2bba951b085cf3
2023-02-23Rules changes for Bazel updateLiz Kammer
Test: verification script Change-Id: I1e299ff050b5f2f7289bb3ca11b472b36e618dc8
2023-02-13Add flag to make the Linux sandbox work under /tmpJason Wu
Test: m nothing Bug: 231356847 build --incompatible_sandbox_hermetic_tmp Change-Id: I1dbb1549ae58f4320e7900f6d187e599d8f5acb4
2023-01-25"build" -> "common" in bazelrc where needed to fix "b query"Romain Jobredeaux
Change-Id: I13fc6d4825b9241989cb2fefc7fbd3b2d6ca4708 Test: bazel query --config=bp2build @local_jdk//:all --output=build
2023-01-24Enable writable outputs for bazelChris Parsons
This enables `rm -rf out/` after any `b` build. Fixes: 199358502 Test: Manually verified by building tzdata with b, and attempting to remove the output directory. This succeeds only after this CL. Change-Id: I689580ae5ea25cdddcb2f19923a753d45655e090
2023-01-12Merge "bazelrc changes to support bazel 4b3423 release"Christopher Parsons
2023-01-05Support multiple android products in a single bazel buildCole Faust
We create an android_product macro that replaces a lot of the existing platform code. It takes a soong.variables file, and creates bazel platforms for the android product, various other arches, and the host platforms. (currently host builds still depend on product config variables) To change products, you'll be able to pass --platform=//build/bazel/product_config/generated/products/<product_name>, however currently we only generate the platforms for the currently lunched product for performance. When the other products are in starlark, we can allow using all of them. Bug: 249685973 Test: Presubmits Change-Id: Ic1b0942a60c66eb3fe2b1aa7a2ff436ec9b3c3fb
2023-01-04Run some tests under linux_bionic_x86_64Cole Faust
The tests currently transition into linux_bionic_x86_64, but after the switch to multiproduct bazel builds, they'll use target_compatible_with instead. Run these tests with linux_bionic_x86_64 to ensure they keep coverage. Bug: 249685973 Test: Presubmits of bp2build.sh Change-Id: Ifd2da8ff6e51d6c1ec773a76bc51192743352093
2023-01-04bazelrc changes to support bazel 4b3423 releaseChris Parsons
Test: Verification script Fixes: 260763062 Change-Id: I55321b406ef41f26bf1308d7b00b66cf6a1770cc
2022-12-12Add transition for fdo profile to cc_library_sharedVinh Tran
Add transition to cc_library_shared to propagate fdo profile (set by fdo_profile attr) to static deps. The analysis tests ensures that the profile doesn't get propagated into shared deps. _fdo_profile_transition_correctly_set_and_unset_fdo_profile ensures the bug in bazel config causing duplicated deps is fixed by aosp/2305841. Test: b build //build/bazel/rules/cc:cc_library_shared_tests Bug: 253540178 Change-Id: I89cf3c19c9fac95f75d1e83696613d929c03c49d Merged-In: I89cf3c19c9fac95f75d1e83696613d929c03c49d
2022-11-30Revert "Cd into the bazel workspace instead of using --package_path"Cole Faust
Revert "Allowlist build files in external/python/absl-py" Revert submission 2308141-colefaust_run_b_from_out_folder Reason for revert: Breaks CI due to more instances of the bazel shutdown issue Reverted Changes: I51c28e232:Allowlist build files in external/python/absl-py I9e6530d95:Cd into the bazel workspace instead of using --pac... Change-Id: If1e7223ebef07411a93e0d0489a2beb655a9f413
2022-11-28Cd into the bazel workspace instead of using --package_pathCole Faust
Not everything respects --package_path, for example, %workspace% in bazelrc files. This also makes b builds more consistent with mixed builds, which already cd'd into the workspace folder. Bug: 234449134 Bug: 249685973 Test: Presubmits Change-Id: I9e6530d95efeeea8445edb18197da947ec9fee4a
2022-11-17Change option for ↵Vinh Tran
--experimental_output_directory_naming_scheme=diff_against_baseline from common to build To fix broken queryview incremental CI Test: m queryview & build/bazel/bin/bazel query --config=queryview //... Change-Id: I7e5f9f72b7b03bb98b6bbc2ef0b4a70135e0ceab
2022-11-16Add --experimental_output_directory_naming_scheme=diff_against_baselineVinh Tran
Adding the experimental flag to get rid of the no-op "affected by Starlark transition" in Bazel config when a label-based flag (i.e. //command_line_option:fdo_profile) is set back to None. We have an incoming transition attached to a rule (i.e. _cc_library_shared_proxy) (aosp/2301014) such as ``` def _fdo_profile_transition_impl(_, attr): return { "//command_line_option:fdo_profile": getattr(attr, "fdo_profile"), } ``` which sets `//command_line_option:fdo_profile` to the value of `fdo_profile` attr. Say we have this dependency chain: ``` _cc_lib(name = "a") -> _cc_lib(name = "b", "fdo_profile" = ":fdo") -> _cc_lib(name = "c") ``` Even though the incoming transition ensures that `a` and `c` are built without `fdo_profile`, they're built with different configs. ``` INFO: Displaying config with id d1e8282 (a) affected by starlark transition: [] fdo_profile: null INFO: Displaying config with id 3cfee49 (b) affected by starlark transition: [//command_line_option:fdo_profile] fdo_profile: //:foo INFO: Displaying config with id 1598102 (c) affected by starlark transition: [//command_line_option:fdo_profile] fdo_profile: null ``` The flag make sures "affected by starlark transition" is empty the whole time so that the configs of `a` and `c` converge. Test: cherry-pick aosp/2301014 and b build //external/jsoncpp:libjsoncpp which doesn't set fdo_profile but its dep (i.e. //external/libcxx:libc++) does Change-Id: Icd5b225615de45a7cf026cbb66568a5b6fe7f85b
2022-10-13Move --package_path configs to bazel.sh to support $OUT_DIR != "out".Jingwen Chen
Currently, the bazelrc hardcodes the --package_path for queryview, bp2build and api_bp2build generated workspaces under "$TOP/out", the default $OUT_DIR. However, if $OUT_DIR is set to something else, these flags will break. To fix that, we generate the configs dynamically pointing to the absolute paths ($ABSOLUTE_OUT_DIR). Note that if $OUT_DIR is set to a directory under /tmp, Bazel errors out because it's incompatible with --sandbox_tmpfs_path=/tmp (see b/253396003) Bug: 251436403 Bug: 253396003 Test: new integration tests (see associated change in this topic) Change-Id: Id535d79b7ae12b0eaf73e6edbe3da65db7a5d7e4
2022-10-03Add a config for apigen workspaceSpandan Das
Test: rm -rf out/soong && m api_bp2build Test: TH Change-Id: I232e9a9dd456096ab923f79162541771a5bcc8ba
2022-09-19bazel test uses --test_output=errors by default.Jingwen Chen
This causes "bazel test" invocations to print the stdout and failure/error messages of failing tests. For successful tests, nothing is changed. Bug: 247516541 Fixes: 247516541 Change-Id: Ib77c3eed0ad8e93b56cc84a28e38ecb748a56483
2022-09-16Merge "Delete ResultStore bazelrc config."Treehugger Robot
2022-09-09Change the default --platforms to host, and restrict the allowedJingwen Chen
--platforms values. The current set of allowed --platforms are: - //build/bazel/platforms:linux_x86_64 (default) - //build/bazel/platforms:android_target (infers from product config - variables, i.e. lunch) This list is enforced by the startup --invocation_policy flag. An invalid --platforms value results in: ERROR: Flag value '[//build/bazel/platforms:android_arm64]' for option '--platforms' is not allowed by invocation policy and the policy does not specify a new value. Allowed values are: [//build/bazel/platforms:android_target, //build/bazel/platforms:linux_x86_64] This will prevent undefined behavior, such as `lunch aosp_arm && b build --config=android_x86_64`. Given that the host platform is now default, all android cross compilation commands need to pass --config=android to succeed. The other platform definitions aren't deleted yet because they're needed for split transition configuration (e.g. see apex_aab). Bug: 244766775 Test: presubmits Change-Id: Ifc0ade319543f2c2c5e8581e8282ffd86aac67d0
2022-09-01Merge "Remove --announce_rc for local developer builds."Treehugger Robot
2022-09-01Delete ResultStore bazelrc config.Jingwen Chen
This is not working currently :( (and we'll integrate with Android result store anyway). Test: N/A Change-Id: I84c064a8f86adef2fd6def41ebdc8b540ef97f03
2022-09-01Remove --announce_rc for local developer builds.Jingwen Chen
These are too noisy and don't really add value for most invocations. Add it to --config=ci instead. Test: b info Change-Id: Ib21c63b2249e142925c37fb4a56f5b20a19e0ab8
2022-09-01Make --expereimental_google_legacy_api a common bazelrc flag.Jingwen Chen
Otherwise `b query` on an Android app wouldn't work with: ERROR: /usr/local/google/home/jingwen/aosp/master/out/bazel/output_user_root/5b26397b2f4ecc92e0330c0d80b13fa1/external/rules_android/rules/android_sdk.bzl:21:24: AndroidSdkInfo is experimental and thus unavailable with the current flags. It may be enabled by setting --experimental_google_legacy_api Test: b query //build/bazel/examples/android_app/... Change-Id: I2fb9c95894c845a2260f842ab644b53197aa5483
2022-08-30Changes required to adopt bazel-2570feChris Parsons
- Revert interface_deps changes The change to rename deps to interface_deps was reverted in Bazel. - Reference android platforms using `@` (root workspace) for analysis tests. Workspace resolution must have changed to become more strict, as these constants are used relative to the workspace in which the rule is created. Test: Presubmits Test: mixed_droid Change-Id: Ibf74e1f2730ca6d0ab84b97ee260bbf47f3a2ac3
2022-08-10Add --verbose_failures to bazel ci buildsCole Faust
This can help debug ci failures by showing the full command line of the failing command. Test: ./build/bazel/ci/bp2build.sh Change-Id: I4ce9ed993f29cf14362fe90b6f0d10b5f61073d2
2022-08-04Create platform mappings file.Romain Jobredeaux
This maps the current --fat_apk_cpu setting to //build/bazel/platforms:android_target so that the platform reset that occurs in the android_binary deps split transition knows to use an android (rather than host) platform to build the deps. Test: b build packages/apps/WallpaperPicker + CI Change-Id: I38d23dccb297c97c271b8710c8e72f3809a2cca1 Bug: 240761789 Bug: 215230093 Bug: 215230095
2022-06-14Merge "build/bazel changes to support Bazel@HEAD"Christopher Parsons
2022-06-10build/bazel changes to support Bazel@HEADChris Parsons
Summary of changes: - Removed deprecated flags from bazelrc - Use interface_deps/deps instead of deps/implementation_deps - Use bazel builtin implementation of cc_shared_library and its provider Test: mixed_droid.sh in conjunction with bazel update Change-Id: I0b8166bfc857729bc2d792f8d612dd9424b654ff
2022-05-27Support cc code coverage for mixed buildYu Liu
Bug: 231322627 Test: Manual tests and unit tests Change-Id: Ic1a03f42401018d6f284a95fb36a440f82e1482a
2022-04-28Disable errorprone in bazelVinh Tran
As discussed in aosp/c/platform/build/soong/+/2078047/comments/23c6f20b_62c88cf7, we want to disable errorprone in javac to continue making progress on bazel conversion for java and android. Test: b build //external/junit after allowlisting the module in bp2build Change-Id: I62cfd5ded7dee8c64dae1442ccd9cd44b37443aa
2022-04-22Add --config=<platforms> as a shorthand for --platforms flags.Jingwen Chen
This is less tedious to type and lets us group platform specific flags. Test: b build //build/bazel/... --config=android_arm Change-Id: Id255626340e5e8019638dfc7d094b8fe9a7b83ec
2022-02-10Improve readability / signal-to-noise ratio for CI logs.Jingwen Chen
This change groups text-file-friendly related flags into a ci bazelrc config, and use that in the bp2build CI and bp2build-progress scripts. Test: build/bazel/ci/bp2build.sh Change-Id: I539c94959dff799efa50dd5fede5cef7ba0c963c
2022-01-17Implement a (partial) cc_stub_library rule for cc_library.stubs inJingwen Chen
Android.bp file. This rule is responsible for emitting an object generated from a .map.txt files for symbols associated to a shared library for a particular API level. These libraries set the "stubs" property in their Android.bp definitions. These libraries are used as build-time dependencies of Mainline modules (not the platform, i.e. NDK!). For stub libraries in the NDK, see ndk_library modules). These dependencies are *not* included in the Mainline modules themselves, because the non-stub versions are made available in the device environment through other means (e.g. installed onto the system partition or via other APEXes). These libraries are ABI stable. For this CL's scope, we introduce a new rule that calls ndkstubgen, a python binary, on a library's .map.txt file, which is actually in the format of a LD version script, to generate a .c file containing function prototypes, and two additional metadata files. The .c file would be eventually compiled into a stub .so, replacing the real .so for APEX dependents. The stub .so will be made available through a dedicated cc_shared_library_proxy provider so dependents can easily determine if a transitive dep has stubs for a requested API level. Bug: 207812332 Test: CI Change-Id: I47689c15c375b5dd9f5e70ad213d7d113a9442cc
2021-12-03Implement cc lite/full proto in starlark.Liz Kammer
Test: bp2build.sh Test: mixed_build.sh Change-Id: I72388f01219729007bf3fd552a11790cb08179a1
2021-11-09Set --experimental_platform_in_output_dir.Jingwen Chen
This is a newly introduced flag to create top level output dirs using the platform instead of (legacy) cpu values. This ensures that outputs are stored in platform-specific output dirs, and avoids clobbering outputs when switching between them. Test: CI Bug: https://github.com/bazelbuild/bazel/issues/13818 Bug: 197925723 Change-Id: I118ccdc1b76e3a731d05c6d3fcffbbb825460cd9
2021-10-13Revert "Set --experimental_platform_in_output_dir."Jingwen Chen
Revert "Update Bazel to https://github.com/bazelbuild/bazel/comm..." Revert "Fix test to use --experimental_platform_in_output_dir." Revert submission 1854375-update-bazel-daecf427ec0bf0e963c324783062c4f5b61ff679 Reason for revert: introduces https://cs.opensource.google/bazel/bazel/+/503d56eda25b7e2a12431411bfb7ff286d028405, which conflicts with our current cc_binary->cc_shared_library work Reverted Changes: I40a511195:Fix test to use --experimental_platform_in_output_... I05c2c11f3:Update Bazel to https://github.com/bazelbuild/baze... Ie772d1665:Set --experimental_platform_in_output_dir. Id66674d72:Update Bazel to https://github.com/bazelbuild/baze... Test: CI Change-Id: I2c6df07aa924ed4980212834e52dbc4dd9c778f9
2021-10-13Fix --experimental_platform_in_output_dir to be a build flag, notJingwen Chen
common. The flag doesn't work for `b query`. Test: b query //bionic/... Change-Id: I4628ac4330afd7724b2d9def6964ce4471f987ed
2021-10-12Set --experimental_platform_in_output_dir.Jingwen Chen
This is a newly introduced flag to create top level output dirs using the platform instead of (legacy) cpu values. This ensures that outputs are stored in platform-specific output dirs, and avoids clobbering outputs when switching between them. Test: CI Bug: https://github.com/bazelbuild/bazel/issues/13818 Bug: 197925723 Change-Id: Ie772d16653296dc9cc0c9c6f59fe2b3dc08d4db1
2021-10-07Set the default --platforms value to //build/bazel/platforms:android_target.Jingwen Chen
This platform relies on product config / soong.variables injected into the build via @soong_injection, and thus makes the bazel build dependent on lunch. Test: presubmits Test: lunch aosp_arm; b build //bionic/... Test: lunch aosp_x86; b build //bionic/... Change-Id: I54f9bf28cdd964facceeea858b295e34945a26d4
2021-08-27Add a java binary, a java library, and an android app target building to ↵Romain Jobredeaux
bp2build ci. (Second attempt at https://android-review.googlesource.com/c/platform/build/bazel/+/1788469) Adding the --fat_apk_cpu=k8 flag to common.bazelrc as it only applies to android app building rules, and it is currently required to successfully build them. Forcing the use of the checked in Java JDK to avoid falling back to the local machine's JDK. This may be overkill, but I wrote a small doc to justify the new approach of setting JAVA_HOME in bazel.sh: go/aosp-bazel-jdk Test: b build examples/java/...; b build examples/android_app/...; lunch; b build examples/java/...; b build examples/android_app/... Change-Id: I9ce3886a3e6f1eec903de52493251ec3c5fa7681
2021-08-12Revert "Add a java binary, a java library, and an android app ta..."Alex Humesky
Revert "Exempt prebuilts/jdk and build/bazel/examples/java BUILD..." Revert submission 1789607-java_android_ci Reason for revert: doesn't work with lunch Reverted Changes: I6f82e4984:Exempt prebuilts/jdk and build/bazel/examples/java... I75a61c24c:Define a java_runtime and toolchain bazel targets ... I0f107d334:Add a java binary, a java library, and an android ... Change-Id: I7e29abf4a927b2f4d5e09ab7a54916700b38c866
2021-08-10Add a java binary, a java library, and an android app target building to ↵Romain Jobredeaux
bp2build ci. Excluding cc jni targets as they currently don't compile (but the app does). Adding the --fat_apk_cpu=k8 flag to common.bazelrc as it only applies to android app building rules, and it is currently required to successfully build them. Forcing the use of the checked in Java JDK to avoid falling back to the local machine's JDK. Test: ./build/bazel/ci/bp2build.sh runs successfully Change-Id: I0f107d334f00c6ac7d91396a70c5023e48b6742b Bug: 195786204 Bug: 195786195 Bug: 194639753
2021-08-03Update Android app building with Bazel to use d8.Romain Jobredeaux
We're binding 'd8_jar_import' to r8.jar, because the d8.jar currently available in AOSP doesn't expose all the required classes. Test: b build build/bazel/examples/android_app/java/com/app --fat_apk_cpu=k8 Change-Id: I49815af33ee2743c7cf86b2088abced09ac3bf9b
2021-08-02Remove obsolete flag experimental_enable_aggregating_middleman from ↵Romain Jobredeaux
common.bazelrc. Test: bazel info Test: ./build/bazel/scripts/run_presubmits.sh Change-Id: I7502998d2df86f58e99573e8c20f6d5667c10adf Bug: 194103854
2021-05-25Rollforward "Split libraries by language..."Chris Parsons
This fixes a test and rolls forward I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4 Test: See I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4 Change-Id: I3c03ce21136b681ebb7c2a7b76df2f06037e3e61
2021-05-25Revert "Split libraries by language in cc_library_static"Colin Cross
Revert "Split asm and c flags and srcs in bp2build output" Revert submission 1714835-roboleaf-asm-c Reason for revert: TestCcLibraryStaticProductVariableSelects fails everywhere Reverted Changes: I28cf7437e:Split asm and c flags and srcs in bp2build output I2b47e6b55:Split libraries by language in cc_library_static Change-Id: Ie94e3aa7624280707258ef145948785ba3d1462c
2021-05-24Split libraries by language in cc_library_staticChris Parsons
Note that this does not appropriately implement asm/c srcs and flags for either the shared variant or the static variant. This will require a followup. Test: bp2build.sh and mixed_libc.sh CI scripts Test: Updated b2build tests Change-Id: I2b47e6b55aefc19f36c843497e6e01208b5b85af
2021-05-20Set the default --platforms value to android_arm.Jingwen Chen
This is because the default lunch target is aosp_arm. Test: TH Change-Id: Ibcc73ef677a12f2125d10813e7d81520613cec75