diff options
Diffstat (limited to 'apex/apex.go')
| -rw-r--r-- | apex/apex.go | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/apex/apex.go b/apex/apex.go index dc24df3d1..0e40d7c0e 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -67,7 +67,6 @@ func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) { // it should create a platform variant. ctx.BottomUp("mark_platform_availability", markPlatformAvailability) ctx.Transition("apex", &apexTransitionMutator{}) - ctx.BottomUp("apex_directly_in_any", apexDirectlyInAnyMutator).MutatesDependencies() } type apexBundleProperties struct { @@ -435,6 +434,7 @@ type apexBundle struct { archProperties apexArchBundleProperties overridableProperties overridableProperties vndkProperties apexVndkProperties // only for apex_vndk modules + testProperties apexTestProperties // only for apex_test modules /////////////////////////////////////////////////////////////////////////////////////////// // Inputs @@ -993,25 +993,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) { return true } - // Records whether a certain module is included in this apexBundle via direct dependency or - // inndirect dependency. - contents := make(map[string]android.ApexMembership) - mctx.WalkDeps(func(child, parent android.Module) bool { - if !continueApexDepsWalk(child, parent) { - return false - } - // If the parent is apexBundle, this child is directly depended. - _, directDep := parent.(*apexBundle) - depName := mctx.OtherModuleName(child) - contents[depName] = contents[depName].Add(directDep) - return true - }) - - // The membership information is saved for later access - apexContents := android.NewApexContents(contents) - android.SetProvider(mctx, android.ApexBundleInfoProvider, android.ApexBundleInfo{ - Contents: apexContents, - }) + android.SetProvider(mctx, android.ApexBundleInfoProvider, android.ApexBundleInfo{}) minSdkVersion := a.minSdkVersion(mctx) // When min_sdk_version is not set, the apex is built against FutureApiLevel. @@ -1039,8 +1021,6 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) { Updatable: a.Updatable(), UsePlatformApis: a.UsePlatformApis(), InApexVariants: []string{apexVariationName}, - InApexModules: []string{a.Name()}, // could be com.mycompany.android.foo - ApexContents: []*android.ApexContents{apexContents}, TestApexes: testApexes, BaseApexName: mctx.ModuleName(), ApexAvailableName: proptools.String(a.properties.Apex_available_name), @@ -1242,14 +1222,6 @@ func apexModuleTypeRequiresVariant(module ApexInfoMutator) bool { return true } -// See android.UpdateDirectlyInAnyApex -// TODO(jiyong): move this to android/apex.go? -func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) { - if am, ok := mctx.Module().(android.ApexModule); ok { - android.UpdateDirectlyInAnyApex(mctx, am) - } -} - const ( // File extensions of an APEX for different packaging methods imageApexSuffix = ".apex" @@ -1325,6 +1297,23 @@ func (a *apexBundle) UsePlatformApis() bool { return proptools.BoolDefault(a.properties.Platform_apis, false) } +type apexValidationType int + +const ( + hostApexVerifier apexValidationType = iota + apexSepolicyTests +) + +func (a *apexBundle) skipValidation(validationType apexValidationType) bool { + switch validationType { + case hostApexVerifier: + return proptools.Bool(a.testProperties.Skip_validations.Host_apex_verifier) + case apexSepolicyTests: + return proptools.Bool(a.testProperties.Skip_validations.Apex_sepolicy_tests) + } + panic("Unknown validation type") +} + // getCertString returns the name of the cert that should be used to sign this APEX. This is // basically from the "certificate" property, but could be overridden by the device config. func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string { @@ -1752,7 +1741,8 @@ func (a *apexBundle) setSystemLibLink(ctx android.ModuleContext) { } func (a *apexBundle) setPayloadFsType(ctx android.ModuleContext) { - switch proptools.StringDefault(a.properties.Payload_fs_type, ext4FsType) { + defaultFsType := ctx.Config().DefaultApexPayloadType() + switch proptools.StringDefault(a.properties.Payload_fs_type, defaultFsType) { case ext4FsType: a.payloadFsType = ext4 case f2fsFsType: @@ -2082,7 +2072,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, // // Skip the dependency in unbundled builds where the device image is not // being built. - if ch.IsStubsImplementationRequired() && !am.DirectlyInAnyApex() && !ctx.Config().UnbundledBuild() { + if ch.IsStubsImplementationRequired() && !am.NotInPlatform() && !ctx.Config().UnbundledBuild() { // we need a module name for Make name := ch.ImplementationModuleNameForMake(ctx) + ch.Properties.SubName if !android.InList(name, a.makeModulesToInstall) { @@ -2179,8 +2169,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, ctx.PropertyErrorf("systemserverclasspath_fragments", "systemserverclasspath_fragment content %q of type %q is not supported", depName, ctx.OtherModuleType(child)) } - } else if _, ok := depTag.(android.CopyDirectlyInAnyApexTag); ok { - // nothing } else if depTag == android.DarwinUniversalVariantTag { // nothing } else if depTag == android.RequiredDepTag { @@ -2457,10 +2445,14 @@ func newApexBundle() *apexBundle { return module } -func ApexBundleFactory(testApex bool) android.Module { - bundle := newApexBundle() - bundle.testApex = testApex - return bundle +type apexTestProperties struct { + // Boolean flags for validation checks. Test APEXes can turn on/off individual checks. + Skip_validations struct { + // Skips `Apex_sepolicy_tests` check if true + Apex_sepolicy_tests *bool + // Skips `Host_apex_verifier` check if true + Host_apex_verifier *bool + } } // apex_test is an APEX for testing. The difference from the ordinary apex module type is that @@ -2468,6 +2460,7 @@ func ApexBundleFactory(testApex bool) android.Module { func TestApexBundleFactory() android.Module { bundle := newApexBundle() bundle.testApex = true + bundle.AddProperties(&bundle.testProperties) return bundle } |