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
This commit is contained in:
Jiyong Park
2019-10-22 20:31:18 +09:00
parent 4f45daf9ed
commit 73c54ee7fe
4 changed files with 402 additions and 75 deletions

View File

@@ -24,6 +24,7 @@ import (
// This package doesn't depend on the apex package, but import it to make its mutators to be
// registered before mutators in this package. See RegisterPostDepsMutators for more details.
_ "android/soong/apex"
"android/soong/cc"
)
func init() {
@@ -148,10 +149,17 @@ func memberMutator(mctx android.BottomUpMutatorContext) {
targets := mctx.MultiTargets()
for _, target := range targets {
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: "core"},
{Mutator: "link", Variation: "shared"},
}...), sdkMemberDepTag, m.properties.Native_shared_libs...)
for _, lib := range m.properties.Native_shared_libs {
name, version := cc.StubsLibNameAndVersion(lib)
if version == "" {
version = cc.LatestStubsVersionFor(mctx.Config(), name)
}
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: "core"},
{Mutator: "link", Variation: "shared"},
{Mutator: "version", Variation: version},
}...), sdkMemberDepTag, name)
}
}
}
}