Merge changes I7876b077,Ib2e7d5e6,I7d2d2e02,Ibf5322f8
* changes:
Generate prebuilt_systemserverclasspath_fragment.
Add a new SDK member type java_systemserver_libs.
Add exported_systemserverclasspath_fragments to prebuilt_apex rule.
Add prebuilt_systemserverclasspath_fragment rule.
diff --git a/android/bazel.go b/android/bazel.go
index 86b4e14..737533a 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -178,24 +178,29 @@
"bionic": Bp2BuildDefaultTrueRecursively,
"build/bazel/examples/apex/minimal": Bp2BuildDefaultTrueRecursively,
"development/sdk": Bp2BuildDefaultTrueRecursively,
- "external/gwp_asan": Bp2BuildDefaultTrueRecursively,
+ "external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
"external/brotli": Bp2BuildDefaultTrue,
+ "external/fmtlib": Bp2BuildDefaultTrueRecursively,
+ "external/gwp_asan": Bp2BuildDefaultTrueRecursively,
+ "external/jemalloc_new": Bp2BuildDefaultTrueRecursively,
+ "external/libcap": Bp2BuildDefaultTrueRecursively,
+ "external/libcxx": Bp2BuildDefaultTrueRecursively,
+ "external/libcxxabi": Bp2BuildDefaultTrueRecursively,
+ "external/lz4/lib": Bp2BuildDefaultTrue,
+ "external/protobuf": Bp2BuildDefaultTrueRecursively,
+ "external/python/six": Bp2BuildDefaultTrueRecursively,
+ "external/scudo": Bp2BuildDefaultTrueRecursively,
+ "external/zlib": Bp2BuildDefaultTrueRecursively,
+ "prebuilts/clang/host/linux-x86": Bp2BuildDefaultTrueRecursively,
+ "system/core/libasyncio": Bp2BuildDefaultTrue,
"system/core/libcutils": Bp2BuildDefaultTrueRecursively,
"system/core/libprocessgroup": Bp2BuildDefaultTrue,
"system/core/property_service/libpropertyinfoparser": Bp2BuildDefaultTrueRecursively,
- "system/libbase": Bp2BuildDefaultTrueRecursively,
- "system/logging/liblog": Bp2BuildDefaultTrueRecursively,
- "system/sepolicy/apex": Bp2BuildDefaultTrueRecursively,
- "system/timezone/apex": Bp2BuildDefaultTrueRecursively,
- "system/timezone/output_data": Bp2BuildDefaultTrueRecursively,
- "external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
- "external/fmtlib": Bp2BuildDefaultTrueRecursively,
- "external/jemalloc_new": Bp2BuildDefaultTrueRecursively,
- "external/libcxx": Bp2BuildDefaultTrueRecursively,
- "external/libcxxabi": Bp2BuildDefaultTrueRecursively,
- "external/libcap": Bp2BuildDefaultTrueRecursively,
- "external/scudo": Bp2BuildDefaultTrueRecursively,
- "prebuilts/clang/host/linux-x86": Bp2BuildDefaultTrueRecursively,
+ "system/libbase": Bp2BuildDefaultTrueRecursively,
+ "system/logging/liblog": Bp2BuildDefaultTrueRecursively,
+ "system/sepolicy/apex": Bp2BuildDefaultTrueRecursively,
+ "system/timezone/apex": Bp2BuildDefaultTrueRecursively,
+ "system/timezone/output_data": Bp2BuildDefaultTrueRecursively,
}
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
@@ -231,6 +236,10 @@
"libfdtrack", // depends on liblzma and libbase
+ "libprotobuf-python", // contains .proto sources
+ "libprotobuf-internal-protos", // we don't handle path property for fileegroups
+ "libprotobuf-internal-python-srcs", // we don't handle path property for fileegroups
+
"libseccomp_policy", // depends on libbase
"gwp_asan_crash_handler", // cc_library, ld.lld: error: undefined symbol: memset
@@ -269,6 +278,7 @@
"libseccomp_policy_app_zygote_sources", // http://b/200899432, bazel-built cc_genrule does not work in mixed build when it is a dependency of another soong module.
"libseccomp_policy_app_sources", // http://b/200899432, bazel-built cc_genrule does not work in mixed build when it is a dependency of another soong module.
"libseccomp_policy_system_sources", // http://b/200899432, bazel-built cc_genrule does not work in mixed build when it is a dependency of another soong module.
+
}
// Used for quicker lookups
diff --git a/android/bazel_paths.go b/android/bazel_paths.go
index b5746f7..9957369 100644
--- a/android/bazel_paths.go
+++ b/android/bazel_paths.go
@@ -393,9 +393,19 @@
OutputPath
}
+// ensure BazelOutPath implements Path
var _ Path = BazelOutPath{}
+
+// ensure BazelOutPath implements genPathProvider
+var _ genPathProvider = BazelOutPath{}
+
+// ensure BazelOutPath implements objPathProvider
var _ objPathProvider = BazelOutPath{}
+func (p BazelOutPath) genPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleGenPath {
+ return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
+}
+
func (p BazelOutPath) objPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleObjPath {
return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
diff --git a/apex/builder.go b/apex/builder.go
index 6df40f4..c05c20c 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -824,10 +824,8 @@
a.outputFile = signedCompressedOutputFile
}
- // Install to $OUT/soong/{target,host}/.../apex
- if a.installable() {
- ctx.InstallFile(a.installDir, a.Name()+suffix, a.outputFile)
- }
+ // Install to $OUT/soong/{target,host}/.../apex.
+ ctx.InstallFile(a.installDir, a.Name()+suffix, a.outputFile)
// installed-files.txt is dist'ed
a.installedFilesFile = a.buildInstalledFilesFile(ctx, a.outputFile, imageDir)
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 84c3a86..4c9f579 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -3869,10 +3869,99 @@
}
func TestIncludeDirectoryOrdering(t *testing.T) {
- bp := `
+ baseExpectedFlags := []string{
+ "${config.ArmThumbCflags}",
+ "${config.ArmCflags}",
+ "${config.CommonGlobalCflags}",
+ "${config.DeviceGlobalCflags}",
+ "${config.ExternalCflags}",
+ "${config.ArmToolchainCflags}",
+ "${config.ArmArmv7ANeonCflags}",
+ "${config.ArmGenericCflags}",
+ "-target",
+ "armv7a-linux-androideabi20",
+ "-B${config.ArmGccRoot}/arm-linux-androideabi/bin",
+ }
+
+ expectedIncludes := []string{
+ "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",
+ }
+
+ conly := []string{"-fPIC", "${config.CommonGlobalConlyflags}"}
+ cppOnly := []string{"-fPIC", "${config.CommonGlobalCppflags}", "${config.DeviceGlobalCppflags}", "${config.ArmCppflags}"}
+
+ cflags := []string{"-Wall", "-Werror"}
+ cstd := []string{"-std=gnu99"}
+ cppstd := []string{"-std=gnu++17", "-fno-rtti"}
+
+ lastIncludes := []string{
+ "out/soong/ndk/sysroot/usr/include",
+ "out/soong/ndk/sysroot/usr/include/arm-linux-androideabi",
+ }
+
+ combineSlices := func(slices ...[]string) []string {
+ var ret []string
+ for _, s := range slices {
+ ret = append(ret, s...)
+ }
+ return ret
+ }
+
+ testCases := []struct {
+ name string
+ src string
+ expected []string
+ }{
+ {
+ name: "c",
+ src: "foo.c",
+ expected: combineSlices(baseExpectedFlags, conly, expectedIncludes, cflags, cstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}"}),
+ },
+ {
+ name: "cc",
+ src: "foo.cc",
+ expected: combineSlices(baseExpectedFlags, cppOnly, expectedIncludes, cflags, cppstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}"}),
+ },
+ {
+ name: "assemble",
+ src: "foo.s",
+ expected: combineSlices(baseExpectedFlags, []string{"-D__ASSEMBLY__"}, expectedIncludes, lastIncludes),
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.name, func(t *testing.T) {
+ bp := fmt.Sprintf(`
cc_library {
name: "libfoo",
- srcs: ["foo.c"],
+ srcs: ["%s"],
local_include_dirs: ["local_include_dirs"],
export_include_dirs: ["export_include_dirs"],
export_system_include_dirs: ["export_system_include_dirs"],
@@ -3928,24 +4017,24 @@
sdk_version: "20",
stl: "none",
}
- `
+ `, tc.src)
- libs := []string{
- "libstatic1",
- "libstatic2",
- "libwhole1",
- "libwhole2",
- "libshared1",
- "libshared2",
- "libandroid",
- "libandroid_arm",
- "liblinux",
- "lib32",
- "libarm",
- }
+ libs := []string{
+ "libstatic1",
+ "libstatic2",
+ "libwhole1",
+ "libwhole2",
+ "libshared1",
+ "libshared2",
+ "libandroid",
+ "libandroid_arm",
+ "liblinux",
+ "lib32",
+ "libarm",
+ }
- for _, lib := range libs {
- bp += fmt.Sprintf(`
+ for _, lib := range libs {
+ bp += fmt.Sprintf(`
cc_library {
name: "%s",
export_include_dirs: ["%s"],
@@ -3953,69 +4042,30 @@
stl: "none",
}
`, lib, lib)
+ }
+
+ 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/external/foo/foo.o").Args["cFlags"]
+
+ var includes []string
+ flags := strings.Split(cflags, " ")
+ for _, flag := range flags {
+ if strings.HasPrefix(flag, "-I") {
+ includes = append(includes, strings.TrimPrefix(flag, "-I"))
+ } else if flag == "-isystem" {
+ // skip isystem, include next
+ } else if len(flag) > 0 {
+ includes = append(includes, flag)
+ }
+ }
+
+ android.AssertArrayString(t, "includes", tc.expected, includes)
+ })
}
- 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/external/foo/foo.o").Args["cFlags"]
-
- var includes []string
- flags := strings.Split(cflags, " ")
- for i, flag := range flags {
- if strings.Contains(flag, "Cflags") {
- includes = append(includes, flag)
- } else if strings.HasPrefix(flag, "-I") {
- includes = append(includes, strings.TrimPrefix(flag, "-I"))
- } else if flag == "-isystem" {
- includes = append(includes, flags[i+1])
- }
- }
-
- want := []string{
- "${config.ArmThumbCflags}",
- "${config.ArmCflags}",
- "${config.CommonGlobalCflags}",
- "${config.DeviceGlobalCflags}",
- "${config.ExternalCflags}",
- "${config.ArmToolchainCflags}",
- "${config.ArmArmv7ANeonCflags}",
- "${config.ArmGenericCflags}",
- "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",
- "out/soong/ndk/sysroot/usr/include/arm-linux-androideabi",
- "${config.NoOverrideGlobalCflags}",
- }
-
- android.AssertArrayString(t, "includes", want, includes)
}