Merge changes from topic "libraries-txt-to-soong"
* changes: VNDK APEX contains related *.libraries.txt files Make vndk*.libraries.txt as soong modules
This commit is contained in:
commit
3e38230af7
|
@ -54,6 +54,12 @@ type prebuiltEtcProperties struct {
|
||||||
Installable *bool
|
Installable *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PrebuiltEtcModule interface {
|
||||||
|
Module
|
||||||
|
SubDir() string
|
||||||
|
OutputFile() OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
type PrebuiltEtc struct {
|
type PrebuiltEtc struct {
|
||||||
ModuleBase
|
ModuleBase
|
||||||
|
|
||||||
|
|
|
@ -249,6 +249,9 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||||
if vndkApex, ok := vndkApexList[vndkVersion]; ok {
|
if vndkApex, ok := vndkApexList[vndkVersion]; ok {
|
||||||
mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex)
|
mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex)
|
||||||
}
|
}
|
||||||
|
} else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex {
|
||||||
|
vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
|
||||||
|
mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,7 +978,7 @@ func getCopyManifestForPrebuiltJavaLibrary(java *java.Import) (fileToCopy androi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCopyManifestForPrebuiltEtc(prebuilt *android.PrebuiltEtc) (fileToCopy android.Path, dirInApex string) {
|
func getCopyManifestForPrebuiltEtc(prebuilt android.PrebuiltEtcModule) (fileToCopy android.Path, dirInApex string) {
|
||||||
dirInApex = filepath.Join("etc", prebuilt.SubDir())
|
dirInApex = filepath.Join("etc", prebuilt.SubDir())
|
||||||
fileToCopy = prebuilt.OutputFile()
|
fileToCopy = prebuilt.OutputFile()
|
||||||
return
|
return
|
||||||
|
@ -1131,7 +1134,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
|
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
|
||||||
}
|
}
|
||||||
case prebuiltTag:
|
case prebuiltTag:
|
||||||
if prebuilt, ok := child.(*android.PrebuiltEtc); ok {
|
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
|
||||||
fileToCopy, dirInApex := getCopyManifestForPrebuiltEtc(prebuilt)
|
fileToCopy, dirInApex := getCopyManifestForPrebuiltEtc(prebuilt)
|
||||||
filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, etc, prebuilt, nil})
|
filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, etc, prebuilt, nil})
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -17,6 +17,7 @@ package apex
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -117,6 +118,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||||
ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory))
|
ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory))
|
||||||
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
|
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory))
|
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory))
|
||||||
|
ctx.RegisterModuleType("vndk_libraries_txt", android.ModuleFactoryAdaptor(cc.VndkLibrariesTxtFactory))
|
||||||
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory))
|
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory))
|
||||||
ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory))
|
ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory))
|
||||||
ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory))
|
ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory))
|
||||||
|
@ -298,6 +300,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||||
"framework/aidl/a.aidl": nil,
|
"framework/aidl/a.aidl": nil,
|
||||||
"build/make/core/proguard.flags": nil,
|
"build/make/core/proguard.flags": nil,
|
||||||
"build/make/core/proguard_basic_keeps.flags": nil,
|
"build/make/core/proguard_basic_keeps.flags": nil,
|
||||||
|
"dummy.txt": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, handler := range handlers {
|
for _, handler := range handlers {
|
||||||
|
@ -1319,7 +1322,18 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName stri
|
||||||
apexRule := ctx.ModuleForTests(moduleName, "android_common_"+moduleName+"_image").Rule("apexRule")
|
apexRule := ctx.ModuleForTests(moduleName, "android_common_"+moduleName+"_image").Rule("apexRule")
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
copyCmds := apexRule.Args["copy_commands"]
|
||||||
imageApexDir := "/image.apex/"
|
imageApexDir := "/image.apex/"
|
||||||
dstFiles := []string{}
|
var failed bool
|
||||||
|
var surplus []string
|
||||||
|
filesMatched := make(map[string]bool)
|
||||||
|
addContent := func(content string) {
|
||||||
|
for _, expected := range files {
|
||||||
|
if matched, _ := path.Match(expected, content); matched {
|
||||||
|
filesMatched[expected] = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
surplus = append(surplus, content)
|
||||||
|
}
|
||||||
for _, cmd := range strings.Split(copyCmds, "&&") {
|
for _, cmd := range strings.Split(copyCmds, "&&") {
|
||||||
cmd = strings.TrimSpace(cmd)
|
cmd = strings.TrimSpace(cmd)
|
||||||
if cmd == "" {
|
if cmd == "" {
|
||||||
|
@ -1338,42 +1352,26 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName stri
|
||||||
t.Fatal("copyCmds should copy a file to image.apex/", cmd)
|
t.Fatal("copyCmds should copy a file to image.apex/", cmd)
|
||||||
}
|
}
|
||||||
dstFile := dst[index+len(imageApexDir):]
|
dstFile := dst[index+len(imageApexDir):]
|
||||||
dstFiles = append(dstFiles, dstFile)
|
addContent(dstFile)
|
||||||
default:
|
default:
|
||||||
t.Fatalf("copyCmds should contain mkdir/cp commands only: %q", cmd)
|
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 {
|
if len(surplus) > 0 {
|
||||||
|
sort.Strings(surplus)
|
||||||
t.Log("surplus files", surplus)
|
t.Log("surplus files", surplus)
|
||||||
failed = true
|
failed = true
|
||||||
}
|
}
|
||||||
if len(missing) > 0 {
|
|
||||||
|
if len(files) > len(filesMatched) {
|
||||||
|
var missing []string
|
||||||
|
for _, expected := range files {
|
||||||
|
if !filesMatched[expected] {
|
||||||
|
missing = append(missing, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Strings(missing)
|
||||||
t.Log("missing files", missing)
|
t.Log("missing files", missing)
|
||||||
failed = true
|
failed = true
|
||||||
}
|
}
|
||||||
|
@ -1418,13 +1416,18 @@ func TestVndkApexCurrent(t *testing.T) {
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
}
|
}
|
||||||
`)
|
`+vndkLibrariesTxtFiles("current"))
|
||||||
|
|
||||||
ensureExactContents(t, ctx, "myapex", []string{
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
"lib/libvndk.so",
|
"lib/libvndk.so",
|
||||||
"lib/libvndksp.so",
|
"lib/libvndksp.so",
|
||||||
"lib64/libvndk.so",
|
"lib64/libvndk.so",
|
||||||
"lib64/libvndksp.so",
|
"lib64/libvndksp.so",
|
||||||
|
"etc/llndk.libraries.VER.txt",
|
||||||
|
"etc/vndkcore.libraries.VER.txt",
|
||||||
|
"etc/vndksp.libraries.VER.txt",
|
||||||
|
"etc/vndkprivate.libraries.VER.txt",
|
||||||
|
"etc/vndkcorevariant.libraries.VER.txt",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1469,18 +1472,44 @@ func TestVndkApexWithPrebuilt(t *testing.T) {
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
}
|
}
|
||||||
`, withFiles(map[string][]byte{
|
`+vndkLibrariesTxtFiles("current"),
|
||||||
"libvndk.so": nil,
|
withFiles(map[string][]byte{
|
||||||
"libvndk.arm.so": nil,
|
"libvndk.so": nil,
|
||||||
}))
|
"libvndk.arm.so": nil,
|
||||||
|
}))
|
||||||
|
|
||||||
ensureExactContents(t, ctx, "myapex", []string{
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
"lib/libvndk.so",
|
"lib/libvndk.so",
|
||||||
"lib/libvndk.arm.so",
|
"lib/libvndk.arm.so",
|
||||||
"lib64/libvndk.so",
|
"lib64/libvndk.so",
|
||||||
|
"etc/*",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func vndkLibrariesTxtFiles(vers ...string) (result string) {
|
||||||
|
for _, v := range vers {
|
||||||
|
if v == "current" {
|
||||||
|
for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkcorevariant"} {
|
||||||
|
result += `
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "` + txt + `.libraries.txt",
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate"} {
|
||||||
|
result += `
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "` + txt + `.libraries.` + v + `.txt",
|
||||||
|
src: "dummy.txt",
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func TestVndkApexVersion(t *testing.T) {
|
func TestVndkApexVersion(t *testing.T) {
|
||||||
ctx, _ := testApex(t, `
|
ctx, _ := testApex(t, `
|
||||||
apex_vndk {
|
apex_vndk {
|
||||||
|
@ -1530,17 +1559,19 @@ func TestVndkApexVersion(t *testing.T) {
|
||||||
srcs: ["libvndk27_x86_64.so"],
|
srcs: ["libvndk27_x86_64.so"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`, withFiles(map[string][]byte{
|
`+vndkLibrariesTxtFiles("27"),
|
||||||
"libvndk27_arm.so": nil,
|
withFiles(map[string][]byte{
|
||||||
"libvndk27_arm64.so": nil,
|
"libvndk27_arm.so": nil,
|
||||||
"libvndk27_x86.so": nil,
|
"libvndk27_arm64.so": nil,
|
||||||
"libvndk27_x86_64.so": nil,
|
"libvndk27_x86.so": nil,
|
||||||
}))
|
"libvndk27_x86_64.so": nil,
|
||||||
|
}))
|
||||||
|
|
||||||
ensureExactContents(t, ctx, "myapex_v27", []string{
|
ensureExactContents(t, ctx, "myapex_v27", []string{
|
||||||
"lib/libvndk27_arm.so",
|
"lib/libvndk27_arm.so",
|
||||||
"lib64/libvndk27_arm64.so",
|
"lib64/libvndk27_arm64.so",
|
||||||
|
"etc/*",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1607,7 +1638,7 @@ func TestVndkApexNameRule(t *testing.T) {
|
||||||
name: "myapex.key",
|
name: "myapex.key",
|
||||||
public_key: "testkey.avbpubkey",
|
public_key: "testkey.avbpubkey",
|
||||||
private_key: "testkey.pem",
|
private_key: "testkey.pem",
|
||||||
}`)
|
}`+vndkLibrariesTxtFiles("28", "current"))
|
||||||
|
|
||||||
assertApexName := func(expected, moduleName string) {
|
assertApexName := func(expected, moduleName string) {
|
||||||
bundle := ctx.ModuleForTests(moduleName, "android_common_"+moduleName+"_image").Module().(*apexBundle)
|
bundle := ctx.ModuleForTests(moduleName, "android_common_"+moduleName+"_image").Module().(*apexBundle)
|
||||||
|
@ -1647,18 +1678,20 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
}
|
}
|
||||||
`, withTargets(map[android.OsType][]android.Target{
|
`+vndkLibrariesTxtFiles("current"),
|
||||||
android.Android: []android.Target{
|
withTargets(map[android.OsType][]android.Target{
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
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: ""},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"},
|
||||||
},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"},
|
||||||
}))
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
ensureExactContents(t, ctx, "myapex", []string{
|
ensureExactContents(t, ctx, "myapex", []string{
|
||||||
"lib/libvndk.so",
|
"lib/libvndk.so",
|
||||||
"lib64/libvndk.so",
|
"lib64/libvndk.so",
|
||||||
|
"etc/*",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1693,8 +1726,7 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkApexWithBinder32(t *testing.T) {
|
func TestVndkApexWithBinder32(t *testing.T) {
|
||||||
ctx, _ := testApex(t,
|
ctx, _ := testApex(t, `
|
||||||
`
|
|
||||||
apex_vndk {
|
apex_vndk {
|
||||||
name: "myapex_v27",
|
name: "myapex_v27",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
|
@ -1738,7 +1770,7 @@ func TestVndkApexWithBinder32(t *testing.T) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`,
|
`+vndkLibrariesTxtFiles("27"),
|
||||||
withFiles(map[string][]byte{
|
withFiles(map[string][]byte{
|
||||||
"libvndk27.so": nil,
|
"libvndk27.so": nil,
|
||||||
"libvndk27binder32.so": nil,
|
"libvndk27binder32.so": nil,
|
||||||
|
@ -1753,6 +1785,7 @@ func TestVndkApexWithBinder32(t *testing.T) {
|
||||||
|
|
||||||
ensureExactContents(t, ctx, "myapex_v27", []string{
|
ensureExactContents(t, ctx, "myapex_v27", []string{
|
||||||
"lib/libvndk27binder32.so",
|
"lib/libvndk27binder32.so",
|
||||||
|
"etc/*",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
120
cc/cc_test.go
120
cc/cc_test.go
|
@ -248,27 +248,45 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkVndkSnapshot(t *testing.T, ctx *android.TestContext, name, subDir, variant string) {
|
func checkVndkSnapshot(t *testing.T, ctx *android.TestContext, moduleName, snapshotFilename, subDir, variant string) {
|
||||||
vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
|
vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
|
||||||
|
|
||||||
mod := ctx.ModuleForTests(name, variant).Module().(*Module)
|
mod, ok := ctx.ModuleForTests(moduleName, variant).Module().(android.OutputFileProducer)
|
||||||
if !mod.outputFile.Valid() {
|
if !ok {
|
||||||
t.Errorf("%q must have output\n", name)
|
t.Errorf("%q must have output\n", moduleName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
snapshotPath := filepath.Join(subDir, mod.outputFile.Path().Base())
|
outputFiles, err := mod.OutputFiles("")
|
||||||
|
if err != nil || len(outputFiles) != 1 {
|
||||||
|
t.Errorf("%q must have single output\n", moduleName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
snapshotPath := filepath.Join(subDir, snapshotFilename)
|
||||||
|
|
||||||
out := vndkSnapshot.Output(snapshotPath)
|
out := vndkSnapshot.Output(snapshotPath)
|
||||||
if out.Input != mod.outputFile.Path() {
|
if out.Input.String() != outputFiles[0].String() {
|
||||||
t.Errorf("The input of VNDK snapshot must be %q, but %q", out.Input.String(), mod.outputFile.String())
|
t.Errorf("The input of VNDK snapshot must be %q, but %q", out.Input.String(), outputFiles[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expected []string) {
|
||||||
|
t.Helper()
|
||||||
|
assertString(t, params.Rule.String(), android.WriteFile.String())
|
||||||
|
actual := strings.FieldsFunc(strings.ReplaceAll(params.Args["content"], "\\n", "\n"), func(r rune) bool { return r == '\n' })
|
||||||
|
assertArrayString(t, actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expected []string) {
|
func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expected []string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
|
vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
|
||||||
actual := strings.FieldsFunc(strings.ReplaceAll(vndkSnapshot.Output(output).Args["content"], "\\n", "\n"), func(r rune) bool { return r == '\n' })
|
checkWriteFileOutput(t, vndkSnapshot.Output(output), expected)
|
||||||
assertArrayString(t, actual, expected)
|
}
|
||||||
|
|
||||||
|
func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module string, expected []string) {
|
||||||
|
t.Helper()
|
||||||
|
vndkLibraries := ctx.ModuleForTests(module, "")
|
||||||
|
output := insertVndkVersion(module, "VER")
|
||||||
|
checkWriteFileOutput(t, vndkLibraries.Output(output), expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndk(t *testing.T) {
|
func TestVndk(t *testing.T) {
|
||||||
|
@ -321,6 +339,21 @@ func TestVndk(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "llndk.libraries.txt",
|
||||||
|
}
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "vndkcore.libraries.txt",
|
||||||
|
}
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "vndksp.libraries.txt",
|
||||||
|
}
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "vndkprivate.libraries.txt",
|
||||||
|
}
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "vndkcorevariant.libraries.txt",
|
||||||
|
}
|
||||||
`, config)
|
`, config)
|
||||||
|
|
||||||
checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "")
|
checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "")
|
||||||
|
@ -346,17 +379,17 @@ func TestVndk(t *testing.T) {
|
||||||
variant := "android_arm64_armv8-a_vendor.VER_shared"
|
variant := "android_arm64_armv8-a_vendor.VER_shared"
|
||||||
variant2nd := "android_arm_armv7-a-neon_vendor.VER_shared"
|
variant2nd := "android_arm_armv7-a-neon_vendor.VER_shared"
|
||||||
|
|
||||||
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLibPath, variant)
|
checkVndkSnapshot(t, ctx, "libvndk", "libvndk.so", vndkCoreLibPath, variant)
|
||||||
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLib2ndPath, variant2nd)
|
checkVndkSnapshot(t, ctx, "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd)
|
||||||
checkVndkSnapshot(t, ctx, "libvndk_sp", vndkSpLibPath, variant)
|
checkVndkSnapshot(t, ctx, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
|
||||||
checkVndkSnapshot(t, ctx, "libvndk_sp", vndkSpLib2ndPath, variant2nd)
|
checkVndkSnapshot(t, ctx, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
|
||||||
|
|
||||||
|
snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs")
|
||||||
|
checkVndkSnapshot(t, ctx, "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "")
|
||||||
|
checkVndkSnapshot(t, ctx, "vndkcore.libraries.txt", "vndkcore.libraries.txt", snapshotConfigsPath, "")
|
||||||
|
checkVndkSnapshot(t, ctx, "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotConfigsPath, "")
|
||||||
|
checkVndkSnapshot(t, ctx, "vndkprivate.libraries.txt", "vndkprivate.libraries.txt", snapshotConfigsPath, "")
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libm.so"})
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk-private.so", "libvndk.so"})
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so"})
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so"})
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", nil)
|
|
||||||
// merged & tagged & filtered-out(libclang_rt)
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||||
"LLNDK: libc.so",
|
"LLNDK: libc.so",
|
||||||
"LLNDK: libdl.so",
|
"LLNDK: libdl.so",
|
||||||
|
@ -371,19 +404,25 @@ func TestVndk(t *testing.T) {
|
||||||
"VNDK-private: libvndk-private.so",
|
"VNDK-private: libvndk-private.so",
|
||||||
"VNDK-private: libvndk_sp_private-x.so",
|
"VNDK-private: libvndk_sp_private-x.so",
|
||||||
})
|
})
|
||||||
checkVndkOutput(t, ctx, "vndk/llndk.libraries.txt", []string{
|
checkVndkLibrariesOutput(t, ctx, "llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libm.so"})
|
||||||
"libc.so", "libdl.so", "libft2.so", "libm.so",
|
checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk-private.so", "libvndk.so"})
|
||||||
})
|
checkVndkLibrariesOutput(t, ctx, "vndkprivate.libraries.txt", []string{"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{
|
checkVndkLibrariesOutput(t, ctx, "vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so"})
|
||||||
"libvndk-private.so", "libvndk.so",
|
checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", nil)
|
||||||
})
|
}
|
||||||
checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{
|
|
||||||
"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so",
|
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
|
||||||
})
|
config := android.TestArchConfig(buildDir, nil)
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so",
|
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
|
||||||
})
|
ctx := testCcWithConfig(t, `
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{})
|
vndk_libraries_txt {
|
||||||
|
name: "llndk.libraries.txt",
|
||||||
|
}`, config)
|
||||||
|
|
||||||
|
module := ctx.ModuleForTests("llndk.libraries.txt", "")
|
||||||
|
entries := android.AndroidMkEntriesForTest(t, config, "", module.Module())
|
||||||
|
assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkUsingCoreVariant(t *testing.T) {
|
func TestVndkUsingCoreVariant(t *testing.T) {
|
||||||
|
@ -422,20 +461,17 @@ func TestVndkUsingCoreVariant(t *testing.T) {
|
||||||
},
|
},
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vndk_libraries_txt {
|
||||||
|
name: "vndkcorevariant.libraries.txt",
|
||||||
|
}
|
||||||
`, config)
|
`, config)
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk2.so"})
|
checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", []string{"libc++.so", "libvndk2.so", "libvndk_sp.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{
|
|
||||||
"libc++.so", "libvndk2.so", "libvndk_sp.so",
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
||||||
config := android.TestArchConfig(buildDir, nil)
|
ctx := testCcNoVndk(t, `
|
||||||
config.TestProductVariables.DeviceVndkVersion = nil
|
|
||||||
config.TestProductVariables.Platform_vndk_version = nil
|
|
||||||
|
|
||||||
ctx := testCcWithConfig(t, `
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libvndk",
|
name: "libvndk",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
@ -444,7 +480,7 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
||||||
},
|
},
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`, config)
|
`)
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||||
"LLNDK: libc.so",
|
"LLNDK: libc.so",
|
||||||
|
|
|
@ -269,6 +269,7 @@ func CreateTestContext(bp string, fs map[string][]byte,
|
||||||
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
|
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
|
||||||
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(VndkPrebuiltSharedFactory))
|
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(VndkPrebuiltSharedFactory))
|
||||||
|
ctx.RegisterModuleType("vndk_libraries_txt", android.ModuleFactoryAdaptor(VndkLibrariesTxtFactory))
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", ImageMutator).Parallel()
|
ctx.BottomUp("image", ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
|
|
217
cc/vndk.go
217
cc/vndk.go
|
@ -27,6 +27,34 @@ import (
|
||||||
"android/soong/cc/config"
|
"android/soong/cc/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
llndkLibrariesTxt = "llndk.libraries.txt"
|
||||||
|
vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
|
||||||
|
vndkSpLibrariesTxt = "vndksp.libraries.txt"
|
||||||
|
vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
|
||||||
|
vndkUsingCoreVariantLibrariesTxt = "vndkcorevariant.libraries.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func VndkLibrariesTxtModules(vndkVersion string) []string {
|
||||||
|
if vndkVersion == "current" {
|
||||||
|
return []string{
|
||||||
|
llndkLibrariesTxt,
|
||||||
|
vndkCoreLibrariesTxt,
|
||||||
|
vndkSpLibrariesTxt,
|
||||||
|
vndkPrivateLibrariesTxt,
|
||||||
|
vndkUsingCoreVariantLibrariesTxt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Snapshot vndks have their own *.libraries.VER.txt files.
|
||||||
|
// Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
|
||||||
|
return []string{
|
||||||
|
insertVndkVersion(llndkLibrariesTxt, vndkVersion),
|
||||||
|
insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion),
|
||||||
|
insertVndkVersion(vndkSpLibrariesTxt, vndkVersion),
|
||||||
|
insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type VndkProperties struct {
|
type VndkProperties struct {
|
||||||
Vndk struct {
|
Vndk struct {
|
||||||
// declared as a VNDK or VNDK-SP module. The vendor variant
|
// declared as a VNDK or VNDK-SP module. The vendor variant
|
||||||
|
@ -360,22 +388,109 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
android.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
||||||
android.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
android.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type vndkLibrariesTxt struct {
|
||||||
|
android.ModuleBase
|
||||||
|
outputFile android.OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ android.PrebuiltEtcModule = &vndkLibrariesTxt{}
|
||||||
|
var _ android.OutputFileProducer = &vndkLibrariesTxt{}
|
||||||
|
|
||||||
|
// vndk_libraries_txt is a special kind of module type in that it name is one of
|
||||||
|
// - llndk.libraries.txt
|
||||||
|
// - vndkcore.libraries.txt
|
||||||
|
// - vndksp.libraries.txt
|
||||||
|
// - vndkprivate.libraries.txt
|
||||||
|
// - vndkcorevariant.libraries.txt
|
||||||
|
// A module behaves like a prebuilt_etc but its content is generated by soong.
|
||||||
|
// By being a soong module, these files can be referenced by other soong modules.
|
||||||
|
// For example, apex_vndk can depend on these files as prebuilt.
|
||||||
|
func VndkLibrariesTxtFactory() android.Module {
|
||||||
|
m := &vndkLibrariesTxt{}
|
||||||
|
android.InitAndroidModule(m)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
func insertVndkVersion(filename string, vndkVersion string) string {
|
||||||
|
if index := strings.LastIndex(filename, "."); index != -1 {
|
||||||
|
return filename[:index] + "." + vndkVersion + filename[index:]
|
||||||
|
}
|
||||||
|
return filename
|
||||||
|
}
|
||||||
|
|
||||||
|
func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
var list []string
|
||||||
|
switch txt.Name() {
|
||||||
|
case llndkLibrariesTxt:
|
||||||
|
for _, filename := range android.SortedStringMapValues(llndkLibraries(ctx.Config())) {
|
||||||
|
if strings.HasPrefix(filename, "libclang_rt.hwasan-") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
list = append(list, filename)
|
||||||
|
}
|
||||||
|
case vndkCoreLibrariesTxt:
|
||||||
|
list = android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
|
||||||
|
case vndkSpLibrariesTxt:
|
||||||
|
list = android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
|
||||||
|
case vndkPrivateLibrariesTxt:
|
||||||
|
list = android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
|
||||||
|
case vndkUsingCoreVariantLibrariesTxt:
|
||||||
|
list = android.SortedStringMapValues(vndkUsingCoreVariantLibraries(ctx.Config()))
|
||||||
|
default:
|
||||||
|
ctx.ModuleErrorf("name(%s) is unknown.", txt.Name())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
filename := insertVndkVersion(txt.Name(), ctx.DeviceConfig().PlatformVndkVersion())
|
||||||
|
txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: android.WriteFile,
|
||||||
|
Output: txt.outputFile,
|
||||||
|
Description: "Writing " + txt.outputFile.String(),
|
||||||
|
Args: map[string]string{
|
||||||
|
"content": strings.Join(list, "\\n"),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
installPath := android.PathForModuleInstall(ctx, "etc")
|
||||||
|
ctx.InstallFile(installPath, filename, txt.outputFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (txt *vndkLibrariesTxt) AndroidMkEntries() android.AndroidMkEntries {
|
||||||
|
return android.AndroidMkEntries{
|
||||||
|
Class: "ETC",
|
||||||
|
OutputFile: android.OptionalPathForPath(txt.outputFile),
|
||||||
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||||
|
func(entries *android.AndroidMkEntries) {
|
||||||
|
entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath {
|
||||||
|
return txt.outputFile
|
||||||
|
}
|
||||||
|
|
||||||
|
func (txt *vndkLibrariesTxt) OutputFiles(tag string) (android.Paths, error) {
|
||||||
|
return android.Paths{txt.outputFile}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (txt *vndkLibrariesTxt) SubDir() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func VndkSnapshotSingleton() android.Singleton {
|
func VndkSnapshotSingleton() android.Singleton {
|
||||||
return &vndkSnapshotSingleton{}
|
return &vndkSnapshotSingleton{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type vndkSnapshotSingleton struct {
|
type vndkSnapshotSingleton struct {
|
||||||
installedLlndkLibraries []string
|
vndkLibrariesFile android.OutputPath
|
||||||
llndkLibrariesFile android.Path
|
vndkSnapshotZipFile android.OptionalPath
|
||||||
vndkSpLibrariesFile android.Path
|
|
||||||
vndkCoreLibrariesFile android.Path
|
|
||||||
vndkPrivateLibrariesFile android.Path
|
|
||||||
vndkCoreVariantLibrariesFile android.Path
|
|
||||||
vndkLibrariesFile android.Path
|
|
||||||
vndkSnapshotZipFile android.OptionalPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
|
@ -650,12 +765,14 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshotOutputs = append(snapshotOutputs,
|
// install *.libraries.txt except vndkcorevariant.libraries.txt
|
||||||
installSnapshotFileFromPath(c.vndkCoreLibrariesFile, filepath.Join(configsDir, "vndkcore.libraries.txt")),
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
installSnapshotFileFromPath(c.vndkPrivateLibrariesFile, filepath.Join(configsDir, "vndkprivate.libraries.txt")),
|
m, ok := module.(*vndkLibrariesTxt)
|
||||||
installSnapshotFileFromPath(c.vndkSpLibrariesFile, filepath.Join(configsDir, "vndksp.libraries.txt")),
|
if !ok || !m.Enabled() || m.Name() == vndkUsingCoreVariantLibrariesTxt {
|
||||||
installSnapshotFileFromPath(c.llndkLibrariesFile, filepath.Join(configsDir, "llndk.libraries.txt")),
|
return
|
||||||
)
|
}
|
||||||
|
snapshotOutputs = append(snapshotOutputs, installSnapshotFileFromPath(m.OutputFile(), filepath.Join(configsDir, m.Name())))
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Dump a map to a list file as:
|
Dump a map to a list file as:
|
||||||
|
@ -737,46 +854,12 @@ func getVndkFileName(m *Module) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) {
|
func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) {
|
||||||
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
|
llndk := android.SortedStringMapValues(llndkLibraries(ctx.Config()))
|
||||||
// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
|
|
||||||
// Therefore, by removing the library here, we cause it to only be installed if libc
|
|
||||||
// depends on it.
|
|
||||||
installedLlndkLibraries := make(map[string]string)
|
|
||||||
for lib, filename := range llndkLibraries(ctx.Config()) {
|
|
||||||
if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
installedLlndkLibraries[lib] = filename
|
|
||||||
}
|
|
||||||
|
|
||||||
installListFile := func(list []string, fileName string) android.Path {
|
|
||||||
out := android.PathForOutput(ctx, "vndk", fileName)
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
|
||||||
Rule: android.WriteFile,
|
|
||||||
Output: out,
|
|
||||||
Description: "Writing " + out.String(),
|
|
||||||
Args: map[string]string{
|
|
||||||
"content": strings.Join(list, "\\n"),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
c.installedLlndkLibraries = android.SortedStringKeys(installedLlndkLibraries)
|
|
||||||
|
|
||||||
llndk := android.SortedStringMapValues(installedLlndkLibraries)
|
|
||||||
vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
|
vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
|
||||||
vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
|
vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
|
||||||
vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
|
vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
|
||||||
vndkcorevariant := android.SortedStringMapValues(vndkUsingCoreVariantLibraries(ctx.Config()))
|
|
||||||
|
|
||||||
c.llndkLibrariesFile = installListFile(llndk, "llndk.libraries.txt")
|
// Build list of vndk libs as merged & tagged & filter-out(libclang_rt):
|
||||||
c.vndkCoreLibrariesFile = installListFile(vndkcore, "vndkcore.libraries.txt")
|
|
||||||
c.vndkSpLibrariesFile = installListFile(vndksp, "vndksp.libraries.txt")
|
|
||||||
c.vndkPrivateLibrariesFile = installListFile(vndkprivate, "vndkprivate.libraries.txt")
|
|
||||||
c.vndkCoreVariantLibrariesFile = installListFile(vndkcorevariant, "vndkcorevariant.libraries.txt")
|
|
||||||
|
|
||||||
// merged & tagged & filtered-out(libclang_rt)
|
|
||||||
// Since each target have different set of libclang_rt.* files,
|
// Since each target have different set of libclang_rt.* files,
|
||||||
// keep the common set of files in vndk.libraries.txt
|
// keep the common set of files in vndk.libraries.txt
|
||||||
var merged []string
|
var merged []string
|
||||||
|
@ -792,32 +875,48 @@ func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.Singleton
|
||||||
merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
|
merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
|
||||||
merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
|
merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
|
||||||
merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
|
merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
|
||||||
c.vndkLibrariesFile = installListFile(merged, "vndk.libraries.txt")
|
c.vndkLibrariesFile = android.PathForOutput(ctx, "vndk", "vndk.libraries.txt")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: android.WriteFile,
|
||||||
|
Output: c.vndkLibrariesFile,
|
||||||
|
Description: "Writing " + c.vndkLibrariesFile.String(),
|
||||||
|
Args: map[string]string{
|
||||||
|
"content": strings.Join(merged, "\\n"),
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *vndkSnapshotSingleton) MakeVars(ctx android.MakeVarsContext) {
|
func (c *vndkSnapshotSingleton) MakeVars(ctx android.MakeVarsContext) {
|
||||||
// Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
|
// Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
|
||||||
// they been moved to an apex.
|
// they been moved to an apex.
|
||||||
movedToApexLlndkLibraries := []string{}
|
movedToApexLlndkLibraries := []string{}
|
||||||
for _, lib := range c.installedLlndkLibraries {
|
for lib := range llndkLibraries(ctx.Config()) {
|
||||||
// Skip bionic libs, they are handled in different manner
|
// Skip bionic libs, they are handled in different manner
|
||||||
if android.DirectlyInAnyApex(¬OnHostContext{}, lib) && !isBionic(lib) {
|
if android.DirectlyInAnyApex(¬OnHostContext{}, lib) && !isBionic(lib) {
|
||||||
movedToApexLlndkLibraries = append(movedToApexLlndkLibraries, lib)
|
movedToApexLlndkLibraries = append(movedToApexLlndkLibraries, lib)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(movedToApexLlndkLibraries, " "))
|
ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(movedToApexLlndkLibraries, " "))
|
||||||
ctx.Strict("LLNDK_LIBRARIES", strings.Join(c.installedLlndkLibraries, " "))
|
|
||||||
|
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
|
||||||
|
// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
|
||||||
|
// Therefore, by removing the library here, we cause it to only be installed if libc
|
||||||
|
// depends on it.
|
||||||
|
installedLlndkLibraries := []string{}
|
||||||
|
for lib := range llndkLibraries(ctx.Config()) {
|
||||||
|
if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
installedLlndkLibraries = append(installedLlndkLibraries, lib)
|
||||||
|
}
|
||||||
|
sort.Strings(installedLlndkLibraries)
|
||||||
|
ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " "))
|
||||||
|
|
||||||
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkCoreLibraries(ctx.Config())), " "))
|
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkCoreLibraries(ctx.Config())), " "))
|
||||||
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(android.SortedStringKeys(vndkSpLibraries(ctx.Config())), " "))
|
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(android.SortedStringKeys(vndkSpLibraries(ctx.Config())), " "))
|
||||||
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkPrivateLibraries(ctx.Config())), " "))
|
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkPrivateLibraries(ctx.Config())), " "))
|
||||||
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(android.SortedStringKeys(vndkUsingCoreVariantLibraries(ctx.Config())), " "))
|
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(android.SortedStringKeys(vndkUsingCoreVariantLibraries(ctx.Config())), " "))
|
||||||
|
|
||||||
ctx.Strict("LLNDK_LIBRARIES_FILE", c.llndkLibrariesFile.String())
|
|
||||||
ctx.Strict("VNDKCORE_LIBRARIES_FILE", c.vndkCoreLibrariesFile.String())
|
|
||||||
ctx.Strict("VNDKSP_LIBRARIES_FILE", c.vndkSpLibrariesFile.String())
|
|
||||||
ctx.Strict("VNDKPRIVATE_LIBRARIES_FILE", c.vndkPrivateLibrariesFile.String())
|
|
||||||
ctx.Strict("VNDKCOREVARIANT_LIBRARIES_FILE", c.vndkCoreVariantLibrariesFile.String())
|
|
||||||
|
|
||||||
ctx.Strict("VNDK_LIBRARIES_FILE", c.vndkLibrariesFile.String())
|
ctx.Strict("VNDK_LIBRARIES_FILE", c.vndkLibrariesFile.String())
|
||||||
ctx.Strict("SOONG_VNDK_SNAPSHOT_ZIP", c.vndkSnapshotZipFile.String())
|
ctx.Strict("SOONG_VNDK_SNAPSHOT_ZIP", c.vndkSnapshotZipFile.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue