diff options
Diffstat (limited to 'apex/vndk.go')
-rw-r--r-- | apex/vndk.go | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/apex/vndk.go b/apex/vndk.go index 781aa3cbf..3ececc5c1 100644 --- a/apex/vndk.go +++ b/apex/vndk.go @@ -54,13 +54,26 @@ type apexVndkProperties struct { Vndk_version *string } -func apexVndkMutator(mctx android.TopDownMutatorContext) { - if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { - if ab.IsNativeBridgeSupported() { +func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { + if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) { + vndkVersion := m.VndkVersion() + + if vndkVersion == "" { + return + } + vndkVersion = "v" + vndkVersion + + vndkApexName := "com.android.vndk." + vndkVersion + + if mctx.OtherModuleExists(vndkApexName) { + mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName) + } + } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { + if a.IsNativeBridgeSupported() { mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType()) } - vndkVersion := ab.vndkVersion() + vndkVersion := a.vndkVersion() if vndkVersion != "" { apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion) if err != nil { @@ -72,32 +85,14 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) { // Disable VNDK APEXes for VNDK versions less than the minimum supported API // level for the primary architecture. - ab.Disable() + a.Disable() + } else { + mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion, mctx)...) } } } } -func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { - if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) { - vndkVersion := m.VndkVersion() - - if vndkVersion == "" { - return - } - vndkVersion = "v" + vndkVersion - - vndkApexName := "com.android.vndk." + vndkVersion - - if mctx.OtherModuleExists(vndkApexName) { - mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName) - } - } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { - vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current") - mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion, mctx)...) - } -} - // name is module.BaseModuleName() which is used as LOCAL_MODULE_NAME and also LOCAL_OVERRIDES_* func makeCompatSymlinks(name string, ctx android.ModuleContext) (symlinks android.InstallPaths) { // small helper to add symlink commands |