Merge "Correct isThirdParty check" am: 0f77bb4304

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1769705

Change-Id: Id42ea92cf189fd69daa7687a375546999b7a56e0
This commit is contained in:
Liz Kammer
2021-08-03 15:10:22 +00:00
committed by Automerger Merge Worker
3 changed files with 38 additions and 33 deletions

View File

@@ -3955,10 +3955,13 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
`, lib, lib)
}
ctx := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
ctx := android.GroupFixturePreparers(
PrepareForIntegrationTestWithCc,
android.FixtureAddTextFile("external/foo/Android.bp", bp),
).RunTest(t)
// Use the arm variant instead of the arm64 variant so that it gets headers from
// ndk_libandroid_support to test LateStaticLibs.
cflags := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_sdk_static").Output("obj/foo.o").Args["cFlags"]
cflags := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_sdk_static").Output("obj/external/foo/foo.o").Args["cFlags"]
var includes []string
flags := strings.Split(cflags, " ")
@@ -3981,32 +3984,32 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
"${config.ArmToolchainCflags}",
"${config.ArmArmv7ANeonCflags}",
"${config.ArmGenericCflags}",
"android_arm_export_include_dirs",
"lib32_export_include_dirs",
"arm_export_include_dirs",
"android_export_include_dirs",
"linux_export_include_dirs",
"export_include_dirs",
"android_arm_local_include_dirs",
"lib32_local_include_dirs",
"arm_local_include_dirs",
"android_local_include_dirs",
"linux_local_include_dirs",
"local_include_dirs",
".",
"libheader1",
"libheader2",
"libwhole1",
"libwhole2",
"libstatic1",
"libstatic2",
"libshared1",
"libshared2",
"liblinux",
"libandroid",
"libarm",
"lib32",
"libandroid_arm",
"external/foo/android_arm_export_include_dirs",
"external/foo/lib32_export_include_dirs",
"external/foo/arm_export_include_dirs",
"external/foo/android_export_include_dirs",
"external/foo/linux_export_include_dirs",
"external/foo/export_include_dirs",
"external/foo/android_arm_local_include_dirs",
"external/foo/lib32_local_include_dirs",
"external/foo/arm_local_include_dirs",
"external/foo/android_local_include_dirs",
"external/foo/linux_local_include_dirs",
"external/foo/local_include_dirs",
"external/foo",
"external/foo/libheader1",
"external/foo/libheader2",
"external/foo/libwhole1",
"external/foo/libwhole2",
"external/foo/libstatic1",
"external/foo/libstatic2",
"external/foo/libshared1",
"external/foo/libshared2",
"external/foo/liblinux",
"external/foo/libandroid",
"external/foo/libarm",
"external/foo/lib32",
"external/foo/libandroid_arm",
"defaults/cc/common/ndk_libc++_shared",
"defaults/cc/common/ndk_libandroid_support",
"out/soong/ndk/sysroot/usr/include",

View File

@@ -692,8 +692,9 @@ func isThirdParty(path string) bool {
return false
}
}
return true
}
return true
return false
}
// Properties for rust_bindgen related to generating rust bindings.

View File

@@ -19,23 +19,24 @@ import (
)
func TestIsThirdParty(t *testing.T) {
shouldFail := []string{
thirdPartyPaths := []string{
"external/foo/",
"vendor/bar/",
"hardware/underwater_jaguar/",
}
shouldPass := []string{
nonThirdPartyPaths := []string{
"vendor/google/cts/",
"hardware/google/pixel",
"hardware/interfaces/camera",
"hardware/ril/supa_ril",
"bionic/libc",
}
for _, path := range shouldFail {
for _, path := range thirdPartyPaths {
if !isThirdParty(path) {
t.Errorf("Expected %s to be considered third party", path)
}
}
for _, path := range shouldPass {
for _, path := range nonThirdPartyPaths {
if isThirdParty(path) {
t.Errorf("Expected %s to *not* be considered third party", path)
}