Merge "Set flag exporter provider for vendor snapshots" am: 4ccc616102
am: b6752c66a1
am: f4c03a96a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1465902 Change-Id: I6cbfc315faf4bf528c931744550060d8504cecf9
This commit is contained in:
@@ -1123,6 +1123,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
srcs: ["libvndk.so"],
|
srcs: ["libvndk.so"],
|
||||||
|
export_include_dirs: ["include/libvndk"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1149,6 +1150,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
shared_libs: ["libvndk"],
|
shared_libs: ["libvndk"],
|
||||||
static_libs: ["libvendor", "libvendor_without_snapshot"],
|
static_libs: ["libvendor", "libvendor_without_snapshot"],
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
|
srcs: ["client.cpp"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_binary {
|
cc_binary {
|
||||||
@@ -1160,6 +1162,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
static_libs: ["libvndk"],
|
static_libs: ["libvndk"],
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
|
srcs: ["bin.cpp"],
|
||||||
}
|
}
|
||||||
|
|
||||||
vendor_snapshot_static {
|
vendor_snapshot_static {
|
||||||
@@ -1170,6 +1173,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "libvndk.a",
|
src: "libvndk.a",
|
||||||
|
export_include_dirs: ["include/libvndk"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1182,6 +1186,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "libvendor.so",
|
src: "libvendor.so",
|
||||||
|
export_include_dirs: ["include/libvendor"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1194,6 +1199,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "libvendor.a",
|
src: "libvendor.a",
|
||||||
|
export_include_dirs: ["include/libvendor"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1213,15 +1219,20 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
depsBp := GatherRequiredDepsForTest(android.Android)
|
depsBp := GatherRequiredDepsForTest(android.Android)
|
||||||
|
|
||||||
mockFS := map[string][]byte{
|
mockFS := map[string][]byte{
|
||||||
"deps/Android.bp": []byte(depsBp),
|
"deps/Android.bp": []byte(depsBp),
|
||||||
"framework/Android.bp": []byte(frameworkBp),
|
"framework/Android.bp": []byte(frameworkBp),
|
||||||
"vendor/Android.bp": []byte(vendorProprietaryBp),
|
"vendor/Android.bp": []byte(vendorProprietaryBp),
|
||||||
"vendor/libvndk.a": nil,
|
"vendor/bin": nil,
|
||||||
"vendor/libvendor.a": nil,
|
"vendor/bin.cpp": nil,
|
||||||
"vendor/libvendor.so": nil,
|
"vendor/client.cpp": nil,
|
||||||
"vendor/bin": nil,
|
"vendor/include/libvndk/a.h": nil,
|
||||||
"vndk/Android.bp": []byte(vndkBp),
|
"vendor/include/libvendor/b.h": nil,
|
||||||
"vndk/libvndk.so": nil,
|
"vendor/libvndk.a": nil,
|
||||||
|
"vendor/libvendor.a": nil,
|
||||||
|
"vendor/libvendor.so": nil,
|
||||||
|
"vndk/Android.bp": []byte(vndkBp),
|
||||||
|
"vndk/include/libvndk/a.h": nil,
|
||||||
|
"vndk/libvndk.so": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
config := TestConfig(buildDir, android.Android, nil, "", mockFS)
|
||||||
@@ -1240,27 +1251,41 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
binaryVariant := "android_vendor.BOARD_arm64_armv8-a"
|
binaryVariant := "android_vendor.BOARD_arm64_armv8-a"
|
||||||
|
|
||||||
// libclient uses libvndk.vndk.BOARD.arm64, libvendor.vendor_static.BOARD.arm64, libvendor_without_snapshot
|
// libclient uses libvndk.vndk.BOARD.arm64, libvendor.vendor_static.BOARD.arm64, libvendor_without_snapshot
|
||||||
libclientLdRule := ctx.ModuleForTests("libclient", sharedVariant).Rule("ld")
|
libclientCcFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("cc").Args["cFlags"]
|
||||||
libclientFlags := libclientLdRule.Args["libFlags"]
|
for _, includeFlags := range []string{
|
||||||
|
"-Ivndk/include/libvndk", // libvndk
|
||||||
|
"-Ivendor/include/libvendor", // libvendor
|
||||||
|
} {
|
||||||
|
if !strings.Contains(libclientCcFlags, includeFlags) {
|
||||||
|
t.Errorf("flags for libclient must contain %#v, but was %#v.",
|
||||||
|
includeFlags, libclientCcFlags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
libclientLdFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("ld").Args["libFlags"]
|
||||||
for _, input := range [][]string{
|
for _, input := range [][]string{
|
||||||
[]string{sharedVariant, "libvndk.vndk.BOARD.arm64"},
|
[]string{sharedVariant, "libvndk.vndk.BOARD.arm64"},
|
||||||
[]string{staticVariant, "libvendor.vendor_static.BOARD.arm64"},
|
[]string{staticVariant, "libvendor.vendor_static.BOARD.arm64"},
|
||||||
[]string{staticVariant, "libvendor_without_snapshot"},
|
[]string{staticVariant, "libvendor_without_snapshot"},
|
||||||
} {
|
} {
|
||||||
outputPaths := getOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */)
|
outputPaths := getOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */)
|
||||||
if !strings.Contains(libclientFlags, outputPaths[0].String()) {
|
if !strings.Contains(libclientLdFlags, outputPaths[0].String()) {
|
||||||
t.Errorf("libflags for libclient must contain %#v, but was %#v", outputPaths[0], libclientFlags)
|
t.Errorf("libflags for libclient must contain %#v, but was %#v", outputPaths[0], libclientLdFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bin_without_snapshot uses libvndk.vendor_static.BOARD.arm64
|
// bin_without_snapshot uses libvndk.vendor_static.BOARD.arm64
|
||||||
binWithoutSnapshotLdRule := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld")
|
binWithoutSnapshotCcFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("cc").Args["cFlags"]
|
||||||
binWithoutSnapshotFlags := binWithoutSnapshotLdRule.Args["libFlags"]
|
if !strings.Contains(binWithoutSnapshotCcFlags, "-Ivendor/include/libvndk") {
|
||||||
|
t.Errorf("flags for bin_without_snapshot must contain %#v, but was %#v.",
|
||||||
|
"-Ivendor/include/libvndk", binWithoutSnapshotCcFlags)
|
||||||
|
}
|
||||||
|
|
||||||
|
binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld").Args["libFlags"]
|
||||||
libVndkStaticOutputPaths := getOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.BOARD.arm64"})
|
libVndkStaticOutputPaths := getOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.BOARD.arm64"})
|
||||||
if !strings.Contains(binWithoutSnapshotFlags, libVndkStaticOutputPaths[0].String()) {
|
if !strings.Contains(binWithoutSnapshotLdFlags, libVndkStaticOutputPaths[0].String()) {
|
||||||
t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v",
|
t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v",
|
||||||
libVndkStaticOutputPaths[0], binWithoutSnapshotFlags)
|
libVndkStaticOutputPaths[0], binWithoutSnapshotLdFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// libvendor.so is installed by libvendor.vendor_shared.BOARD.arm64
|
// libvendor.so is installed by libvendor.vendor_shared.BOARD.arm64
|
||||||
|
@@ -241,6 +241,8 @@ func (p *vendorSnapshotLibraryDecorator) link(ctx ModuleContext,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.libraryDecorator.flagExporter.setProvider(ctx)
|
||||||
|
|
||||||
return in
|
return in
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user