diff options
| author | 2021-04-08 20:34:19 +0000 | |
|---|---|---|
| committer | 2021-04-08 20:34:19 +0000 | |
| commit | 49ab1d38dee35cf746010f1f9d94430230af51c0 (patch) | |
| tree | 41953e039fe4c1233e06006e3a36abb2c3fe4b3c /java/platform_bootclasspath.go | |
| parent | d32118c5c45a3da17311228c6abf6e91828e0cdd (diff) | |
| parent | 62d8c3b11002b3448db64ea13a5d9787bc098a49 (diff) | |
Merge "Allow platform_bootclasspath to specify contributing fragments"
Diffstat (limited to 'java/platform_bootclasspath.go')
| -rw-r--r-- | java/platform_bootclasspath.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 5272eaf77..95d19b96e 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -18,6 +18,7 @@ import ( "android/soong/android" "android/soong/dexpreopt" "github.com/google/blueprint" + "github.com/google/blueprint/proptools" ) func init() { @@ -49,19 +50,49 @@ func (t platformBootclasspathDependencyTag) ExcludeFromVisibilityEnforcement() { // The tag used for the dependency between the platform bootclasspath and any configured boot jars. var platformBootclasspathModuleDepTag = platformBootclasspathDependencyTag{name: "module"} +// The tag used for the dependency between the platform bootclasspath and bootclasspath_fragments. +var platformBootclasspathFragmentDepTag = platformBootclasspathDependencyTag{name: "fragment"} + var _ android.ExcludeFromVisibilityEnforcementTag = platformBootclasspathDependencyTag{} type platformBootclasspathModule struct { android.ModuleBase + properties platformBootclasspathProperties + // The apex:module pairs obtained from the configured modules. // // Currently only for testing. configuredModules []android.Module + + // The apex:module pairs obtained from the fragments. + // + // Currently only for testing. + fragments []android.Module +} + +// ApexVariantReference specifies a particular apex variant of a module. +type ApexVariantReference struct { + // The name of the module apex variant, i.e. the apex containing the module variant. + // + // If this is not specified then it defaults to "platform" which will cause a dependency to be + // added to the module's platform variant. + Apex *string + + // The name of the module. + Module *string +} + +type platformBootclasspathProperties struct { + + // The names of the bootclasspath_fragment modules that form part of this + // platform_bootclasspath. + Fragments []ApexVariantReference } func platformBootclasspathFactory() android.Module { m := &platformBootclasspathModule{} + m.AddProperties(&m.properties) android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) return m } @@ -91,6 +122,23 @@ func platformBootclasspathDepsMutator(ctx android.BottomUpMutatorContext) { // Add dependencies on all the updatable modules. updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars addDependenciesOntoBootImageModules(ctx, updatableModules) + + // Add dependencies on all the fragments. + addDependencyOntoApexVariants(ctx, "fragments", p.properties.Fragments, platformBootclasspathFragmentDepTag) + } +} + +func addDependencyOntoApexVariants(ctx android.BottomUpMutatorContext, propertyName string, refs []ApexVariantReference, tag blueprint.DependencyTag) { + for i, ref := range refs { + apex := proptools.StringDefault(ref.Apex, "platform") + + if ref.Module == nil { + ctx.PropertyErrorf(propertyName, "missing module name at position %d", i) + continue + } + name := proptools.String(ref.Module) + + addDependencyOntoApexModulePair(ctx, apex, name, tag) } } @@ -138,6 +186,8 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo tag := ctx.OtherModuleDependencyTag(module) if tag == platformBootclasspathModuleDepTag { b.configuredModules = append(b.configuredModules, module) + } else if tag == platformBootclasspathFragmentDepTag { + b.fragments = append(b.fragments, module) } }) |