Merge "Introduce module type 'sdk'"
This commit is contained in:
36
apex/apex.go
36
apex/apex.go
@@ -185,7 +185,7 @@ func init() {
|
||||
pctx.HostBinToolVariable("zipalign", "zipalign")
|
||||
pctx.HostBinToolVariable("jsonmodify", "jsonmodify")
|
||||
|
||||
android.RegisterModuleType("apex", apexBundleFactory)
|
||||
android.RegisterModuleType("apex", BundleFactory)
|
||||
android.RegisterModuleType("apex_test", testApexBundleFactory)
|
||||
android.RegisterModuleType("apex_vndk", vndkApexBundleFactory)
|
||||
android.RegisterModuleType("apex_defaults", defaultsFactory)
|
||||
@@ -195,12 +195,14 @@ func init() {
|
||||
ctx.TopDown("apex_vndk_gather", apexVndkGatherMutator).Parallel()
|
||||
ctx.BottomUp("apex_vndk_add_deps", apexVndkAddDepsMutator).Parallel()
|
||||
})
|
||||
android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("apex_deps", apexDepsMutator)
|
||||
ctx.BottomUp("apex", apexMutator).Parallel()
|
||||
ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel()
|
||||
ctx.BottomUp("apex_uses", apexUsesMutator).Parallel()
|
||||
})
|
||||
android.PostDepsMutators(RegisterPostDepsMutators)
|
||||
}
|
||||
|
||||
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("apex_deps", apexDepsMutator)
|
||||
ctx.BottomUp("apex", apexMutator).Parallel()
|
||||
ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel()
|
||||
ctx.BottomUp("apex_uses", apexUsesMutator).Parallel()
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -410,6 +412,12 @@ type apexBundleProperties struct {
|
||||
// To distinguish between flattened and non-flattened variants.
|
||||
// if set true, then this variant is flattened variant.
|
||||
Flattened bool `blueprint:"mutated"`
|
||||
|
||||
// List of SDKs that are used to build this APEX. A reference to an SDK should be either
|
||||
// `name#version` or `name` which is an alias for `name#current`. If left empty, `platform#current`
|
||||
// is implied. This value affects all modules included in this APEX. In other words, they are
|
||||
// also built with the SDKs specified here.
|
||||
Uses_sdks []string
|
||||
}
|
||||
|
||||
type apexTargetBundleProperties struct {
|
||||
@@ -536,6 +544,7 @@ type apexFile struct {
|
||||
type apexBundle struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
android.SdkBase
|
||||
|
||||
properties apexBundleProperties
|
||||
targetProperties apexTargetBundleProperties
|
||||
@@ -738,6 +747,16 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
if cert != "" {
|
||||
ctx.AddDependency(ctx.Module(), certificateTag, cert)
|
||||
}
|
||||
|
||||
// TODO(jiyong): ensure that all apexes are with non-empty uses_sdks
|
||||
if len(a.properties.Uses_sdks) > 0 {
|
||||
sdkRefs := []android.SdkRef{}
|
||||
for _, str := range a.properties.Uses_sdks {
|
||||
parsed := android.ParseSdkRef(ctx, str, "uses_sdks")
|
||||
sdkRefs = append(sdkRefs, parsed)
|
||||
}
|
||||
a.BuildWithSdks(sdkRefs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string {
|
||||
@@ -1707,6 +1726,7 @@ func newApexBundle() *apexBundle {
|
||||
})
|
||||
android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
android.InitSdkAwareModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
@@ -1722,7 +1742,7 @@ func testApexBundleFactory() android.Module {
|
||||
return bundle
|
||||
}
|
||||
|
||||
func apexBundleFactory() android.Module {
|
||||
func BundleFactory() android.Module {
|
||||
return newApexBundle()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user