Merge changes from topic "add-vndk-again"
* changes: add symlink for compatibility (vndk apex) Revert "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants"" Revert "Revert "Supports VNDK APEX with different versions""
This commit is contained in:
133
apex/apex.go
133
apex/apex.go
@@ -126,11 +126,15 @@ var (
|
|||||||
}, "image_content_file", "whitelisted_files_file", "apex_module_name")
|
}, "image_content_file", "whitelisted_files_file", "apex_module_name")
|
||||||
)
|
)
|
||||||
|
|
||||||
var imageApexSuffix = ".apex"
|
const (
|
||||||
var zipApexSuffix = ".zipapex"
|
imageApexSuffix = ".apex"
|
||||||
|
zipApexSuffix = ".zipapex"
|
||||||
|
|
||||||
var imageApexType = "image"
|
imageApexType = "image"
|
||||||
var zipApexType = "zip"
|
zipApexType = "zip"
|
||||||
|
|
||||||
|
vndkApexNamePrefix = "com.android.vndk.v"
|
||||||
|
)
|
||||||
|
|
||||||
type dependencyTag struct {
|
type dependencyTag struct {
|
||||||
blueprint.BaseDependencyTag
|
blueprint.BaseDependencyTag
|
||||||
@@ -182,10 +186,7 @@ func init() {
|
|||||||
android.RegisterModuleType("apex_defaults", defaultsFactory)
|
android.RegisterModuleType("apex_defaults", defaultsFactory)
|
||||||
android.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
|
android.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
|
||||||
|
|
||||||
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
android.PreDepsMutators(RegisterPreDepsMutators)
|
||||||
ctx.TopDown("apex_vndk_gather", apexVndkGatherMutator).Parallel()
|
|
||||||
ctx.BottomUp("apex_vndk_add_deps", apexVndkAddDepsMutator).Parallel()
|
|
||||||
})
|
|
||||||
android.PostDepsMutators(RegisterPostDepsMutators)
|
android.PostDepsMutators(RegisterPostDepsMutators)
|
||||||
|
|
||||||
android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) {
|
android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) {
|
||||||
@@ -195,6 +196,11 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||||
|
ctx.TopDown("apex_vndk", apexVndkMutator).Parallel()
|
||||||
|
ctx.BottomUp("apex_vndk_deps", apexVndkDepsMutator).Parallel()
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.TopDown("apex_deps", apexDepsMutator)
|
ctx.TopDown("apex_deps", apexDepsMutator)
|
||||||
ctx.BottomUp("apex", apexMutator).Parallel()
|
ctx.BottomUp("apex", apexMutator).Parallel()
|
||||||
@@ -207,44 +213,39 @@ var (
|
|||||||
vndkApexListMutex sync.Mutex
|
vndkApexListMutex sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
func vndkApexList(config android.Config) map[string]*apexBundle {
|
func vndkApexList(config android.Config) map[string]string {
|
||||||
return config.Once(vndkApexListKey, func() interface{} {
|
return config.Once(vndkApexListKey, func() interface{} {
|
||||||
return map[string]*apexBundle{}
|
return map[string]string{}
|
||||||
}).(map[string]*apexBundle)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
// apexVndkGatherMutator gathers "apex_vndk" modules and puts them in a map with vndk_version as a key.
|
func apexVndkMutator(mctx android.TopDownMutatorContext) {
|
||||||
func apexVndkGatherMutator(mctx android.TopDownMutatorContext) {
|
|
||||||
if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex {
|
if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex {
|
||||||
if ab.IsNativeBridgeSupported() {
|
if ab.IsNativeBridgeSupported() {
|
||||||
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
||||||
}
|
}
|
||||||
|
|
||||||
vndkVersion := proptools.String(ab.vndkProperties.Vndk_version)
|
vndkVersion := ab.vndkVersion(mctx.DeviceConfig())
|
||||||
|
// Ensure VNDK APEX mount point is formatted as com.android.vndk.v###
|
||||||
|
ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion)
|
||||||
|
|
||||||
|
// vndk_version should be unique
|
||||||
vndkApexListMutex.Lock()
|
vndkApexListMutex.Lock()
|
||||||
defer vndkApexListMutex.Unlock()
|
defer vndkApexListMutex.Unlock()
|
||||||
vndkApexList := vndkApexList(mctx.Config())
|
vndkApexList := vndkApexList(mctx.Config())
|
||||||
if other, ok := vndkApexList[vndkVersion]; ok {
|
if other, ok := vndkApexList[vndkVersion]; ok {
|
||||||
mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other.BaseModuleName())
|
mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other)
|
||||||
}
|
}
|
||||||
vndkApexList[vndkVersion] = ab
|
vndkApexList[vndkVersion] = mctx.ModuleName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apexVndkAddDepsMutator adds (reverse) dependencies from vndk libs to apex_vndk modules.
|
func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||||
// It filters only libs with matching targets.
|
if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) {
|
||||||
func apexVndkAddDepsMutator(mctx android.BottomUpMutatorContext) {
|
vndkVersion := m.VndkVersion()
|
||||||
if cc, ok := mctx.Module().(*cc.Module); ok && cc.IsVndkOnSystem() {
|
|
||||||
vndkApexList := vndkApexList(mctx.Config())
|
vndkApexList := vndkApexList(mctx.Config())
|
||||||
if ab, ok := vndkApexList[cc.VndkVersion()]; ok {
|
if vndkApex, ok := vndkApexList[vndkVersion]; ok {
|
||||||
targetArch := cc.Target().String()
|
mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex)
|
||||||
for _, target := range ab.MultiTargets() {
|
|
||||||
if target.String() == targetArch {
|
|
||||||
mctx.AddReverseDependency(mctx.Module(), sharedLibTag, ab.Name())
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,6 +616,12 @@ type apexBundle struct {
|
|||||||
|
|
||||||
// intermediate path for apex_manifest.json
|
// intermediate path for apex_manifest.json
|
||||||
manifestOut android.WritablePath
|
manifestOut android.WritablePath
|
||||||
|
|
||||||
|
// list of commands to create symlinks for backward compatibility
|
||||||
|
// these commands will be attached as LOCAL_POST_INSTALL_CMD to
|
||||||
|
// apex package itself(for unflattened build) or apex_manifest.json(for flattened build)
|
||||||
|
// so that compat symlinks are always installed regardless of TARGET_FLATTEN_APEX setting.
|
||||||
|
compatSymlinks []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
|
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
|
||||||
@@ -654,7 +661,6 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
|
||||||
targets := ctx.MultiTargets()
|
targets := ctx.MultiTargets()
|
||||||
config := ctx.DeviceConfig()
|
config := ctx.DeviceConfig()
|
||||||
|
|
||||||
@@ -824,6 +830,9 @@ func (a *apexBundle) installable() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
||||||
|
if a.vndkApex {
|
||||||
|
return "vendor." + a.vndkVersion(config)
|
||||||
|
}
|
||||||
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
||||||
return "vendor." + config.PlatformVndkVersion()
|
return "vendor." + config.PlatformVndkVersion()
|
||||||
} else {
|
} else {
|
||||||
@@ -1244,7 +1253,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// prepend the name of this APEX to the module names. These names will be the names of
|
// prepend the name of this APEX to the module names. These names will be the names of
|
||||||
// modules that will be defined if the APEX is flattened.
|
// modules that will be defined if the APEX is flattened.
|
||||||
for i := range filesInfo {
|
for i := range filesInfo {
|
||||||
filesInfo[i].moduleName = ctx.ModuleName() + "." + filesInfo[i].moduleName
|
filesInfo[i].moduleName = filesInfo[i].moduleName + "." + ctx.ModuleName()
|
||||||
}
|
}
|
||||||
|
|
||||||
a.installDir = android.PathForModuleInstall(ctx, "apex")
|
a.installDir = android.PathForModuleInstall(ctx, "apex")
|
||||||
@@ -1295,6 +1304,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.buildUnflattenedApex(ctx, imageApex)
|
a.buildUnflattenedApex(ctx, imageApex)
|
||||||
a.buildFlattenedApex(ctx)
|
a.buildFlattenedApex(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.compatSymlinks = makeCompatSymlinks(apexName, ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName string) android.OptionalPath {
|
func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName string) android.OptionalPath {
|
||||||
@@ -1570,7 +1581,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
|
|||||||
if a.installable() {
|
if a.installable() {
|
||||||
// For flattened APEX, do nothing but make sure that apex_manifest.json and apex_pubkey are also copied along
|
// For flattened APEX, do nothing but make sure that apex_manifest.json and apex_pubkey are also copied along
|
||||||
// with other ordinary files.
|
// with other ordinary files.
|
||||||
a.filesInfo = append(a.filesInfo, apexFile{a.manifestOut, ctx.ModuleName() + ".apex_manifest.json", ".", etc, nil, nil})
|
a.filesInfo = append(a.filesInfo, apexFile{a.manifestOut, "apex_manifest.json." + ctx.ModuleName(), ".", etc, nil, nil})
|
||||||
|
|
||||||
// rename to apex_pubkey
|
// rename to apex_pubkey
|
||||||
copiedPubkey := android.PathForModuleOut(ctx, "apex_pubkey")
|
copiedPubkey := android.PathForModuleOut(ctx, "apex_pubkey")
|
||||||
@@ -1579,7 +1590,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
|
|||||||
Input: a.public_key_file,
|
Input: a.public_key_file,
|
||||||
Output: copiedPubkey,
|
Output: copiedPubkey,
|
||||||
})
|
})
|
||||||
a.filesInfo = append(a.filesInfo, apexFile{copiedPubkey, ctx.ModuleName() + ".apex_pubkey", ".", etc, nil, nil})
|
a.filesInfo = append(a.filesInfo, apexFile{copiedPubkey, "apex_pubkey." + ctx.ModuleName(), ".", etc, nil, nil})
|
||||||
|
|
||||||
if ctx.Config().FlattenApex() {
|
if ctx.Config().FlattenApex() {
|
||||||
apexName := proptools.StringDefault(a.properties.Apex_name, ctx.ModuleName())
|
apexName := proptools.StringDefault(a.properties.Apex_name, ctx.ModuleName())
|
||||||
@@ -1712,6 +1723,10 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexName, moduleDir string,
|
|||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
||||||
|
// For flattened apexes, compat symlinks are attached to apex_manifest.json which is guaranteed for every apex
|
||||||
|
if !a.isFlattenedVariant() && fi.builtFile.Base() == "apex_manifest.json" && len(a.compatSymlinks) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(a.compatSymlinks, " && "))
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1762,10 +1777,16 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
|
|||||||
if len(a.externalDeps) > 0 {
|
if len(a.externalDeps) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.externalDeps, " "))
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.externalDeps, " "))
|
||||||
}
|
}
|
||||||
|
var postInstallCommands []string
|
||||||
if a.prebuiltFileToDelete != "" {
|
if a.prebuiltFileToDelete != "" {
|
||||||
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", "rm -rf "+
|
postInstallCommands = append(postInstallCommands, "rm -rf "+
|
||||||
filepath.Join(a.installDir.ToMakePath().String(), a.prebuiltFileToDelete))
|
filepath.Join(a.installDir.ToMakePath().String(), a.prebuiltFileToDelete))
|
||||||
}
|
}
|
||||||
|
// For unflattened apexes, compat symlinks are attached to apex package itself as LOCAL_POST_INSTALL_CMD
|
||||||
|
postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
|
||||||
|
if len(postInstallCommands) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
||||||
|
|
||||||
if apexType == imageApex {
|
if apexType == imageApex {
|
||||||
@@ -1819,19 +1840,18 @@ func vndkApexBundleFactory() android.Module {
|
|||||||
}{
|
}{
|
||||||
proptools.StringPtr("both"),
|
proptools.StringPtr("both"),
|
||||||
})
|
})
|
||||||
|
|
||||||
vndkVersion := proptools.StringDefault(bundle.vndkProperties.Vndk_version, "current")
|
|
||||||
if vndkVersion == "current" {
|
|
||||||
vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
|
|
||||||
bundle.vndkProperties.Vndk_version = proptools.StringPtr(vndkVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure VNDK APEX mount point is formatted as com.android.vndk.v###
|
|
||||||
bundle.properties.Apex_name = proptools.StringPtr("com.android.vndk.v" + vndkVersion)
|
|
||||||
})
|
})
|
||||||
return bundle
|
return bundle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *apexBundle) vndkVersion(config android.DeviceConfig) string {
|
||||||
|
vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
|
||||||
|
if vndkVersion == "current" {
|
||||||
|
vndkVersion = config.PlatformVndkVersion()
|
||||||
|
}
|
||||||
|
return vndkVersion
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Defaults
|
// Defaults
|
||||||
//
|
//
|
||||||
@@ -1997,6 +2017,8 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if p.installable() {
|
if p.installable() {
|
||||||
ctx.InstallFile(p.installDir, p.installFilename, p.inputApex)
|
ctx.InstallFile(p.installDir, p.installFilename, p.inputApex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/143192278): Add compat symlinks for prebuilt_apex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prebuilt) Prebuilt() *android.Prebuilt {
|
func (p *Prebuilt) Prebuilt() *android.Prebuilt {
|
||||||
@@ -2031,3 +2053,30 @@ func PrebuiltFactory() android.Module {
|
|||||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeCompatSymlinks(apexName string, ctx android.ModuleContext) (symlinks []string) {
|
||||||
|
// small helper to add symlink commands
|
||||||
|
addSymlink := func(target, dir, linkName string) {
|
||||||
|
outDir := filepath.Join("$(PRODUCT_OUT)", dir)
|
||||||
|
link := filepath.Join(outDir, linkName)
|
||||||
|
symlinks = append(symlinks, "mkdir -p "+outDir+" && rm -rf "+link+" && ln -sf "+target+" "+link)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(b/142911355): [VNDK APEX] Fix hard-coded references to /system/lib/vndk
|
||||||
|
// When all hard-coded references are fixed, remove symbolic links
|
||||||
|
// Note that we should keep following symlinks for older VNDKs (<=29)
|
||||||
|
// Since prebuilt vndk libs still depend on system/lib/vndk path
|
||||||
|
if strings.HasPrefix(apexName, vndkApexNamePrefix) {
|
||||||
|
// the name of vndk apex is formatted "com.android.vndk.v" + version
|
||||||
|
vndkVersion := strings.TrimPrefix(apexName, vndkApexNamePrefix)
|
||||||
|
if ctx.Config().Android64() {
|
||||||
|
addSymlink("/apex/"+apexName+"/lib64", "/system/lib64", "vndk-sp-"+vndkVersion)
|
||||||
|
addSymlink("/apex/"+apexName+"/lib64", "/system/lib64", "vndk-"+vndkVersion)
|
||||||
|
}
|
||||||
|
if !ctx.Config().Android64() || ctx.DeviceConfig().DeviceSecondaryArch() != "" {
|
||||||
|
addSymlink("/apex/"+apexName+"/lib", "/system/lib", "vndk-sp-"+vndkVersion)
|
||||||
|
addSymlink("/apex/"+apexName+"/lib", "/system/lib", "vndk-"+vndkVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -85,6 +86,10 @@ func withTargets(targets map[android.OsType][]android.Target) testCustomizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func withBinder32bit(fs map[string][]byte, config android.Config) {
|
||||||
|
config.TestProductVariables.Binder32bit = proptools.BoolPtr(true)
|
||||||
|
}
|
||||||
|
|
||||||
func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) {
|
func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) {
|
||||||
config := android.TestArchConfig(buildDir, nil)
|
config := android.TestArchConfig(buildDir, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
||||||
@@ -132,13 +137,10 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
||||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||||
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
||||||
ctx.TopDown("apex_vndk_gather", apexVndkGatherMutator)
|
|
||||||
ctx.BottomUp("apex_vndk_add_deps", apexVndkAddDepsMutator)
|
|
||||||
})
|
})
|
||||||
|
ctx.PreDepsMutators(RegisterPreDepsMutators)
|
||||||
|
ctx.PostDepsMutators(RegisterPostDepsMutators)
|
||||||
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.TopDown("apex_deps", apexDepsMutator)
|
|
||||||
ctx.BottomUp("apex", apexMutator)
|
|
||||||
ctx.BottomUp("apex_uses", apexUsesMutator)
|
|
||||||
ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel()
|
ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel()
|
||||||
ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel()
|
ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel()
|
||||||
})
|
})
|
||||||
@@ -1207,16 +1209,22 @@ func TestMacro(t *testing.T) {
|
|||||||
mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static").Rule("cc").Args["cFlags"]
|
mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static").Rule("cc").Args["cFlags"]
|
||||||
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
||||||
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
||||||
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__")
|
||||||
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__")
|
||||||
|
|
||||||
// APEX variant has __ANDROID_APEX__=<apexname> defined
|
// APEX variant has __ANDROID_APEX__=<apexname> defined
|
||||||
mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static_myapex").Rule("cc").Args["cFlags"]
|
mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static_myapex").Rule("cc").Args["cFlags"]
|
||||||
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
||||||
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
||||||
|
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__")
|
||||||
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__")
|
||||||
|
|
||||||
// APEX variant has __ANDROID_APEX__=<apexname> defined
|
// APEX variant has __ANDROID_APEX__=<apexname> defined
|
||||||
mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static_otherapex").Rule("cc").Args["cFlags"]
|
mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static_otherapex").Rule("cc").Args["cFlags"]
|
||||||
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__=myapex")
|
||||||
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__=otherapex")
|
||||||
|
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__")
|
||||||
|
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHeaderLibsDependency(t *testing.T) {
|
func TestHeaderLibsDependency(t *testing.T) {
|
||||||
@@ -1267,6 +1275,74 @@ func TestHeaderLibsDependency(t *testing.T) {
|
|||||||
ensureContains(t, cFlags, "-Imy_include")
|
ensureContains(t, cFlags, "-Imy_include")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName string, files []string) {
|
||||||
|
t.Helper()
|
||||||
|
apexRule := ctx.ModuleForTests(moduleName, "android_common_"+moduleName).Rule("apexRule")
|
||||||
|
copyCmds := apexRule.Args["copy_commands"]
|
||||||
|
imageApexDir := "/image.apex/"
|
||||||
|
dstFiles := []string{}
|
||||||
|
for _, cmd := range strings.Split(copyCmds, "&&") {
|
||||||
|
cmd = strings.TrimSpace(cmd)
|
||||||
|
if cmd == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
terms := strings.Split(cmd, " ")
|
||||||
|
switch terms[0] {
|
||||||
|
case "mkdir":
|
||||||
|
case "cp":
|
||||||
|
if len(terms) != 3 {
|
||||||
|
t.Fatal("copyCmds contains invalid cp command", cmd)
|
||||||
|
}
|
||||||
|
dst := terms[2]
|
||||||
|
index := strings.Index(dst, imageApexDir)
|
||||||
|
if index == -1 {
|
||||||
|
t.Fatal("copyCmds should copy a file to image.apex/", cmd)
|
||||||
|
}
|
||||||
|
dstFile := dst[index+len(imageApexDir):]
|
||||||
|
dstFiles = append(dstFiles, dstFile)
|
||||||
|
default:
|
||||||
|
t.Fatalf("copyCmds should contain mkdir/cp commands only: %q", cmd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Strings(dstFiles)
|
||||||
|
sort.Strings(files)
|
||||||
|
missing := []string{}
|
||||||
|
surplus := []string{}
|
||||||
|
i := 0
|
||||||
|
j := 0
|
||||||
|
for i < len(dstFiles) && j < len(files) {
|
||||||
|
if dstFiles[i] == files[j] {
|
||||||
|
i++
|
||||||
|
j++
|
||||||
|
} else if dstFiles[i] < files[j] {
|
||||||
|
surplus = append(surplus, dstFiles[i])
|
||||||
|
i++
|
||||||
|
} else {
|
||||||
|
missing = append(missing, files[j])
|
||||||
|
j++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if i < len(dstFiles) {
|
||||||
|
surplus = append(surplus, dstFiles[i:]...)
|
||||||
|
}
|
||||||
|
if j < len(files) {
|
||||||
|
missing = append(missing, files[j:]...)
|
||||||
|
}
|
||||||
|
|
||||||
|
failed := false
|
||||||
|
if len(surplus) > 0 {
|
||||||
|
t.Log("surplus files", surplus)
|
||||||
|
failed = true
|
||||||
|
}
|
||||||
|
if len(missing) > 0 {
|
||||||
|
t.Log("missing files", missing)
|
||||||
|
failed = true
|
||||||
|
}
|
||||||
|
if failed {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestVndkApexCurrent(t *testing.T) {
|
func TestVndkApexCurrent(t *testing.T) {
|
||||||
ctx, _ := testApex(t, `
|
ctx, _ := testApex(t, `
|
||||||
apex_vndk {
|
apex_vndk {
|
||||||
@@ -1305,12 +1381,12 @@ func TestVndkApexCurrent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
"lib/libvndk.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib/libvndk.so")
|
"lib/libvndksp.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib/libvndksp.so")
|
"lib64/libvndk.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/libvndk.so")
|
"lib64/libvndksp.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/libvndksp.so")
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkApexWithPrebuilt(t *testing.T) {
|
func TestVndkApexWithPrebuilt(t *testing.T) {
|
||||||
@@ -1328,8 +1404,8 @@ func TestVndkApexWithPrebuilt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc_prebuilt_library_shared {
|
cc_prebuilt_library_shared {
|
||||||
name: "libvndkshared",
|
name: "libvndk",
|
||||||
srcs: ["libvndkshared.so"],
|
srcs: ["libvndk.so"],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -1337,13 +1413,33 @@ func TestVndkApexWithPrebuilt(t *testing.T) {
|
|||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_prebuilt_library_shared {
|
||||||
|
name: "libvndk.arm",
|
||||||
|
srcs: ["libvndk.arm.so"],
|
||||||
|
vendor_available: true,
|
||||||
|
vndk: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
enabled: false,
|
||||||
|
arch: {
|
||||||
|
arm: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
`, withFiles(map[string][]byte{
|
`, withFiles(map[string][]byte{
|
||||||
"libvndkshared.so": nil,
|
"libvndk.so": nil,
|
||||||
|
"libvndk.arm.so": nil,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
"lib/libvndk.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib/libvndkshared.so")
|
"lib/libvndk.arm.so",
|
||||||
|
"lib64/libvndk.so",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkApexVersion(t *testing.T) {
|
func TestVndkApexVersion(t *testing.T) {
|
||||||
@@ -1361,15 +1457,22 @@ func TestVndkApexVersion(t *testing.T) {
|
|||||||
private_key: "testkey.pem",
|
private_key: "testkey.pem",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
vndk_prebuilt_shared {
|
||||||
name: "libvndk",
|
name: "libvndk27",
|
||||||
srcs: ["mylib.cpp"],
|
version: "27",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
system_shared_libs: [],
|
target_arch: "arm64",
|
||||||
stl: "none",
|
arch: {
|
||||||
|
arm: {
|
||||||
|
srcs: ["libvndk27_arm.so"],
|
||||||
|
},
|
||||||
|
arm64: {
|
||||||
|
srcs: ["libvndk27_arm64.so"],
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vndk_prebuilt_shared {
|
vndk_prebuilt_shared {
|
||||||
@@ -1379,18 +1482,27 @@ func TestVndkApexVersion(t *testing.T) {
|
|||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
target_arch: "arm64",
|
target_arch: "x86_64",
|
||||||
srcs: ["libvndk27.so"],
|
arch: {
|
||||||
}
|
x86: {
|
||||||
|
srcs: ["libvndk27_x86.so"],
|
||||||
|
},
|
||||||
|
x86_64: {
|
||||||
|
srcs: ["libvndk27_x86_64.so"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
`, withFiles(map[string][]byte{
|
`, withFiles(map[string][]byte{
|
||||||
"libvndk27.so": nil,
|
"libvndk27_arm.so": nil,
|
||||||
|
"libvndk27_arm64.so": nil,
|
||||||
|
"libvndk27_x86.so": nil,
|
||||||
|
"libvndk27_x86_64.so": nil,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
apexRule := ctx.ModuleForTests("myapex_v27", "android_common_myapex_v27").Rule("apexRule")
|
ensureExactContents(t, ctx, "myapex_v27", []string{
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
"lib/libvndk27_arm.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib/libvndk27.so")
|
"lib64/libvndk27_arm64.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/libvndk27.so")
|
})
|
||||||
ensureNotContains(t, copyCmds, "image.apex/lib/libvndk.so")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
|
func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
|
||||||
@@ -1505,14 +1617,10 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
"lib/libvndk.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib/libvndk.so")
|
"lib64/libvndk.so",
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/libvndk.so")
|
})
|
||||||
|
|
||||||
// apex
|
|
||||||
ensureNotContains(t, copyCmds, "image.apex/lib/x86/libvndk.so")
|
|
||||||
ensureNotContains(t, copyCmds, "image.apex/lib64/x86_64/libvndk.so")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
|
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
|
||||||
@@ -1545,6 +1653,70 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVndkApexWithBinder32(t *testing.T) {
|
||||||
|
ctx, _ := testApex(t,
|
||||||
|
`
|
||||||
|
apex_vndk {
|
||||||
|
name: "myapex_v27",
|
||||||
|
key: "myapex.key",
|
||||||
|
file_contexts: "myapex",
|
||||||
|
vndk_version: "27",
|
||||||
|
}
|
||||||
|
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
|
||||||
|
vndk_prebuilt_shared {
|
||||||
|
name: "libvndk27",
|
||||||
|
version: "27",
|
||||||
|
target_arch: "arm",
|
||||||
|
vendor_available: true,
|
||||||
|
vndk: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
arch: {
|
||||||
|
arm: {
|
||||||
|
srcs: ["libvndk27.so"],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vndk_prebuilt_shared {
|
||||||
|
name: "libvndk27",
|
||||||
|
version: "27",
|
||||||
|
target_arch: "arm",
|
||||||
|
binder32bit: true,
|
||||||
|
vendor_available: true,
|
||||||
|
vndk: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
arch: {
|
||||||
|
arm: {
|
||||||
|
srcs: ["libvndk27binder32.so"],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
withFiles(map[string][]byte{
|
||||||
|
"libvndk27.so": nil,
|
||||||
|
"libvndk27binder32.so": nil,
|
||||||
|
}),
|
||||||
|
withBinder32bit,
|
||||||
|
withTargets(map[android.OsType][]android.Target{
|
||||||
|
android.Android: []android.Target{
|
||||||
|
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
ensureExactContents(t, ctx, "myapex_v27", []string{
|
||||||
|
"lib/libvndk27binder32.so",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestDependenciesInApexManifest(t *testing.T) {
|
func TestDependenciesInApexManifest(t *testing.T) {
|
||||||
ctx, _ := testApex(t, `
|
ctx, _ := testApex(t, `
|
||||||
apex {
|
apex {
|
||||||
@@ -2055,12 +2227,12 @@ func TestApexWithTests(t *testing.T) {
|
|||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
data.Custom(&builder, name, prefix, "", data)
|
data.Custom(&builder, name, prefix, "", data)
|
||||||
androidMk := builder.String()
|
androidMk := builder.String()
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.mytest\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := mytest.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.mytest1\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := mytest1.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.mytest2\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := mytest2.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.mytest3\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := mytest3.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.apex_manifest.json\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.json.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex.apex_pubkey\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := apex_pubkey.myapex\n")
|
||||||
ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n")
|
ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,6 +93,11 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||||
if c.isVndk() && !c.static() {
|
if c.isVndk() && !c.static() {
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
|
fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
|
||||||
|
// VNDK libraries available to vendor are not installed because
|
||||||
|
// they are packaged in VNDK APEX and installed by APEX packages (apex/apex.go)
|
||||||
|
if !c.isVndkExt() {
|
||||||
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
9
cc/cc.go
9
cc/cc.go
@@ -488,15 +488,6 @@ func (c *Module) RelativeInstallPath() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsVndkOnSystem returns true if a module is supposed to be a vndk library provided by system to vendor
|
|
||||||
func (c *Module) IsVndkOnSystem() bool {
|
|
||||||
if linker, ok := c.linker.(libraryInterface); ok {
|
|
||||||
return linker.shared() && c.isVndk() && c.useVndk() && !c.isVndkExt()
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Module) VndkVersion() string {
|
func (c *Module) VndkVersion() string {
|
||||||
return c.vndkVersion()
|
return c.vndkVersion()
|
||||||
}
|
}
|
||||||
|
@@ -320,7 +320,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctx.apexName() != "" {
|
if ctx.apexName() != "" {
|
||||||
|
// TODO(b/142582178): remove the value for __ANDROID_APEX__
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX__="+ctx.apexName())
|
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX__="+ctx.apexName())
|
||||||
|
flags.GlobalFlags = append(flags.GlobalFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
|
||||||
}
|
}
|
||||||
|
|
||||||
instructionSet := String(compiler.Properties.Instruction_set)
|
instructionSet := String(compiler.Properties.Instruction_set)
|
||||||
@@ -528,6 +530,12 @@ func (compiler *baseCompiler) hasSrcExt(ext string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// makeDefineString transforms a name of an APEX module into a value to be used as value for C define
|
||||||
|
// For example, com.android.foo => COM_ANDROID_FOO
|
||||||
|
func makeDefineString(name string) string {
|
||||||
|
return strings.ReplaceAll(strings.ToUpper(name), ".", "_")
|
||||||
|
}
|
||||||
|
|
||||||
var gnuToCReplacer = strings.NewReplacer("gnu", "c")
|
var gnuToCReplacer = strings.NewReplacer("gnu", "c")
|
||||||
|
|
||||||
func ndkPathDeps(ctx ModuleContext) android.Paths {
|
func ndkPathDeps(ctx ModuleContext) android.Paths {
|
||||||
|
25
cc/vndk.go
25
cc/vndk.go
@@ -307,6 +307,31 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
||||||
|
if !m.Enabled() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// prebuilt vndk modules should match with device
|
||||||
|
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
|
||||||
|
// When b/142675459 is landed, remove following check
|
||||||
|
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.matchesWithDevice(mctx.DeviceConfig()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if lib, ok := m.linker.(libraryInterface); ok {
|
||||||
|
useCoreVariant := m.vndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
|
||||||
|
mctx.DeviceConfig().VndkUseCoreVariant() &&
|
||||||
|
!inList(m.BaseModuleName(), config.VndkMustUseVendorVariantList)
|
||||||
|
return lib.shared() && m.useVndk() && m.isVndk() && !m.isVndkExt() && !useCoreVariant
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// gather list of vndk-core, vndk-sp, and ll-ndk libs
|
// gather list of vndk-core, vndk-sp, and ll-ndk libs
|
||||||
func VndkMutator(mctx android.BottomUpMutatorContext) {
|
func VndkMutator(mctx android.BottomUpMutatorContext) {
|
||||||
m, ok := mctx.Module().(*Module)
|
m, ok := mctx.Module().(*Module)
|
||||||
|
@@ -130,13 +130,7 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro
|
|||||||
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
||||||
flags Flags, deps PathDeps, objs Objects) android.Path {
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
|
|
||||||
arches := ctx.DeviceConfig().Arches()
|
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
||||||
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
|
||||||
ctx.Module().SkipInstall()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
|
|
||||||
ctx.Module().SkipInstall()
|
ctx.Module().SkipInstall()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -153,6 +147,20 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
|
||||||
|
arches := config.Arches()
|
||||||
|
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if config.BinderBitness() != p.binderBit() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if len(p.properties.Srcs) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
|
func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user