Merge changes I7876b077,Ib2e7d5e6,I7d2d2e02,Ibf5322f8 am: dcc42b6f7e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835088 Change-Id: Ifefcf876e203406967f44c035495dbba49c4362f
This commit is contained in:
@@ -102,6 +102,10 @@ type PrebuiltCommonProperties struct {
|
||||
// List of bootclasspath fragments inside this prebuilt APEX bundle and for which this APEX
|
||||
// bundle will create an APEX variant.
|
||||
Exported_bootclasspath_fragments []string
|
||||
|
||||
// List of systemserverclasspath fragments inside this prebuilt APEX bundle and for which this
|
||||
// APEX bundle will create an APEX variant.
|
||||
Exported_systemserverclasspath_fragments []string
|
||||
}
|
||||
|
||||
// initPrebuiltCommon initializes the prebuiltCommon structure and performs initialization of the
|
||||
@@ -169,7 +173,8 @@ func (p *prebuiltCommon) initApexFilesForAndroidMk(ctx android.ModuleContext) {
|
||||
tag := ctx.OtherModuleDependencyTag(child)
|
||||
|
||||
name := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(child))
|
||||
if java.IsBootclasspathFragmentContentDepTag(tag) || tag == exportedJavaLibTag {
|
||||
if java.IsBootclasspathFragmentContentDepTag(tag) ||
|
||||
java.IsSystemServerClasspathFragmentContentDepTag(tag) || tag == exportedJavaLibTag {
|
||||
// If the exported java module provides a dex jar path then add it to the list of apexFiles.
|
||||
path := child.(interface {
|
||||
DexJarBuildPath() java.OptionalDexJarPath
|
||||
@@ -189,8 +194,9 @@ func (p *prebuiltCommon) initApexFilesForAndroidMk(ctx android.ModuleContext) {
|
||||
}
|
||||
p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, af)
|
||||
}
|
||||
} else if tag == exportedBootclasspathFragmentTag {
|
||||
// Visit the children of the bootclasspath_fragment.
|
||||
} else if tag == exportedBootclasspathFragmentTag ||
|
||||
tag == exportedSystemserverclasspathFragmentTag {
|
||||
// Visit the children of the bootclasspath_fragment and systemserver_fragment.
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -306,21 +312,31 @@ func prebuiltApexModuleCreatorMutator(ctx android.TopDownMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *prebuiltCommon) getExportedDependencies() map[string]exportedDependencyTag {
|
||||
dependencies := make(map[string]exportedDependencyTag)
|
||||
|
||||
for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
|
||||
dependencies[dep] = exportedJavaLibTag
|
||||
}
|
||||
|
||||
for _, dep := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
||||
dependencies[dep] = exportedBootclasspathFragmentTag
|
||||
}
|
||||
|
||||
for _, dep := range p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments {
|
||||
dependencies[dep] = exportedSystemserverclasspathFragmentTag
|
||||
}
|
||||
|
||||
return dependencies
|
||||
}
|
||||
|
||||
// prebuiltApexContentsDeps adds dependencies onto the prebuilt apex module's contents.
|
||||
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
|
||||
module := ctx.Module()
|
||||
// Add dependencies onto the java modules that represent the java libraries that are provided by
|
||||
// and exported from this prebuilt apex.
|
||||
for _, exported := range p.prebuiltCommonProperties.Exported_java_libs {
|
||||
dep := android.PrebuiltNameFromSource(exported)
|
||||
ctx.AddDependency(module, exportedJavaLibTag, dep)
|
||||
}
|
||||
|
||||
// Add dependencies onto the bootclasspath fragment modules that are exported from this prebuilt
|
||||
// apex.
|
||||
for _, exported := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
||||
dep := android.PrebuiltNameFromSource(exported)
|
||||
ctx.AddDependency(module, exportedBootclasspathFragmentTag, dep)
|
||||
for dep, tag := range p.getExportedDependencies() {
|
||||
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
||||
ctx.AddDependency(module, tag, prebuiltDep)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,9 +587,9 @@ func createApexSelectorModule(ctx android.TopDownMutatorContext, name string, ap
|
||||
// A deapexer module is only needed when the prebuilt apex specifies one or more modules in either
|
||||
// the `exported_java_libs` or `exported_bootclasspath_fragments` properties as that indicates that
|
||||
// the listed modules need access to files from within the prebuilt .apex file.
|
||||
func createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string, properties *PrebuiltCommonProperties) {
|
||||
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string) {
|
||||
// Only create the deapexer module if it is needed.
|
||||
if len(properties.Exported_java_libs)+len(properties.Exported_bootclasspath_fragments) == 0 {
|
||||
if len(p.getExportedDependencies()) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -669,8 +685,9 @@ func (t exportedDependencyTag) RequiresFilesFromPrebuiltApex() {}
|
||||
var _ android.RequiresFilesFromPrebuiltApexTag = exportedDependencyTag{}
|
||||
|
||||
var (
|
||||
exportedJavaLibTag = exportedDependencyTag{name: "exported_java_libs"}
|
||||
exportedBootclasspathFragmentTag = exportedDependencyTag{name: "exported_bootclasspath_fragments"}
|
||||
exportedJavaLibTag = exportedDependencyTag{name: "exported_java_libs"}
|
||||
exportedBootclasspathFragmentTag = exportedDependencyTag{name: "exported_bootclasspath_fragments"}
|
||||
exportedSystemserverclasspathFragmentTag = exportedDependencyTag{name: "exported_systemserverclasspath_fragments"}
|
||||
)
|
||||
|
||||
var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
|
||||
@@ -711,7 +728,7 @@ func (p *Prebuilt) createPrebuiltApexModules(ctx android.TopDownMutatorContext)
|
||||
createApexSelectorModule(ctx, apexSelectorModuleName, &p.properties.ApexFileProperties)
|
||||
|
||||
apexFileSource := ":" + apexSelectorModuleName
|
||||
createDeapexerModuleIfNeeded(ctx, deapexerModuleName(baseModuleName), apexFileSource, p.prebuiltCommonProperties)
|
||||
p.createDeapexerModuleIfNeeded(ctx, deapexerModuleName(baseModuleName), apexFileSource)
|
||||
|
||||
// Add a source reference to retrieve the selected apex from the selector module.
|
||||
p.prebuiltCommonProperties.Selected_apex = proptools.StringPtr(apexFileSource)
|
||||
@@ -914,7 +931,7 @@ func (a *ApexSet) createPrebuiltApexModules(ctx android.TopDownMutatorContext) {
|
||||
createApexExtractorModule(ctx, apexExtractorModuleName, &a.properties.ApexExtractorProperties)
|
||||
|
||||
apexFileSource := ":" + apexExtractorModuleName
|
||||
createDeapexerModuleIfNeeded(ctx, deapexerModuleName(baseModuleName), apexFileSource, a.prebuiltCommonProperties)
|
||||
a.createDeapexerModuleIfNeeded(ctx, deapexerModuleName(baseModuleName), apexFileSource)
|
||||
|
||||
// After passing the arch specific src properties to the creating the apex selector module
|
||||
a.prebuiltCommonProperties.Selected_apex = proptools.StringPtr(apexFileSource)
|
||||
|
Reference in New Issue
Block a user