diff options
Diffstat (limited to 'apex')
-rw-r--r-- | apex/apex.go | 19 | ||||
-rw-r--r-- | apex/key.go | 25 |
2 files changed, 26 insertions, 18 deletions
diff --git a/apex/apex.go b/apex/apex.go index 408415eb..8f89ca6e 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -389,6 +389,9 @@ type apexBundle struct { // list of files to be included in this apex filesInfo []apexFile + // list of module names that this APEX is depending on + externalDeps []string + flattened bool testApex bool @@ -730,7 +733,18 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // indirect dependencies if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && am.IsInstallableToApex() { if cc, ok := child.(*cc.Module); ok { - if cc.IsStubs() || cc.HasStubsVariants() { + if !a.Host() && (cc.IsStubs() || cc.HasStubsVariants()) { + // If the dependency is a stubs lib, don't include it in this APEX, + // but make sure that the lib is installed on the device. + // In case no APEX is having the lib, the lib is installed to the system + // partition. + // + // Always include if we are a host-apex however since those won't have any + // system libraries. + if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.externalDeps) { + a.externalDeps = append(a.externalDeps, cc.Name()) + } + // Don't track further return false } depName := ctx.OtherModuleName(child) @@ -1126,6 +1140,9 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD if len(moduleNames) > 0 { fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " ")) } + if len(a.externalDeps) > 0 { + fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.externalDeps, " ")) + } fmt.Fprintln(w, "include $(BUILD_PREBUILT)") if apexType == imageApex { diff --git a/apex/key.go b/apex/key.go index 4c83861b..5d7c2fa3 100644 --- a/apex/key.go +++ b/apex/key.go @@ -29,7 +29,6 @@ var String = proptools.String func init() { android.RegisterModuleType("apex_key", apexKeyFactory) android.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) - android.RegisterMakeVarsProvider(pctx, apexKeysFileProvider) } type apexKey struct { @@ -108,11 +107,12 @@ func (m *apexKey) AndroidMk() android.AndroidMkData { //////////////////////////////////////////////////////////////////////// // apex_keys_text -type apexKeysText struct{} +type apexKeysText struct { + output android.OutputPath +} func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { - output := android.PathForOutput(ctx, "apexkeys.txt") - *apexKeysFile(ctx.Config()) = output.String() + s.output = android.PathForOutput(ctx, "apexkeys.txt") var filecontent strings.Builder ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(android.Module); ok && !m.Enabled() { @@ -131,27 +131,18 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { }) ctx.Build(pctx, android.BuildParams{ Rule: android.WriteFile, - Description: "apex_keys.txt", - Output: output, + Description: "apexkeys.txt", + Output: s.output, Args: map[string]string{ "content": filecontent.String(), }, }) } -var apexKeysFileKey = android.NewOnceKey("apexKeysFile") - -func apexKeysFile(config android.Config) *string { - return config.Once(apexKeysFileKey, func() interface{} { - str := "" - return &str - }).(*string) -} - func apexKeysTextFactory() android.Singleton { return &apexKeysText{} } -func apexKeysFileProvider(ctx android.MakeVarsContext) { - ctx.Strict("SOONG_APEX_KEYS_FILE", *apexKeysFile(ctx.Config())) +func (s *apexKeysText) MakeVars(ctx android.MakeVarsContext) { + ctx.Strict("SOONG_APEX_KEYS_FILE", s.output.String()) } |