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) `, 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 // Use the arm variant instead of the arm64 variant so that it gets headers from
// ndk_libandroid_support to test LateStaticLibs. // 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 var includes []string
flags := strings.Split(cflags, " ") flags := strings.Split(cflags, " ")
@@ -3981,32 +3984,32 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
"${config.ArmToolchainCflags}", "${config.ArmToolchainCflags}",
"${config.ArmArmv7ANeonCflags}", "${config.ArmArmv7ANeonCflags}",
"${config.ArmGenericCflags}", "${config.ArmGenericCflags}",
"android_arm_export_include_dirs", "external/foo/android_arm_export_include_dirs",
"lib32_export_include_dirs", "external/foo/lib32_export_include_dirs",
"arm_export_include_dirs", "external/foo/arm_export_include_dirs",
"android_export_include_dirs", "external/foo/android_export_include_dirs",
"linux_export_include_dirs", "external/foo/linux_export_include_dirs",
"export_include_dirs", "external/foo/export_include_dirs",
"android_arm_local_include_dirs", "external/foo/android_arm_local_include_dirs",
"lib32_local_include_dirs", "external/foo/lib32_local_include_dirs",
"arm_local_include_dirs", "external/foo/arm_local_include_dirs",
"android_local_include_dirs", "external/foo/android_local_include_dirs",
"linux_local_include_dirs", "external/foo/linux_local_include_dirs",
"local_include_dirs", "external/foo/local_include_dirs",
".", "external/foo",
"libheader1", "external/foo/libheader1",
"libheader2", "external/foo/libheader2",
"libwhole1", "external/foo/libwhole1",
"libwhole2", "external/foo/libwhole2",
"libstatic1", "external/foo/libstatic1",
"libstatic2", "external/foo/libstatic2",
"libshared1", "external/foo/libshared1",
"libshared2", "external/foo/libshared2",
"liblinux", "external/foo/liblinux",
"libandroid", "external/foo/libandroid",
"libarm", "external/foo/libarm",
"lib32", "external/foo/lib32",
"libandroid_arm", "external/foo/libandroid_arm",
"defaults/cc/common/ndk_libc++_shared", "defaults/cc/common/ndk_libc++_shared",
"defaults/cc/common/ndk_libandroid_support", "defaults/cc/common/ndk_libandroid_support",
"out/soong/ndk/sysroot/usr/include", "out/soong/ndk/sysroot/usr/include",

View File

@@ -692,9 +692,10 @@ func isThirdParty(path string) bool {
return false return false
} }
} }
}
return true return true
} }
return false
}
// Properties for rust_bindgen related to generating rust bindings. // Properties for rust_bindgen related to generating rust bindings.
// This exists here so these properties can be included in a cc_default // This exists here so these properties can be included in a cc_default

View File

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