platform_build_soong/bazel
Spandan Das af4ccaaf41 Add functionality to sandbox mixed build actions
The use case for this is for building rules_go's root builder which runs
into issues when built in a directory that contains a symlink to
prebuilts/go

The implementation will involve two changes of working dir
- `sbox` to change the working directory to
__SBOX_SANDBOX_DIR__
- the generated manifest will change the working
directory to mixed build execution root relative to that

Implemenation details
1. Create a unique intermediate path by hashing the outputs of a buildAction.
   "out/bazel/output/execroot/__main__/" was deliberately not chosen as
   the outpuDir for the sandbox because ruleBuilder would wipe it.
   `sbox` will generate the files in __SBOX_SANDBOX_DIR__ and then place
   the files in this intermediate directory.
2. After the files have been generated in (1), copy them to
   out/bazel/output/execroot/__main__/...
3. For bazel depsets that are inputs of an action, copy the direct
   artifacts into the sandbox instead of the phony target
4. Make sandboxing an opt-in. Currently we will only use it for
   `GoToolchainBinaryBuild`

In the current implementation, (3) will increase the size of the ninja
file. With sboxing turned on for only GoToolchainBinaryBuild, this will
increase the size of the ninja file by around 1.3% on aosp's cf

Test: m com.android.neuralnetworks (will build soong_zip from source
using rules_go)
Test: OUT_DIR=out.other m com.android.neuralnetworks
Bug: 289102849

Change-Id: I7addda9af583ba0ff306e50c1dfa16ed16c29799
2023-07-14 00:43:52 +00:00
..
cquery Create GetPrebuiltFileInfo to Mixed builds cquery api 2023-06-07 22:08:30 +00:00
Android.bp Add a persistent bazel server between builds 2023-03-01 23:30:19 -05:00
aquery.go Add functionality to sandbox mixed build actions 2023-07-14 00:43:52 +00:00
aquery_test.go Handle aquery build statements in a goroutine 2023-02-15 11:29:49 -05:00
bazel_proxy.go implement USE_BAZEL_VERSION for m 2023-06-01 17:42:18 +00:00
configurability.go bp2build support for host_ldlibs 2023-05-16 22:44:37 +00:00
constants.go refactor Bazel variable export 2022-04-06 14:48:32 +00:00
properties.go Merge changes from topic "stub-impl-per-api-domain" 2023-05-11 00:13:44 +00:00
properties_test.go Bp2build support for soong config variables + os 2023-05-08 17:50:06 -07:00
testing.go add unit test for bp2build allowlist 2022-04-14 13:31:09 +00:00