summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
authorYi-Yo Chiang <yochiang@google.com>2021-06-18 19:44:24 +0800
committerJose "Pepe" Galmes <jgalmes@google.com>2021-08-31 20:48:47 +0000
commit0397804aa77bea27c0f9620de332b5467b6db18e (patch)
tree213111687fbe8d633fc23f55297b4bbc34892705 /cc
parent5e26fdeecf660384ae83c47025b30cd301b3a17b (diff)
cc/cc.go: Support per-image-variation "required"
Support "core" and "recovery" variants for now. Might add more image types if needed. Bug: 191369319 Test: Presubmit Test: Inspect out/soong/Android-*.mk Change-Id: Iebab29ed5d6d8fe9c66b6d6e56e00246d10c36b3 (cherry picked from commit c7e044f53100ac5d5eeecebb662a37d789b7c7e8)
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/cc/cc.go b/cc/cc.go
index e346bd941..73069c766 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -372,6 +372,24 @@ type BaseProperties struct {
// can depend on libraries that are not exported by the APEXes and use private symbols
// from the exported libraries.
Test_for []string `android:"arch_variant"`
+
+ Target struct {
+ Platform struct {
+ // List of modules required by the core variant.
+ Required []string `android:"arch_variant"`
+
+ // List of modules not required by the core variant.
+ Exclude_required []string `android:"arch_variant"`
+ } `android:"arch_variant"`
+
+ Recovery struct {
+ // List of modules required by the recovery variant.
+ Required []string `android:"arch_variant"`
+
+ // List of modules not required by the recovery variant.
+ Exclude_required []string `android:"arch_variant"`
+ } `android:"arch_variant"`
+ } `android:"arch_variant"`
}
type VendorProperties struct {
@@ -847,6 +865,18 @@ func (c *Module) HiddenFromMake() bool {
return c.Properties.HideFromMake
}
+func (c *Module) RequiredModuleNames() []string {
+ required := android.CopyOf(c.ModuleBase.RequiredModuleNames())
+ if c.ImageVariation().Variation == android.CoreVariation {
+ required = append(required, c.Properties.Target.Platform.Required...)
+ required = removeListFromList(required, c.Properties.Target.Platform.Exclude_required)
+ } else if c.InRecovery() {
+ required = append(required, c.Properties.Target.Recovery.Required...)
+ required = removeListFromList(required, c.Properties.Target.Recovery.Exclude_required)
+ }
+ return android.FirstUniqueStrings(required)
+}
+
func (c *Module) Toc() android.OptionalPath {
if c.linker != nil {
if library, ok := c.linker.(libraryInterface); ok {