Merge "Exclude RequiresApi from generated stubs"
diff --git a/android/bazel.go b/android/bazel.go
index e330681..53723a0 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -176,24 +176,35 @@
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
bp2buildModuleDoNotConvertList = []string{
// Things that transitively depend on unconverted libc_* modules.
- "libc_common", // ruperts@, cc_library_static, depends on //bionic/libc:libc_nopthread
- "libc_common_static", // ruperts@, cc_library_static, depends on //bionic/libc:libc_common
- "libc_common_shared", // ruperts@, cc_library_static, depends on //bionic/libc:libc_common
- "libc_nomalloc", // ruperts@, cc_library_static, depends on //bionic/libc:libc_common
- "libc_nopthread", // ruperts@, cc_library_static, depends on lib_bionic_ndk, libc_syscalls, libc_tzcode, libstdc++
+ "libc_nopthread", // http://b/186821550, cc_library_static, depends on //bionic/libc:libc_bionic_ndk (http://b/186822256)
+ // also depends on //bionic/libc:libc_tzcode (http://b/186822591)
+ // also depends on //bionic/libc:libstdc++ (http://b/186822597)
+ "libc_common", // http://b/186821517, cc_library_static, depends on //bionic/libc:libc_nopthread (http://b/186821550)
+ "libc_common_static", // http://b/186824119, cc_library_static, depends on //bionic/libc:libc_common (http://b/186821517)
+ "libc_common_shared", // http://b/186824118, cc_library_static, depends on //bionic/libc:libc_common (http://b/186821517)
+ "libc_nomalloc", // http://b/186825031, cc_library_static, depends on //bionic/libc:libc_common (http://b/186821517)
- // Things that transitively depend on //system/libbase. libbase doesn't work because:
- // fmtlib: fatal error: 'cassert' file not found
- "libbase", // eakammer@, cc_library, no such target '//build/bazel/platforms/os:darwin': target 'darwin' not declared
- "libbase_ndk", // eakammer@, cc_library, no such target '//build/bazel/platforms/os:darwin': target 'darwin' not declared
- "libbionic_spawn_benchmark", // ruperts@, cc_library_static, depends on libbase, libgoogle-benchmark
- "libc_malloc_debug", // ruperts@, cc_library_static, depends on libbase
- "libc_malloc_debug_backtrace", // ruperts@, cc_library_static, depends on libbase
- "libcutils", // eakammer@, cc_library, depends on libbase, liblog
- "libcutils_sockets", // eakammer@, cc_library, depends on libbase, liblog
- "liblinker_debuggerd_stub", // ruperts@, cc_library_static, depends on libbase, libz, libziparchive
- "liblinker_main", // ruperts@, cc_library_static, depends on libbase, libz, libziparchive
- "liblinker_malloc", // ruperts@, cc_library_static, depends on libziparchive, libz, libbase
+ "libbase", // http://b/186826479, cc_library, bazel build //bionic/... works but --platforms //build/bazel/platforms:android_x86 fails
+ "libbase_ndk", // http://b/186826477, cc_library, bazel build //bionic/... works but --platforms //build/bazel/platforms:android_x86 fails
+
+ "libbionic_spawn_benchmark", // http://b/186824595, cc_library_static, depends on //external/google-benchmark (http://b/186822740)
+ // also depends on //system/logging/liblog:liblog (http://b/186822772)
+
+ "libc_malloc_debug", // http://b/186824339, cc_library_static, depends on //system/libbase:libbase (http://b/186823646)
+ "libc_malloc_debug_backtrace", // http://b/186824112, cc_library_static, depends on //external/libcxxabi:libc++demangle (http://b/186823773)
+
+ "libcutils", // http://b/186827426, cc_library, depends on //system/core/libprocessgroup:libprocessgroup_headers (http://b/186826841)
+ "libcutils_sockets", // http://b/186826853, cc_library, depends on //system/libbase:libbase (http://b/186826479)
+
+ "liblinker_debuggerd_stub", // http://b/186824327, cc_library_static, depends on //external/zlib:libz (http://b/186823782)
+ // also depends on //system/libziparchive:libziparchive (http://b/186823656)
+ // also depends on //system/logging/liblog:liblog (http://b/186822772)
+ "liblinker_main", // http://b/186825989, cc_library_static, depends on //external/zlib:libz (http://b/186823782)
+ // also depends on //system/libziparchive:libziparchive (http://b/186823656)
+ // also depends on//system/logging/liblog:liblog (http://b/186822772)
+ "liblinker_malloc", // http://b/186826466, cc_library_static, depends on //external/zlib:libz (http://b/186823782)
+ // also depends on //system/libziparchive:libziparchive (http://b/186823656)
+ // also depends on //system/logging/liblog:liblog (http://b/186822772)
// Requires non-libc targets, but otherwise works
"libc_jemalloc_wrapper", // ruperts@, cc_library_static, depends on //external/jemalloc_new
@@ -209,10 +220,12 @@
// Includes not found
"libbionic_tests_headers_posix", // ruperts@, cc_library_static, 'dirent.h' not found
- "liblog", // eakammer@, cc_library, 'sys/cdefs.h' file not found, missing -isystem bionic/libc/include through the libc/libm/libdl default dependencies if system_shared_libs unset
- "libseccomp_policy", // jingwen@, cc_library, 'linux/filter.h' not found, missing -isystem bionic/libc/kernel/uapi/asm-arm, probably due to us not handling arch { ... { export_system_include_dirs } } correctly
- "note_memtag_heap_async", // lberki@, cc_library_static, error: feature.h not found, missing -isystem bionic/libc/include through the libc/libm/libdl default dependencies if system_shared_libs unset
- "note_memtag_heap_sync", // lberki@, cc_library_static, error: feature.h not found, missing -isystem bionic/libc/include through the libc/libm/libdl default dependencies if system_shared_libs unset
+
+ // b/186024507, missing -isystem bionic/libc/include through the libc/libm/libdl default dependencies if system_shared_libs unset
+ "liblog", // cc_library, 'sys/cdefs.h' file not found
+ "libseccomp_policy", // cc_library, 'linux/filter.h' not found
+ "note_memtag_heap_async", // cc_library_static, error: feature.h not found
+ "note_memtag_heap_sync", // cc_library_static, error: feature.h not found
// Other
"libBionicBenchmarksUtils", // ruperts@, cc_library_static, 'map' file not found
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 70b5259..e58d166 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -580,20 +580,6 @@
entries.Class = "SHARED_LIBRARIES"
}
-func (c *vendorPublicLibraryStubDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
- entries.Class = "SHARED_LIBRARIES"
- entries.SubName = vendorPublicLibrarySuffix
-
- entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- c.libraryDecorator.androidMkWriteExportedFlags(entries)
- _, _, ext := android.SplitFileExt(entries.OutputFile.Path().Base())
-
- entries.SetString("LOCAL_BUILT_MODULE_STEM", "$(LOCAL_MODULE)"+ext)
- entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
- entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
- })
-}
-
func (p *prebuiltLinker) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if p.properties.Check_elf_files != nil {
diff --git a/cc/cc.go b/cc/cc.go
index 3ba5366..16a49d3 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -447,6 +447,10 @@
// IsVNDKProduct is set if a VNDK module sets the product_available property.
IsVNDKProduct bool `blueprint:"mutated"`
+
+ // IsVendorPublicLibrary is set for the core and product variants of a library that has
+ // vendor_public_library stubs.
+ IsVendorPublicLibrary bool `blueprint:"mutated"`
}
// ModuleContextIntf is an interface (on a module context helper) consisting of functions related
@@ -475,6 +479,7 @@
isVndk() bool
isVndkSp() bool
IsVndkExt() bool
+ IsVendorPublicLibrary() bool
inProduct() bool
inVendor() bool
inRamdisk() bool
@@ -1126,6 +1131,16 @@
return lib != nil && (lib.hasLLNDKStubs() || lib.hasLLNDKHeaders())
}
+func (m *Module) NeedsVendorPublicLibraryVariants() bool {
+ lib := moduleLibraryInterface(m)
+ return lib != nil && (lib.hasVendorPublicLibrary())
+}
+
+// IsVendorPublicLibrary returns true for vendor public libraries.
+func (c *Module) IsVendorPublicLibrary() bool {
+ return c.VendorProperties.IsVendorPublicLibrary
+}
+
// isImplementationForLLNDKPublic returns true for any variant of a cc_library that has LLNDK stubs
// and does not set llndk.vendor_available: false.
func (c *Module) isImplementationForLLNDKPublic() bool {
@@ -1437,6 +1452,10 @@
return ctx.mod.IsVndkExt()
}
+func (ctx *moduleContextImpl) IsVendorPublicLibrary() bool {
+ return ctx.mod.IsVendorPublicLibrary()
+}
+
func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
return ctx.mod.MustUseVendorVariant()
}
@@ -1599,6 +1618,8 @@
// added for product variant only when we have vendor and product variants with core
// variant. The suffix is not added for vendor-only or product-only module.
c.Properties.SubName += c.getNameSuffixWithVndkVersion(actx)
+ } else if c.IsVendorPublicLibrary() {
+ c.Properties.SubName += vendorPublicLibrarySuffix
} else if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok {
// .vendor suffix is added for backward compatibility with VNDK snapshot whose names with
// such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp.
@@ -2043,8 +2064,6 @@
// The caller can then know to add the variantLibs dependencies differently from the
// nonvariantLibs
- vendorPublicLibraries := vendorPublicLibraries(actx.Config())
-
rewriteLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
variantLibs = []string{}
nonvariantLibs = []string{}
@@ -2055,16 +2074,6 @@
nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
} else if ctx.useSdk() && inList(name, *getNDKKnownLibs(ctx.Config())) {
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
- } else if (ctx.Platform() || ctx.ProductSpecific()) && inList(name, *vendorPublicLibraries) {
- vendorPublicLib := name + vendorPublicLibrarySuffix
- if actx.OtherModuleExists(vendorPublicLib) {
- nonvariantLibs = append(nonvariantLibs, vendorPublicLib)
- } else {
- // This can happen if vendor_public_library module is defined in a
- // namespace that isn't visible to the current module. In that case,
- // link to the original library.
- nonvariantLibs = append(nonvariantLibs, name)
- }
} else if ctx.useVndk() {
nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
} else {
@@ -2921,13 +2930,9 @@
}
func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableInterface, depName string) string {
-
- vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
-
libName := baseLibName(depName)
ccDepModule, _ := ccDep.(*Module)
isLLndk := ccDepModule != nil && ccDepModule.IsLlndk()
- isVendorPublicLib := inList(libName, *vendorPublicLibraries)
nonSystemVariantsExist := ccDep.HasNonSystemVariants() || isLLndk
if ccDepModule != nil {
@@ -2949,8 +2954,6 @@
// The vendor and product modules in Make will have been renamed to not conflict with the
// core module, so update the dependency name here accordingly.
return libName + ccDep.SubName()
- } else if (ctx.Platform() || ctx.ProductSpecific()) && isVendorPublicLib {
- return libName + vendorPublicLibrarySuffix
} else if ccDep.InRamdisk() && !ccDep.OnlyInRamdisk() {
return libName + ramdiskSuffix
} else if ccDep.InVendorRamdisk() && !ccDep.OnlyInVendorRamdisk() {
diff --git a/cc/image.go b/cc/image.go
index 5593afc..1a67731 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -452,6 +452,17 @@
if productVndkVersion != "" {
productVariants = append(productVariants, productVndkVersion)
}
+ } else if m.NeedsVendorPublicLibraryVariants() {
+ // A vendor public library has the implementation on /vendor, with stub variants
+ // for system and product.
+ coreVariantNeeded = true
+ vendorVariants = append(vendorVariants, boardVndkVersion)
+ if platformVndkVersion != "" {
+ productVariants = append(productVariants, platformVndkVersion)
+ }
+ if productVndkVersion != "" {
+ productVariants = append(productVariants, productVndkVersion)
+ }
} else if boardVndkVersion == "" {
// If the device isn't compiling against the VNDK, we always
// use the core mode.
@@ -677,4 +688,9 @@
m.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
squashProductSrcs(m)
}
+
+ if c.NeedsVendorPublicLibraryVariants() &&
+ (variant == android.CoreVariation || strings.HasPrefix(variant, ProductVariationPrefix)) {
+ c.VendorProperties.IsVendorPublicLibrary = true
+ }
}
diff --git a/cc/library.go b/cc/library.go
index 4cd1b09..3b65d8d 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -120,6 +120,9 @@
// If this is an LLNDK library, properties to describe the LLNDK stubs. Will be copied from
// the module pointed to by llndk_stubs if it is set.
Llndk llndkLibraryProperties
+
+ // If this is a vendor public library, properties to describe the vendor public library stubs.
+ Vendor_public_library vendorPublicLibraryProperties
}
// StaticProperties is a properties stanza to affect only attributes of the "static" variants of a
@@ -786,6 +789,13 @@
}
return objs
}
+ if ctx.IsVendorPublicLibrary() {
+ objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Vendor_public_library.Symbol_file), "current", "")
+ if !Bool(library.Properties.Vendor_public_library.Unversioned) {
+ library.versionScriptPath = android.OptionalPathForPath(versionScript)
+ }
+ return objs
+ }
if library.buildStubs() {
symbolFile := String(library.Properties.Stubs.Symbol_file)
if symbolFile != "" && !strings.HasSuffix(symbolFile, ".map.txt") {
@@ -883,6 +893,7 @@
implementationModuleName(name string) string
hasLLNDKStubs() bool
hasLLNDKHeaders() bool
+ hasVendorPublicLibrary() bool
}
var _ libraryInterface = (*libraryDecorator)(nil)
@@ -978,6 +989,12 @@
deps.ReexportHeaderLibHeaders = append([]string(nil), library.Properties.Llndk.Export_llndk_headers...)
return deps
}
+ if ctx.IsVendorPublicLibrary() {
+ headers := library.Properties.Vendor_public_library.Export_public_headers
+ deps.HeaderLibs = append([]string(nil), headers...)
+ deps.ReexportHeaderLibHeaders = append([]string(nil), headers...)
+ return deps
+ }
if library.static() {
// Compare with nil because an empty list needs to be propagated.
@@ -1434,6 +1451,14 @@
}
}
+ if ctx.IsVendorPublicLibrary() {
+ // override the module's export_include_dirs with vendor_public_library.override_export_include_dirs
+ // if it is set.
+ if override := library.Properties.Vendor_public_library.Override_export_include_dirs; override != nil {
+ library.flagExporter.Properties.Export_include_dirs = override
+ }
+ }
+
// Linking this library consists of linking `deps.Objs` (.o files in dependencies
// of this library), together with `objs` (.o files created by compiling this
// library).
@@ -1695,6 +1720,12 @@
return Bool(library.Properties.Llndk.Llndk_headers)
}
+// hasVendorPublicLibrary returns true if this cc_library module has a variant that will build
+// vendor public library stubs.
+func (library *libraryDecorator) hasVendorPublicLibrary() bool {
+ return String(library.Properties.Vendor_public_library.Symbol_file) != ""
+}
+
func (library *libraryDecorator) implementationModuleName(name string) string {
return name
}
@@ -1994,11 +2025,12 @@
m := mctx.Module().(*Module)
isLLNDK := m.IsLlndk()
+ isVendorPublicLibrary := m.IsVendorPublicLibrary()
modules := mctx.CreateLocalVariations(variants...)
for i, m := range modules {
- if variants[i] != "" || isLLNDK {
+ if variants[i] != "" || isLLNDK || isVendorPublicLibrary {
// A stubs or LLNDK stubs variant.
c := m.(*Module)
c.sanitize = nil
diff --git a/cc/linkable.go b/cc/linkable.go
index 17526b4..40a9d8b 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -109,6 +109,9 @@
// NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers.
NeedsLlndkVariants() bool
+ // NeedsVendorPublicLibraryVariants returns true if this module has vendor public library stubs.
+ NeedsVendorPublicLibraryVariants() bool
+
UseVndk() bool
MustUseVendorVariant() bool
IsVndk() bool
diff --git a/cc/makevars.go b/cc/makevars.go
index 923472a..fa0b2cc 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -71,8 +71,6 @@
}
func makeVarsProvider(ctx android.MakeVarsContext) {
- vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
-
ctx.Strict("LLVM_RELEASE_VERSION", "${config.ClangShortVersion}")
ctx.Strict("LLVM_PREBUILTS_VERSION", "${config.ClangVersion}")
ctx.Strict("LLVM_PREBUILTS_BASE", "${config.ClangBase}")
@@ -106,7 +104,7 @@
ctx.VisitAllModules(func(module android.Module) {
if ccModule, ok := module.(*Module); ok {
baseName := ccModule.BaseModuleName()
- if inList(baseName, *vendorPublicLibraries) && module.ExportedToMake() {
+ if ccModule.IsVendorPublicLibrary() && module.ExportedToMake() {
if !inList(baseName, exportedVendorPublicLibraries) {
exportedVendorPublicLibraries = append(exportedVendorPublicLibraries, baseName)
}
diff --git a/cc/testing.go b/cc/testing.go
index ca6a0fa..15f7ebb 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -556,7 +556,6 @@
ctx.RegisterModuleType("cc_fuzz", FuzzFactory)
ctx.RegisterModuleType("cc_test", TestFactory)
ctx.RegisterModuleType("cc_test_library", TestLibraryFactory)
- ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory)
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
RegisterVndkLibraryTxtTypes(ctx)
@@ -672,7 +671,6 @@
ctx.RegisterModuleType("cc_fuzz", FuzzFactory)
ctx.RegisterModuleType("cc_test", TestFactory)
ctx.RegisterModuleType("cc_test_library", TestLibraryFactory)
- ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
diff --git a/cc/vendor_public_library.go b/cc/vendor_public_library.go
index 394e322..65a2b0c 100644
--- a/cc/vendor_public_library.go
+++ b/cc/vendor_public_library.go
@@ -14,26 +14,10 @@
package cc
-import (
- "strings"
- "sync"
-
- "android/soong/android"
-)
-
var (
vendorPublicLibrarySuffix = ".vendorpublic"
-
- vendorPublicLibrariesKey = android.NewOnceKey("vendorPublicLibraries")
- vendorPublicLibrariesLock sync.Mutex
)
-func vendorPublicLibraries(config android.Config) *[]string {
- return config.Once(vendorPublicLibrariesKey, func() interface{} {
- return &[]string{}
- }).(*[]string)
-}
-
// Creates a stub shared library for a vendor public library. Vendor public libraries
// are vendor libraries (owned by them and installed to /vendor partition) that are
// exposed to Android apps via JNI. The libraries are made public by being listed in
@@ -64,105 +48,9 @@
// list of header libs to re-export include directories from.
Export_public_headers []string `android:"arch_variant"`
-}
-type vendorPublicLibraryStubDecorator struct {
- *libraryDecorator
-
- Properties vendorPublicLibraryProperties
-
- versionScriptPath android.ModuleGenPath
-}
-
-func (stub *vendorPublicLibraryStubDecorator) Name(name string) string {
- return name + vendorPublicLibrarySuffix
-}
-
-func (stub *vendorPublicLibraryStubDecorator) compilerInit(ctx BaseModuleContext) {
- stub.baseCompiler.compilerInit(ctx)
-
- name := ctx.baseModuleName()
- if strings.HasSuffix(name, vendorPublicLibrarySuffix) {
- ctx.PropertyErrorf("name", "Do not append %q manually, just use the base name", vendorPublicLibrarySuffix)
- }
-
- vendorPublicLibrariesLock.Lock()
- defer vendorPublicLibrariesLock.Unlock()
- vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
- for _, lib := range *vendorPublicLibraries {
- if lib == name {
- return
- }
- }
- *vendorPublicLibraries = append(*vendorPublicLibraries, name)
-}
-
-func (stub *vendorPublicLibraryStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
- flags = stub.baseCompiler.compilerFlags(ctx, flags, deps)
- return addStubLibraryCompilerFlags(flags)
-}
-
-func (stub *vendorPublicLibraryStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
- objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), "current", "")
- stub.versionScriptPath = versionScript
- return objs
-}
-
-func (stub *vendorPublicLibraryStubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
- headers := stub.Properties.Export_public_headers
- deps.HeaderLibs = append(deps.HeaderLibs, headers...)
- deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, headers...)
- return deps
-}
-
-func (stub *vendorPublicLibraryStubDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
- stub.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), vendorPublicLibrarySuffix)
- return stub.libraryDecorator.linkerFlags(ctx, flags)
-}
-
-func (stub *vendorPublicLibraryStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
- objs Objects) android.Path {
- if !Bool(stub.Properties.Unversioned) {
- linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
- flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlag)
- flags.LdFlagsDeps = append(flags.LdFlagsDeps, stub.versionScriptPath)
- }
- return stub.libraryDecorator.link(ctx, flags, deps, objs)
-}
-
-// vendor_public_library creates a stub shared library for a vendor public
-// library. This stub library is a build-time only artifact that provides
-// symbols that are exposed from a vendor public library. Example:
-//
-// vendor_public_library {
-// name: "libfoo",
-// symbol_file: "libfoo.map.txt",
-// export_public_headers: ["libfoo_headers"],
-// }
-func vendorPublicLibraryFactory() android.Module {
- module, library := NewLibrary(android.DeviceSupported)
- library.BuildOnlyShared()
- module.stl = nil
- module.sanitize = nil
- library.disableStripping()
-
- stub := &vendorPublicLibraryStubDecorator{
- libraryDecorator: library,
- }
- module.compiler = stub
- module.linker = stub
- module.installer = nil
-
- module.AddProperties(
- &stub.Properties,
- &module.VendorProperties,
- &library.MutatedProperties,
- &library.flagExporter.Properties)
-
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
- return module
-}
-
-func init() {
- android.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory)
+ // list of directories relative to the Blueprints file that willbe added to the include path
+ // (using -I) for any module that links against the LLNDK variant of this module, replacing
+ // any that were listed outside the llndk clause.
+ Override_export_include_dirs []string
}
diff --git a/cc/vendor_public_library_test.go b/cc/vendor_public_library_test.go
index 9f2accf..01959b4 100644
--- a/cc/vendor_public_library_test.go
+++ b/cc/vendor_public_library_test.go
@@ -26,18 +26,16 @@
product_available: true,
export_include_dirs: ["my_include"],
}
- vendor_public_library {
- name: "libvendorpublic",
- product_available: true,
- symbol_file: "",
- export_public_headers: ["libvendorpublic_headers"],
- }
cc_library {
name: "libvendorpublic",
srcs: ["foo.c"],
vendor: true,
no_libcrt: true,
nocrt: true,
+ vendor_public_library: {
+ symbol_file: "libvendorpublic.map.txt",
+ export_public_headers: ["libvendorpublic_headers"],
+ },
}
cc_library {
@@ -81,7 +79,7 @@
// test if libsystem is linked to the stub
ld := ctx.ModuleForTests("libsystem", coreVariant).Rule("ld")
libflags := ld.Args["libFlags"]
- stubPaths := getOutputPaths(ctx, coreVariant, []string{"libvendorpublic" + vendorPublicLibrarySuffix})
+ stubPaths := getOutputPaths(ctx, coreVariant, []string{"libvendorpublic"})
if !strings.Contains(libflags, stubPaths[0].String()) {
t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
}
@@ -89,7 +87,7 @@
// test if libsystem is linked to the stub
ld = ctx.ModuleForTests("libproduct", productVariant).Rule("ld")
libflags = ld.Args["libFlags"]
- stubPaths = getOutputPaths(ctx, productVariant, []string{"libvendorpublic" + vendorPublicLibrarySuffix})
+ stubPaths = getOutputPaths(ctx, productVariant, []string{"libvendorpublic"})
if !strings.Contains(libflags, stubPaths[0].String()) {
t.Errorf("libflags for libproduct must contain %#v, but was %#v", stubPaths[0], libflags)
}
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 9826baf..43d54bf 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -149,15 +149,6 @@
}
}
-// Export paths to Make. INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/.
-func (h *hiddenAPISingleton) MakeVars(ctx android.MakeVarsContext) {
- if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
- return
- }
-
- ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", h.flags.String())
-}
-
// Checks to see whether the supplied module variant is in the list of boot jars.
//
// This is similar to logic in getBootImageJar() so any changes needed here are likely to be needed
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 6bf9ea0..9f16294 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -26,7 +26,7 @@
}
func registerPlatformBootclasspathBuildComponents(ctx android.RegistrationContext) {
- ctx.RegisterModuleType("platform_bootclasspath", platformBootclasspathFactory)
+ ctx.RegisterSingletonModuleType("platform_bootclasspath", platformBootclasspathFactory)
}
// The tags used for the dependencies between the platform bootclasspath and any configured boot
@@ -38,7 +38,7 @@
)
type platformBootclasspathModule struct {
- android.ModuleBase
+ android.SingletonModuleBase
ClasspathFragmentBase
properties platformBootclasspathProperties
@@ -69,7 +69,7 @@
Hidden_api HiddenAPIFlagFileProperties
}
-func platformBootclasspathFactory() android.Module {
+func platformBootclasspathFactory() android.SingletonModule {
m := &platformBootclasspathModule{}
m.AddProperties(&m.properties)
// TODO(satayev): split systemserver and apex jars into separate configs.
@@ -154,6 +154,18 @@
}
}
+// GenerateSingletonBuildActions does nothing and must never do anything.
+//
+// This module only implements android.SingletonModule so that it can implement
+// android.SingletonMakeVarsProvider.
+func (b *platformBootclasspathModule) GenerateSingletonBuildActions(android.SingletonContext) {
+ // Keep empty
+}
+
+func (d *platformBootclasspathModule) MakeVars(ctx android.MakeVarsContext) {
+ d.generateHiddenApiMakeVars(ctx)
+}
+
func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
b.classpathFragmentBase().generateAndroidBuildActions(ctx)
@@ -307,6 +319,16 @@
rule.Build("platform-bootclasspath-monolithic-hiddenapi-metadata", "monolithic hidden API metadata")
}
+// generateHiddenApiMakeVars generates make variables needed by hidden API related make rules, e.g.
+// veridex and run-appcompat.
+func (b *platformBootclasspathModule) generateHiddenApiMakeVars(ctx android.MakeVarsContext) {
+ if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
+ return
+ }
+ // INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/.
+ ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", b.hiddenAPIFlagsCSV.String())
+}
+
// generateBootImageBuildActions generates ninja rules related to the boot image creation.
func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.ModuleContext, updatableModules []android.Module) {
// Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
diff --git a/rust/rust.go b/rust/rust.go
index 3dcd459..bb97142 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -270,6 +270,10 @@
return false
}
+func (m *Module) NeedsVendorPublicLibraryVariants() bool {
+ return false
+}
+
func (mod *Module) SdkVersion() string {
return ""
}