aboutsummaryrefslogtreecommitdiffstats
path: root/android/androidmk.go
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2020-04-07 16:37:39 +0900
committerJiyong Park <jiyong@google.com>2020-04-28 09:27:24 +0900
commit6a9ddc37a93c875788ff59931135b17f4bdc4414 (patch)
tree034212adc425051a828dfcb27ecccc3eedc871a4 /android/androidmk.go
parentc6026cd4ea8ffe335acc19011fd35d5135397409 (diff)
downloadbuild_soong-6a9ddc37a93c875788ff59931135b17f4bdc4414.tar.gz
build_soong-6a9ddc37a93c875788ff59931135b17f4bdc4414.tar.bz2
build_soong-6a9ddc37a93c875788ff59931135b17f4bdc4414.zip
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 89e850ab840e6efb10787b620b97ab009b4c2d86) Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
Diffstat (limited to 'android/androidmk.go')
-rw-r--r--android/androidmk.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index c296a5bf..6ba68af0 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -198,6 +198,10 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
a.AddStrings("LOCAL_HOST_REQUIRED_MODULES", a.Host_required...)
a.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", a.Target_required...)
+ if am, ok := mod.(ApexModule); ok {
+ a.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform())
+ }
+
archStr := amod.Arch().ArchType.String()
host := false
switch amod.Os().Class {