Default BuildBrokenDepfile to empty (false)

Test: The builds should still pass because all depfile is cleanup in
AOSP
Bug: 179452413

Change-Id: Ifb6f5320f72c3beb44ddd6654100645e0a62e659
This commit is contained in:
Vinh Tran 2022-06-21 12:00:02 -04:00
parent f68794510f
commit 3fae6fe0db
3 changed files with 59 additions and 0 deletions

View file

@ -1,5 +1,62 @@
# Build System Changes for Android.mk Writers
## Gensrcs starts disallowing depfile property
To migrate all gensrcs to Bazel, we are restricting the use of depfile property
because Bazel requires specifying the dependencies directly.
To fix existing uses, remove depfile and directly specify all the dependencies
in .bp files. For example:
```
gensrcs {
name: "framework-cppstream-protos",
tools: [
"aprotoc",
"protoc-gen-cppstream",
],
cmd: "mkdir -p $(genDir)/$(in) " +
"&& $(location aprotoc) " +
" --plugin=$(location protoc-gen-cppstream) " +
" -I . " +
" $(in) ",
srcs: [
"bar.proto",
],
output_extension: "srcjar",
}
```
where `bar.proto` imports `external.proto` would become
```
gensrcs {
name: "framework-cppstream-protos",
tools: [
"aprotoc",
"protoc-gen-cpptream",
],
tool_files: [
"external.proto",
],
cmd: "mkdir -p $(genDir)/$(in) " +
"&& $(location aprotoc) " +
" --plugin=$(location protoc-gen-cppstream) " +
" $(in) ",
srcs: [
"bar.proto",
],
output_extension: "srcjar",
}
```
as in https://android-review.googlesource.com/c/platform/frameworks/base/+/2125692/.
`BUILD_BROKEN_DEPFILE` can be used to allowlist usage of depfile in `gensrcs`.
If `depfile` is needed for generating javastream proto, `java_library` with `proto.type`
set `stream` is the alternative solution. Sees
https://android-review.googlesource.com/c/platform/packages/modules/Permission/+/2118004/
for an example.
## Genrule starts disallowing directory inputs
To better specify the inputs to the build, we are restricting use of directories

View file

@ -174,6 +174,7 @@ _board_strip_list += ODM_MANIFEST_SKUS
_build_broken_var_list := \
BUILD_BROKEN_DEPFILE \
BUILD_BROKEN_DUP_RULES \
BUILD_BROKEN_DUP_SYSPROP \
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \

View file

@ -274,6 +274,7 @@ $(call add_json_str, PrebuiltHiddenApiDir, $(BOARD_PREBUILT_HIDDENAPI_DIR))
$(call add_json_str, ShippingApiLevel, $(PRODUCT_SHIPPING_API_LEVEL))
$(call add_json_bool, BuildBrokenDepfile, $(filter true,$(BUILD_BROKEN_DEPFILE)))
$(call add_json_bool, BuildBrokenEnforceSyspropOwner, $(filter true,$(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER)))
$(call add_json_bool, BuildBrokenTrebleSyspropNeverallow, $(filter true,$(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW)))
$(call add_json_bool, BuildBrokenVendorPropertyNamespace, $(filter true,$(BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE)))