Loading android/module.go +5 −0 Original line number Diff line number Diff line Loading @@ -1495,6 +1495,11 @@ func (m *ModuleBase) EnableNativeBridgeSupportByDefault() { m.commonProperties.Native_bridge_supported = boolPtr(true) } // IsNativeBridgeSupported returns true if "native_bridge_supported" is explicitly set as "true" func (m *ModuleBase) IsNativeBridgeSupported() bool { return proptools.Bool(m.commonProperties.Native_bridge_supported) } func (m *moduleContext) InstallInData() bool { return m.module.InstallInData() } Loading apex/apex.go +103 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import ( "runtime" "sort" "strings" "sync" "android/soong/android" "android/soong/cc" Loading Loading @@ -153,6 +154,7 @@ var ( "com.android.media": []string{"libbinder"}, "com.android.media.swcodec": []string{"libbinder"}, "test_com.android.media.swcodec": []string{"libbinder"}, "com.android.vndk": []string{"libbinder"}, } ) Loading Loading @@ -185,9 +187,14 @@ func init() { android.RegisterModuleType("apex", apexBundleFactory) android.RegisterModuleType("apex_test", testApexBundleFactory) android.RegisterModuleType("apex_vndk", vndkApexBundleFactory) android.RegisterModuleType("apex_defaults", defaultsFactory) android.RegisterModuleType("prebuilt_apex", PrebuiltFactory) android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { 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() Loading @@ -196,6 +203,51 @@ func init() { }) } var ( vndkApexListKey = android.NewOnceKey("vndkApexList") vndkApexListMutex sync.Mutex ) func vndkApexList(config android.Config) map[string]*apexBundle { return config.Once(vndkApexListKey, func() interface{} { return map[string]*apexBundle{} }).(map[string]*apexBundle) } // apexVndkGatherMutator gathers "apex_vndk" modules and puts them in a map with vndk_version as a key. func apexVndkGatherMutator(mctx android.TopDownMutatorContext) { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab.IsNativeBridgeSupported() { mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType()) } vndkVersion := proptools.StringDefault(ab.vndkProperties.Vndk_version, mctx.DeviceConfig().PlatformVndkVersion()) vndkApexListMutex.Lock() defer vndkApexListMutex.Unlock() vndkApexList := vndkApexList(mctx.Config()) if other, ok := vndkApexList[vndkVersion]; ok { mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other.Name()) } vndkApexList[vndkVersion] = ab } } // apexVndkAddDepsMutator adds (reverse) dependencies from vndk libs to apex_vndk modules. // It filters only libs with matching targets. func apexVndkAddDepsMutator(mctx android.BottomUpMutatorContext) { if cc, ok := mctx.Module().(*cc.Module); ok && cc.IsVndkOnSystem() { vndkApexList := vndkApexList(mctx.Config()) if ab, ok := vndkApexList[cc.VndkVersion()]; ok { targetArch := cc.Target().String() for _, target := range ab.MultiTargets() { if target.String() == targetArch { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, ab.Name()) break } } } } } // Mark the direct and transitive dependencies of apex bundles so that they // can be built for the apex bundles. func apexDepsMutator(mctx android.TopDownMutatorContext) { Loading Loading @@ -253,11 +305,14 @@ func apexUsesMutator(mctx android.BottomUpMutatorContext) { type apexNativeDependencies struct { // List of native libraries Native_shared_libs []string // List of native executables Binaries []string // List of native tests Tests []string } type apexMultilibProperties struct { // Native dependencies whose compile_multilib is "first" First apexNativeDependencies Loading Loading @@ -362,14 +417,17 @@ type apexTargetBundleProperties struct { Android struct { Multilib apexMultilibProperties } // Multilib properties only for host. Host struct { Multilib apexMultilibProperties } // Multilib properties only for host linux_bionic. Linux_bionic struct { Multilib apexMultilibProperties } // Multilib properties only for host linux_glibc. Linux_glibc struct { Multilib apexMultilibProperties Loading @@ -377,6 +435,11 @@ type apexTargetBundleProperties struct { } } type apexVndkProperties struct { // Indicates VNDK version of which this VNDK APEX bundles VNDK libs. Default is Platform VNDK Version. Vndk_version *string } type apexFileClass int const ( Loading Loading @@ -475,6 +538,7 @@ type apexBundle struct { properties apexBundleProperties targetProperties apexTargetBundleProperties vndkProperties apexVndkProperties apexTypes apexPackaging Loading @@ -498,6 +562,7 @@ type apexBundle struct { externalDeps []string testApex bool vndkApex bool // intermediate path for apex_manifest.json manifestOut android.WritablePath Loading Loading @@ -1086,11 +1151,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // remove duplicates in filesInfo removeDup := func(filesInfo []apexFile) []apexFile { encountered := make(map[android.Path]bool) encountered := make(map[string]bool) result := []apexFile{} for _, f := range filesInfo { if !encountered[f.builtFile] { encountered[f.builtFile] = true dest := filepath.Join(f.installDir, f.builtFile.Base()) if !encountered[dest] { encountered[dest] = true result = append(result, f) } } Loading Loading @@ -1629,18 +1695,9 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD }} } func testApexBundleFactory() android.Module { return ApexBundleFactory(true /*testApex*/) } func apexBundleFactory() android.Module { return ApexBundleFactory(false /*testApex*/) } func ApexBundleFactory(testApex bool) android.Module { func newApexBundle() *apexBundle { module := &apexBundle{ outputFiles: map[apexPackaging]android.WritablePath{}, testApex: testApex, } module.AddProperties(&module.properties) module.AddProperties(&module.targetProperties) Loading @@ -1652,6 +1709,39 @@ func ApexBundleFactory(testApex bool) android.Module { return module } func ApexBundleFactory(testApex bool) android.Module { bundle := newApexBundle() bundle.testApex = testApex return bundle } func testApexBundleFactory() android.Module { bundle := newApexBundle() bundle.testApex = true return bundle } func apexBundleFactory() android.Module { return newApexBundle() } // apex_vndk creates a special variant of apex modules which contains only VNDK libraries. // If `vndk_version` is specified, the VNDK libraries of the specified VNDK version are gathered automatically. // If not specified, then the "current" versions are gathered. func vndkApexBundleFactory() android.Module { bundle := newApexBundle() bundle.vndkApex = true bundle.AddProperties(&bundle.vndkProperties) android.AddLoadHook(bundle, func(ctx android.LoadHookContext) { ctx.AppendProperties(&struct { Compile_multilib *string }{ proptools.StringPtr("both"), }) }) return bundle } // // Defaults // Loading apex/apex_test.go +320 −16 Original line number Diff line number Diff line Loading @@ -40,8 +40,9 @@ func names(s string) (ns []string) { return } func testApexError(t *testing.T, pattern, bp string) { ctx, config := testApexContext(t, bp) func testApexError(t *testing.T, pattern, bp string, handlers ...testCustomizer) { t.Helper() ctx, config := testApexContext(t, bp, handlers...) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) if len(errs) > 0 { android.FailIfNoMatchingErrors(t, pattern, errs) Loading @@ -56,8 +57,9 @@ func testApexError(t *testing.T, pattern, bp string) { t.Fatalf("missing expected error %q (0 errors are returned)", pattern) } func testApex(t *testing.T, bp string) (*android.TestContext, android.Config) { ctx, config := testApexContext(t, bp) func testApex(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) { t.Helper() ctx, config := testApexContext(t, bp, handlers...) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) android.FailIfErrored(t, errs) _, errs = ctx.PrepareBuildActions(config) Loading @@ -65,37 +67,52 @@ func testApex(t *testing.T, bp string) (*android.TestContext, android.Config) { return ctx, config } func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Config) { type testCustomizer func(fs map[string][]byte, config android.Config) func withFiles(files map[string][]byte) testCustomizer { return func(fs map[string][]byte, config android.Config) { for k, v := range files { fs[k] = v } } } func withTargets(targets map[android.OsType][]android.Target) testCustomizer { return func(fs map[string][]byte, config android.Config) { for k, v := range targets { config.Targets[k] = v } } } func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) { config := android.TestArchConfig(buildDir, nil) config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current") config.TestProductVariables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test") config.TestProductVariables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"} config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("Q") config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(false) config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current") config.TestProductVariables.Platform_vndk_version = proptools.StringPtr("VER") ctx := android.NewTestArchContext() ctx.RegisterModuleType("apex", android.ModuleFactoryAdaptor(apexBundleFactory)) ctx.RegisterModuleType("apex_test", android.ModuleFactoryAdaptor(testApexBundleFactory)) ctx.RegisterModuleType("apex_vndk", android.ModuleFactoryAdaptor(vndkApexBundleFactory)) ctx.RegisterModuleType("apex_key", android.ModuleFactoryAdaptor(apexKeyFactory)) ctx.RegisterModuleType("apex_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) ctx.RegisterModuleType("prebuilt_apex", android.ModuleFactoryAdaptor(PrebuiltFactory)) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) 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.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() }) ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(cc.LibrarySharedFactory)) ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory)) ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(cc.PrebuiltSharedLibraryFactory)) ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory)) ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(cc.BinaryFactory)) ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory)) ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory)) ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) Loading @@ -105,6 +122,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() }) Loading @@ -115,6 +133,15 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel() ctx.BottomUp("version", cc.VersionMutator).Parallel() ctx.BottomUp("begin", cc.BeginMutator).Parallel() ctx.TopDown("apex_vndk_gather", apexVndkGatherMutator) ctx.BottomUp("apex_vndk_add_deps", apexVndkAddDepsMutator) }) 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.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() }) ctx.Register() Loading @@ -132,6 +159,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -146,6 +174,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -153,6 +182,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -160,6 +190,23 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { name: "libclang_rt.builtins-x86_64-android", src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { name: "libclang_rt.builtins-i686-android", src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -167,6 +214,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con stl: "none", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -174,6 +222,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con stl: "none", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -189,20 +238,23 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con llndk_library { name: "libc", symbol_file: "", native_bridge_supported: true, } llndk_library { name: "libm", symbol_file: "", native_bridge_supported: true, } llndk_library { name: "libdl", symbol_file: "", native_bridge_supported: true, } ` ctx.MockFileSystem(map[string][]byte{ fs := map[string][]byte{ "Android.bp": []byte(bp), "build/make/target/product/security": nil, "apex_manifest.json": nil, Loading Loading @@ -238,7 +290,13 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con "frameworks/base/api/current.txt": nil, "build/make/core/proguard.flags": nil, "build/make/core/proguard_basic_keeps.flags": nil, }) } for _, handler := range handlers { handler(fs, config) } ctx.MockFileSystem(fs) return ctx, config } Loading Loading @@ -1210,6 +1268,252 @@ func TestHeaderLibsDependency(t *testing.T) { ensureContains(t, cFlags, "-Imy_include") } func TestVndkApexCurrent(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } cc_library { name: "libvndksp", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, support_system_process: true, }, system_shared_libs: [], stl: "none", } `) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndk.so") ensureContains(t, copyCmds, "image.apex/lib/libvndksp.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndk.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndksp.so") } func TestVndkApexWithPrebuilt(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_prebuilt_library_shared { name: "libvndkshared", srcs: ["libvndkshared.so"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `, withFiles(map[string][]byte{ "libvndkshared.so": nil, })) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndkshared.so") } func TestVndkApexVersion(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", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } vndk_prebuilt_shared { name: "libvndk27", version: "27", vendor_available: true, vndk: { enabled: true, }, srcs: ["libvndk27.so"], } `, withFiles(map[string][]byte{ "libvndk27.so": nil, })) apexRule := ctx.ModuleForTests("myapex_v27", "android_common_myapex_v27").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndk27.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndk27.so") ensureNotContains(t, copyCmds, "image.apex/lib/libvndk.so") } func TestVndkApexErrorWithDuplicateVersion(t *testing.T) { testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, ` apex_vndk { name: "myapex_v27", key: "myapex.key", file_contexts: "myapex", vndk_version: "27", } apex_vndk { name: "myapex_v27_other", key: "myapex.key", file_contexts: "myapex", vndk_version: "27", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } vndk_prebuilt_shared { name: "libvndk", version: "27", vendor_available: true, vndk: { enabled: true, }, srcs: ["libvndk.so"], } `, withFiles(map[string][]byte{ "libvndk.so": nil, })) } func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, native_bridge_supported: true, host_supported: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `, withTargets(map[android.OsType][]android.Target{ android.Android: []android.Target{ {Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""}, {Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""}, {Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"}, {Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"}, }, })) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/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) { testApexError(t, `module "myapex" .*: native_bridge_supported: .* doesn't support native bridge binary`, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", native_bridge_supported: true, } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, native_bridge_supported: true, host_supported: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `) } func TestDependenciesInApexManifest(t *testing.T) { ctx, _ := testApex(t, ` apex { Loading cc/cc.go +13 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,19 @@ func (c *Module) RelativeInstallPath() string { 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 { return c.vndkVersion() } func (c *Module) Init() android.Module { c.AddProperties(&c.Properties, &c.VendorProperties) if c.compiler != nil { Loading cc/prebuilt.go +4 −4 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ import ( ) func init() { android.RegisterModuleType("cc_prebuilt_library_shared", prebuiltSharedLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_static", prebuiltStaticLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory) android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory) } Loading Loading @@ -131,7 +131,7 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() { // cc_prebuilt_library_shared installs a precompiled shared library that are // listed in the srcs property in the device's directory. func prebuiltSharedLibraryFactory() android.Module { func PrebuiltSharedLibraryFactory() android.Module { module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported) return module.Init() } Loading @@ -158,7 +158,7 @@ func NewPrebuiltSharedLibrary(hod android.HostOrDeviceSupported) (*Module, *libr // cc_prebuilt_library_static installs a precompiled static library that are // listed in the srcs property in the device's directory. func prebuiltStaticLibraryFactory() android.Module { func PrebuiltStaticLibraryFactory() android.Module { module, _ := NewPrebuiltStaticLibrary(android.HostAndDeviceSupported) return module.Init() } Loading Loading
android/module.go +5 −0 Original line number Diff line number Diff line Loading @@ -1495,6 +1495,11 @@ func (m *ModuleBase) EnableNativeBridgeSupportByDefault() { m.commonProperties.Native_bridge_supported = boolPtr(true) } // IsNativeBridgeSupported returns true if "native_bridge_supported" is explicitly set as "true" func (m *ModuleBase) IsNativeBridgeSupported() bool { return proptools.Bool(m.commonProperties.Native_bridge_supported) } func (m *moduleContext) InstallInData() bool { return m.module.InstallInData() } Loading
apex/apex.go +103 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import ( "runtime" "sort" "strings" "sync" "android/soong/android" "android/soong/cc" Loading Loading @@ -153,6 +154,7 @@ var ( "com.android.media": []string{"libbinder"}, "com.android.media.swcodec": []string{"libbinder"}, "test_com.android.media.swcodec": []string{"libbinder"}, "com.android.vndk": []string{"libbinder"}, } ) Loading Loading @@ -185,9 +187,14 @@ func init() { android.RegisterModuleType("apex", apexBundleFactory) android.RegisterModuleType("apex_test", testApexBundleFactory) android.RegisterModuleType("apex_vndk", vndkApexBundleFactory) android.RegisterModuleType("apex_defaults", defaultsFactory) android.RegisterModuleType("prebuilt_apex", PrebuiltFactory) android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { 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() Loading @@ -196,6 +203,51 @@ func init() { }) } var ( vndkApexListKey = android.NewOnceKey("vndkApexList") vndkApexListMutex sync.Mutex ) func vndkApexList(config android.Config) map[string]*apexBundle { return config.Once(vndkApexListKey, func() interface{} { return map[string]*apexBundle{} }).(map[string]*apexBundle) } // apexVndkGatherMutator gathers "apex_vndk" modules and puts them in a map with vndk_version as a key. func apexVndkGatherMutator(mctx android.TopDownMutatorContext) { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab.IsNativeBridgeSupported() { mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType()) } vndkVersion := proptools.StringDefault(ab.vndkProperties.Vndk_version, mctx.DeviceConfig().PlatformVndkVersion()) vndkApexListMutex.Lock() defer vndkApexListMutex.Unlock() vndkApexList := vndkApexList(mctx.Config()) if other, ok := vndkApexList[vndkVersion]; ok { mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other.Name()) } vndkApexList[vndkVersion] = ab } } // apexVndkAddDepsMutator adds (reverse) dependencies from vndk libs to apex_vndk modules. // It filters only libs with matching targets. func apexVndkAddDepsMutator(mctx android.BottomUpMutatorContext) { if cc, ok := mctx.Module().(*cc.Module); ok && cc.IsVndkOnSystem() { vndkApexList := vndkApexList(mctx.Config()) if ab, ok := vndkApexList[cc.VndkVersion()]; ok { targetArch := cc.Target().String() for _, target := range ab.MultiTargets() { if target.String() == targetArch { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, ab.Name()) break } } } } } // Mark the direct and transitive dependencies of apex bundles so that they // can be built for the apex bundles. func apexDepsMutator(mctx android.TopDownMutatorContext) { Loading Loading @@ -253,11 +305,14 @@ func apexUsesMutator(mctx android.BottomUpMutatorContext) { type apexNativeDependencies struct { // List of native libraries Native_shared_libs []string // List of native executables Binaries []string // List of native tests Tests []string } type apexMultilibProperties struct { // Native dependencies whose compile_multilib is "first" First apexNativeDependencies Loading Loading @@ -362,14 +417,17 @@ type apexTargetBundleProperties struct { Android struct { Multilib apexMultilibProperties } // Multilib properties only for host. Host struct { Multilib apexMultilibProperties } // Multilib properties only for host linux_bionic. Linux_bionic struct { Multilib apexMultilibProperties } // Multilib properties only for host linux_glibc. Linux_glibc struct { Multilib apexMultilibProperties Loading @@ -377,6 +435,11 @@ type apexTargetBundleProperties struct { } } type apexVndkProperties struct { // Indicates VNDK version of which this VNDK APEX bundles VNDK libs. Default is Platform VNDK Version. Vndk_version *string } type apexFileClass int const ( Loading Loading @@ -475,6 +538,7 @@ type apexBundle struct { properties apexBundleProperties targetProperties apexTargetBundleProperties vndkProperties apexVndkProperties apexTypes apexPackaging Loading @@ -498,6 +562,7 @@ type apexBundle struct { externalDeps []string testApex bool vndkApex bool // intermediate path for apex_manifest.json manifestOut android.WritablePath Loading Loading @@ -1086,11 +1151,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // remove duplicates in filesInfo removeDup := func(filesInfo []apexFile) []apexFile { encountered := make(map[android.Path]bool) encountered := make(map[string]bool) result := []apexFile{} for _, f := range filesInfo { if !encountered[f.builtFile] { encountered[f.builtFile] = true dest := filepath.Join(f.installDir, f.builtFile.Base()) if !encountered[dest] { encountered[dest] = true result = append(result, f) } } Loading Loading @@ -1629,18 +1695,9 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD }} } func testApexBundleFactory() android.Module { return ApexBundleFactory(true /*testApex*/) } func apexBundleFactory() android.Module { return ApexBundleFactory(false /*testApex*/) } func ApexBundleFactory(testApex bool) android.Module { func newApexBundle() *apexBundle { module := &apexBundle{ outputFiles: map[apexPackaging]android.WritablePath{}, testApex: testApex, } module.AddProperties(&module.properties) module.AddProperties(&module.targetProperties) Loading @@ -1652,6 +1709,39 @@ func ApexBundleFactory(testApex bool) android.Module { return module } func ApexBundleFactory(testApex bool) android.Module { bundle := newApexBundle() bundle.testApex = testApex return bundle } func testApexBundleFactory() android.Module { bundle := newApexBundle() bundle.testApex = true return bundle } func apexBundleFactory() android.Module { return newApexBundle() } // apex_vndk creates a special variant of apex modules which contains only VNDK libraries. // If `vndk_version` is specified, the VNDK libraries of the specified VNDK version are gathered automatically. // If not specified, then the "current" versions are gathered. func vndkApexBundleFactory() android.Module { bundle := newApexBundle() bundle.vndkApex = true bundle.AddProperties(&bundle.vndkProperties) android.AddLoadHook(bundle, func(ctx android.LoadHookContext) { ctx.AppendProperties(&struct { Compile_multilib *string }{ proptools.StringPtr("both"), }) }) return bundle } // // Defaults // Loading
apex/apex_test.go +320 −16 Original line number Diff line number Diff line Loading @@ -40,8 +40,9 @@ func names(s string) (ns []string) { return } func testApexError(t *testing.T, pattern, bp string) { ctx, config := testApexContext(t, bp) func testApexError(t *testing.T, pattern, bp string, handlers ...testCustomizer) { t.Helper() ctx, config := testApexContext(t, bp, handlers...) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) if len(errs) > 0 { android.FailIfNoMatchingErrors(t, pattern, errs) Loading @@ -56,8 +57,9 @@ func testApexError(t *testing.T, pattern, bp string) { t.Fatalf("missing expected error %q (0 errors are returned)", pattern) } func testApex(t *testing.T, bp string) (*android.TestContext, android.Config) { ctx, config := testApexContext(t, bp) func testApex(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) { t.Helper() ctx, config := testApexContext(t, bp, handlers...) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) android.FailIfErrored(t, errs) _, errs = ctx.PrepareBuildActions(config) Loading @@ -65,37 +67,52 @@ func testApex(t *testing.T, bp string) (*android.TestContext, android.Config) { return ctx, config } func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Config) { type testCustomizer func(fs map[string][]byte, config android.Config) func withFiles(files map[string][]byte) testCustomizer { return func(fs map[string][]byte, config android.Config) { for k, v := range files { fs[k] = v } } } func withTargets(targets map[android.OsType][]android.Target) testCustomizer { return func(fs map[string][]byte, config android.Config) { for k, v := range targets { config.Targets[k] = v } } } func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) { config := android.TestArchConfig(buildDir, nil) config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current") config.TestProductVariables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test") config.TestProductVariables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"} config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("Q") config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(false) config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current") config.TestProductVariables.Platform_vndk_version = proptools.StringPtr("VER") ctx := android.NewTestArchContext() ctx.RegisterModuleType("apex", android.ModuleFactoryAdaptor(apexBundleFactory)) ctx.RegisterModuleType("apex_test", android.ModuleFactoryAdaptor(testApexBundleFactory)) ctx.RegisterModuleType("apex_vndk", android.ModuleFactoryAdaptor(vndkApexBundleFactory)) ctx.RegisterModuleType("apex_key", android.ModuleFactoryAdaptor(apexKeyFactory)) ctx.RegisterModuleType("apex_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) ctx.RegisterModuleType("prebuilt_apex", android.ModuleFactoryAdaptor(PrebuiltFactory)) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) 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.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() }) ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(cc.LibrarySharedFactory)) ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory)) ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(cc.PrebuiltSharedLibraryFactory)) ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory)) ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(cc.BinaryFactory)) ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory)) ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory)) ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) Loading @@ -105,6 +122,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() }) Loading @@ -115,6 +133,15 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel() ctx.BottomUp("version", cc.VersionMutator).Parallel() ctx.BottomUp("begin", cc.BeginMutator).Parallel() ctx.TopDown("apex_vndk_gather", apexVndkGatherMutator) ctx.BottomUp("apex_vndk_add_deps", apexVndkAddDepsMutator) }) 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.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() }) ctx.Register() Loading @@ -132,6 +159,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -146,6 +174,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -153,6 +182,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { Loading @@ -160,6 +190,23 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { name: "libclang_rt.builtins-x86_64-android", src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } toolchain_library { name: "libclang_rt.builtins-i686-android", src: "", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -167,6 +214,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con stl: "none", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -174,6 +222,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con stl: "none", vendor_available: true, recovery_available: true, native_bridge_supported: true, } cc_object { Loading @@ -189,20 +238,23 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con llndk_library { name: "libc", symbol_file: "", native_bridge_supported: true, } llndk_library { name: "libm", symbol_file: "", native_bridge_supported: true, } llndk_library { name: "libdl", symbol_file: "", native_bridge_supported: true, } ` ctx.MockFileSystem(map[string][]byte{ fs := map[string][]byte{ "Android.bp": []byte(bp), "build/make/target/product/security": nil, "apex_manifest.json": nil, Loading Loading @@ -238,7 +290,13 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con "frameworks/base/api/current.txt": nil, "build/make/core/proguard.flags": nil, "build/make/core/proguard_basic_keeps.flags": nil, }) } for _, handler := range handlers { handler(fs, config) } ctx.MockFileSystem(fs) return ctx, config } Loading Loading @@ -1210,6 +1268,252 @@ func TestHeaderLibsDependency(t *testing.T) { ensureContains(t, cFlags, "-Imy_include") } func TestVndkApexCurrent(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } cc_library { name: "libvndksp", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, support_system_process: true, }, system_shared_libs: [], stl: "none", } `) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndk.so") ensureContains(t, copyCmds, "image.apex/lib/libvndksp.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndk.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndksp.so") } func TestVndkApexWithPrebuilt(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_prebuilt_library_shared { name: "libvndkshared", srcs: ["libvndkshared.so"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `, withFiles(map[string][]byte{ "libvndkshared.so": nil, })) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndkshared.so") } func TestVndkApexVersion(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", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } vndk_prebuilt_shared { name: "libvndk27", version: "27", vendor_available: true, vndk: { enabled: true, }, srcs: ["libvndk27.so"], } `, withFiles(map[string][]byte{ "libvndk27.so": nil, })) apexRule := ctx.ModuleForTests("myapex_v27", "android_common_myapex_v27").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/libvndk27.so") ensureContains(t, copyCmds, "image.apex/lib64/libvndk27.so") ensureNotContains(t, copyCmds, "image.apex/lib/libvndk.so") } func TestVndkApexErrorWithDuplicateVersion(t *testing.T) { testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, ` apex_vndk { name: "myapex_v27", key: "myapex.key", file_contexts: "myapex", vndk_version: "27", } apex_vndk { name: "myapex_v27_other", key: "myapex.key", file_contexts: "myapex", vndk_version: "27", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } vndk_prebuilt_shared { name: "libvndk", version: "27", vendor_available: true, vndk: { enabled: true, }, srcs: ["libvndk.so"], } `, withFiles(map[string][]byte{ "libvndk.so": nil, })) } func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, native_bridge_supported: true, host_supported: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `, withTargets(map[android.OsType][]android.Target{ android.Android: []android.Target{ {Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""}, {Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""}, {Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"}, {Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"}, }, })) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/lib/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) { testApexError(t, `module "myapex" .*: native_bridge_supported: .* doesn't support native bridge binary`, ` apex_vndk { name: "myapex", key: "myapex.key", file_contexts: "myapex", native_bridge_supported: true, } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, native_bridge_supported: true, host_supported: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", } `) } func TestDependenciesInApexManifest(t *testing.T) { ctx, _ := testApex(t, ` apex { Loading
cc/cc.go +13 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,19 @@ func (c *Module) RelativeInstallPath() string { 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 { return c.vndkVersion() } func (c *Module) Init() android.Module { c.AddProperties(&c.Properties, &c.VendorProperties) if c.compiler != nil { Loading
cc/prebuilt.go +4 −4 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ import ( ) func init() { android.RegisterModuleType("cc_prebuilt_library_shared", prebuiltSharedLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_static", prebuiltStaticLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory) android.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory) android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory) } Loading Loading @@ -131,7 +131,7 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() { // cc_prebuilt_library_shared installs a precompiled shared library that are // listed in the srcs property in the device's directory. func prebuiltSharedLibraryFactory() android.Module { func PrebuiltSharedLibraryFactory() android.Module { module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported) return module.Init() } Loading @@ -158,7 +158,7 @@ func NewPrebuiltSharedLibrary(hod android.HostOrDeviceSupported) (*Module, *libr // cc_prebuilt_library_static installs a precompiled static library that are // listed in the srcs property in the device's directory. func prebuiltStaticLibraryFactory() android.Module { func PrebuiltStaticLibraryFactory() android.Module { module, _ := NewPrebuiltStaticLibrary(android.HostAndDeviceSupported) return module.Init() } Loading