platform_build_soong/apex
Jiyong Park 6a9ddc37a9 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Merged-In: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
(cherry picked from commit 89e850ab84)
Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-28 09:27:24 +09:00
..
androidmk.go Add code coverage support to android_app JNI libs. 2020-03-27 13:06:12 +00:00
apex.go mark platform un-availability 2020-04-28 09:27:24 +09:00
apex_test.go mark platform un-availability 2020-04-28 09:27:24 +09:00
builder.go Allow walkPayloadDeps visitor to control walk flow 2020-04-22 12:51:48 +01:00
key.go Include partition tag in apexkeys.txt. 2020-04-02 17:15:47 +00:00
OWNERS Expand Jiyong's apex OWNERship 2019-01-31 18:57:00 +00:00
prebuilt.go Add compat symlinks for prebuilt_apex 2020-01-08 01:57:58 +09:00
TEST_MAPPING Add TEST_MAPPING for build/soong/apex 2019-08-07 17:33:24 +09:00
vndk.go apex: remove compat symlinks to vndk apex 2020-04-14 14:22:31 +09:00
vndk_test.go Build VNDK APEX for VNDK-Lite 2020-03-27 23:23:32 +09:00