:module syntax is supported for APEX even when TARGET_FLATTEN_APEX
Build rules for both flattened and non-flattend APEXes are created regardless of TARGET_FLATTEN_APEX. The selection is made in AndroidMk. This allows other module to reference an APEX via :module syntax irrespective of TARGET_FLATTEN_APEX. Bug: 123780484 Test: TARGET_FLATTEN_APEX=true m out/soong/.intermediates/art/build/apex/art-check-debug-apex-gen/gen/art-check-debug-apex-gen.dummy with aosp/891696 applied Change-Id: Ia49415ec3d18cfc5081461be76900c73ea803dca
This commit is contained in:
41
apex/apex.go
41
apex/apex.go
@@ -484,17 +484,15 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
{Mutator: "arch", Variation: "android_common"},
|
{Mutator: "arch", Variation: "android_common"},
|
||||||
}, javaLibTag, a.properties.Java_libs...)
|
}, javaLibTag, a.properties.Java_libs...)
|
||||||
|
|
||||||
if !ctx.Config().FlattenApex() || ctx.Config().UnbundledBuild() {
|
if String(a.properties.Key) == "" {
|
||||||
if String(a.properties.Key) == "" {
|
ctx.ModuleErrorf("key is missing")
|
||||||
ctx.ModuleErrorf("key is missing")
|
return
|
||||||
return
|
}
|
||||||
}
|
ctx.AddDependency(ctx.Module(), keyTag, String(a.properties.Key))
|
||||||
ctx.AddDependency(ctx.Module(), keyTag, String(a.properties.Key))
|
|
||||||
|
|
||||||
cert := android.SrcIsModule(String(a.properties.Certificate))
|
cert := android.SrcIsModule(String(a.properties.Certificate))
|
||||||
if cert != "" {
|
if cert != "" {
|
||||||
ctx.AddDependency(ctx.Module(), certificateTag, cert)
|
ctx.AddDependency(ctx.Module(), certificateTag, cert)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,7 +688,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
a.flattened = ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
|
a.flattened = ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
|
||||||
if !a.flattened && keyFile == nil {
|
if keyFile == nil {
|
||||||
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
|
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -727,11 +725,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, zipApex)
|
a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, zipApex)
|
||||||
}
|
}
|
||||||
if a.apexTypes.image() {
|
if a.apexTypes.image() {
|
||||||
if ctx.Config().FlattenApex() {
|
// Build rule for unflattened APEX is created even when ctx.Config().FlattenApex()
|
||||||
a.buildFlattenedApex(ctx)
|
// is true. This is to support referencing APEX via ":<module_name" syntax
|
||||||
} else {
|
// in other modules. It is in AndroidMk where the selection of flattened
|
||||||
a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, imageApex)
|
// or unflattened APEX is made.
|
||||||
}
|
a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, imageApex)
|
||||||
|
a.buildFlattenedApex(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,7 +909,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Install to $OUT/soong/{target,host}/.../apex
|
// Install to $OUT/soong/{target,host}/.../apex
|
||||||
if a.installable() {
|
if a.installable() && !ctx.Config().FlattenApex() {
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
|
ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -930,9 +929,11 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
|
|||||||
})
|
})
|
||||||
a.filesInfo = append(a.filesInfo, apexFile{copiedManifest, ctx.ModuleName() + ".apex_manifest.json", ".", etc, nil, nil})
|
a.filesInfo = append(a.filesInfo, apexFile{copiedManifest, ctx.ModuleName() + ".apex_manifest.json", ".", etc, nil, nil})
|
||||||
|
|
||||||
for _, fi := range a.filesInfo {
|
if ctx.Config().FlattenApex() {
|
||||||
dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
|
for _, fi := range a.filesInfo {
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
|
dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
|
||||||
|
ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,11 +63,6 @@ func (m *apexKey) installable() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() {
|
|
||||||
// Flattened APEXes are not signed
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
m.public_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Public_key))
|
m.public_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Public_key))
|
||||||
m.private_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Private_key))
|
m.private_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Private_key))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user