native shared libs in an SDK can be snapshotted
The snapshot script can now handle native shared libs in an SDK.
Bug: 138182343
Test: create following sdk module:
sdk {
name: "mysdk",
native_shared_libs: ["libc", "libdl"],
}
, then execute `m mysdk` and execute the update_prebuilt-1.sh as
prompted. Following directories are generated under the directory where
mysdk is defined at:
1
├── aidl
├── Android.bp
├── arm64
│ ├── include
│ ├── include_gen
│ └── lib
│ ├── libc.so
│ └── libdl.so
├── include
│ └── bionic
│ └── libc
│ └── include
│ ├── alloca.h
│ ├── android
│ │ ├── api-level.h
<omitted>
Change-Id: Ia1dcc5564c1cd17c6ccf441d06d5995af55db9ee
diff --git a/cc/library.go b/cc/library.go
index 1943e89..19a0787 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -158,6 +158,10 @@
// listed in local_include_dirs.
Export_include_dirs []string `android:"arch_variant"`
+ // list of directories that will be added to the system include path
+ // using -isystem for this module and any module that links against this module.
+ Export_system_include_dirs []string `android:"arch_variant"`
+
Target struct {
Vendor struct {
// list of exported include directories, like
@@ -245,10 +249,13 @@
func (f *flagExporter) exportIncludes(ctx ModuleContext) {
f.dirs = append(f.dirs, f.exportedIncludes(ctx)...)
+ f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
}
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
+ // all dirs are force exported as system
f.systemDirs = append(f.systemDirs, f.exportedIncludes(ctx)...)
+ f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
}
func (f *flagExporter) reexportDirs(dirs ...android.Path) {
@@ -1280,7 +1287,7 @@
var stubsVersionsLock sync.Mutex
-func latestStubsVersionFor(config android.Config, name string) string {
+func LatestStubsVersionFor(config android.Config, name string) string {
versions, ok := stubsVersionsFor(config)[name]
if ok && len(versions) > 0 {
// the versions are alreay sorted in ascending order