diff options
| -rw-r--r-- | android/prebuilt.go | 5 | ||||
| -rw-r--r-- | android/prebuilt_test.go | 3 | ||||
| -rw-r--r-- | apex/apex_test.go | 23 | ||||
| -rw-r--r-- | cc/cc.go | 13 | ||||
| -rw-r--r-- | cc/cc_test.go | 2 | ||||
| -rw-r--r-- | cc/prebuilt_test.go | 5 | ||||
| -rw-r--r-- | cc/testing.go | 35 | ||||
| -rw-r--r-- | dexpreopt/dexpreopt.go | 10 | ||||
| -rw-r--r-- | java/java_test.go | 11 | ||||
| -rw-r--r-- | rust/testing.go | 88 | ||||
| -rw-r--r-- | sdk/testing.go | 20 | ||||
| -rw-r--r-- | sysprop/sysprop_test.go | 12 | ||||
| -rw-r--r-- | ui/build/paths/config.go | 1 |
13 files changed, 52 insertions, 176 deletions
diff --git a/android/prebuilt.go b/android/prebuilt.go index 0ee1201a7..2c99f1f7a 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -25,6 +25,11 @@ import ( // This file implements common functionality for handling modules that may exist as prebuilts, // source, or both. +func RegisterPrebuiltMutators(ctx RegistrationContext) { + ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators) + ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators) +} + type prebuiltDependencyTag struct { blueprint.BaseDependencyTag } diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index 600f0783e..8648b93e2 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -141,8 +141,7 @@ func TestPrebuilts(t *testing.T) { config := TestConfig(buildDir, nil, bp, fs) ctx := NewTestContext() - ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators) - ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators) + RegisterPrebuiltMutators(ctx) ctx.RegisterModuleType("filegroup", FileGroupFactory) ctx.RegisterModuleType("prebuilt", newPrebuiltModule) ctx.RegisterModuleType("source", newSourceModule) diff --git a/apex/apex_test.go b/apex/apex_test.go index 035a553f9..6e547eb5f 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -286,20 +286,13 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory) ctx.RegisterModuleType("override_apex", overrideApexFactory) - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory) ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory) - cc.RegisterPrebuiltBuildComponents(ctx) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("cc_binary", cc.BinaryFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) - ctx.RegisterModuleType("cc_defaults", func() android.Module { - return cc.DefaultsFactory() - }) ctx.RegisterModuleType("cc_test", cc.TestFactory) - ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory) ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory) ctx.RegisterModuleType("sh_binary", android.ShBinaryFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory) @@ -308,23 +301,9 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr java.RegisterAppBuildComponents(ctx) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) - ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() - }) - ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("vndk", cc.VndkMutator).Parallel() - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel() - ctx.BottomUp("version", cc.VersionMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - }) ctx.PreDepsMutators(RegisterPreDepsMutators) ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) ctx.PostDepsMutators(RegisterPostDepsMutators) - ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel() - ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() - }) ctx.Register(config) @@ -33,9 +33,15 @@ import ( ) func init() { - android.RegisterModuleType("cc_defaults", defaultsFactory) + RegisterCCBuildComponents(android.InitRegistrationContext) - android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { + pctx.Import("android/soong/cc/config") +} + +func RegisterCCBuildComponents(ctx android.RegistrationContext) { + ctx.RegisterModuleType("cc_defaults", defaultsFactory) + + ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("vndk", VndkMutator).Parallel() ctx.BottomUp("link", LinkageMutator).Parallel() ctx.BottomUp("ndk_api", NdkApiMutator).Parallel() @@ -45,7 +51,7 @@ func init() { ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel() }) - android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { + ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.TopDown("asan_deps", sanitizerDepsMutator(asan)) ctx.BottomUp("asan", sanitizerMutator(asan)).Parallel() @@ -79,7 +85,6 @@ func init() { }) android.RegisterSingletonType("kythe_extract_all", kytheExtractAllFactory) - pctx.Import("android/soong/cc/config") } type Deps struct { diff --git a/cc/cc_test.go b/cc/cc_test.go index d73dac594..27ff38fb1 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -2478,7 +2478,7 @@ func TestFuzzTarget(t *testing.T) { srcs: ["foo.c"], }`) - variant := "android_arm64_armv8-a" + variant := "android_arm64_armv8-a_fuzzer" ctx.ModuleForTests("fuzz_smoke_test", variant).Rule("cc") } diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go index 658cef0b5..3d809fc3c 100644 --- a/cc/prebuilt_test.go +++ b/cc/prebuilt_test.go @@ -72,11 +72,6 @@ func TestPrebuilt(t *testing.T) { ctx := CreateTestContext() - RegisterPrebuiltBuildComponents(ctx) - - ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) - ctx.PostDepsMutators(android.RegisterPrebuiltsPostDepsMutators) - ctx.Register(config) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) diff --git a/cc/testing.go b/cc/testing.go index 93f27cd41..de4f1ec06 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -18,6 +18,18 @@ import ( "android/soong/android" ) +func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { + RegisterPrebuiltBuildComponents(ctx) + ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) + ctx.RegisterModuleType("cc_library", LibraryFactory) + ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) + ctx.RegisterModuleType("cc_object", ObjectFactory) + + android.RegisterPrebuiltMutators(ctx) + + RegisterCCBuildComponents(ctx) +} + func GatherRequiredDepsForTest(os android.OsType) string { ret := ` toolchain_library { @@ -97,6 +109,14 @@ func GatherRequiredDepsForTest(os android.OsType) string { src: "", } + // Needed for sanitizer + cc_prebuilt_library_shared { + name: "libclang_rt.ubsan_standalone-aarch64-android", + vendor_available: true, + recovery_available: true, + srcs: [""], + } + toolchain_library { name: "libgcc", vendor_available: true, @@ -285,33 +305,20 @@ func TestConfig(buildDir string, os android.OsType, env map[string]string, func CreateTestContext() *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_defaults", defaultsFactory) ctx.RegisterModuleType("cc_binary", BinaryFactory) ctx.RegisterModuleType("cc_binary_host", binaryHostFactory) ctx.RegisterModuleType("cc_fuzz", FuzzFactory) - ctx.RegisterModuleType("cc_library", LibraryFactory) ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory) ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory) ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory) ctx.RegisterModuleType("cc_test", TestFactory) - ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) - ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) ctx.RegisterModuleType("ndk_library", NdkLibraryFactory) ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) - ctx.RegisterModuleType("cc_object", ObjectFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) - ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("link", LinkageMutator).Parallel() - ctx.BottomUp("vndk", VndkMutator).Parallel() - ctx.BottomUp("version", VersionMutator).Parallel() - ctx.BottomUp("begin", BeginMutator).Parallel() - }) - ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.TopDown("double_loadable", checkDoubleLoadableLibraries).Parallel() - }) + RegisterRequiredBuildComponentsForTest(ctx) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go index ee04dfd6d..fc1bae1af 100644 --- a/dexpreopt/dexpreopt.go +++ b/dexpreopt/dexpreopt.go @@ -222,6 +222,14 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul invocationPath := odexPath.ReplaceExtension(ctx, "invocation") + // TODO(skvadrik): fix this to use boot image location in the module config (currently it is broken + // in JIT-zygote builds, because "default" boot image is hard-coded in parts of the module config). + bootImage := module.DexPreoptImages[archIdx] + var bootImageLocation string + if bootImage != nil { + bootImageLocation = PathToLocation(bootImage, arch) + } + // The class loader context using paths in the build var classLoaderContextHost android.Paths @@ -349,7 +357,7 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":"). Flag("${class_loader_context_arg}"). Flag("${stored_class_loader_context_arg}"). - FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()). + FlagWithArg("--boot-image=", bootImageLocation).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()). FlagWithInput("--dex-file=", module.DexPath). FlagWithArg("--dex-location=", dexLocationArg). FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath). diff --git a/java/java_test.go b/java/java_test.go index 1f259627e..096cdb906 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -74,8 +74,6 @@ func testContext() *android.TestContext { RegisterDocsBuildComponents(ctx) RegisterStubsBuildComponents(ctx) RegisterSdkLibraryBuildComponents(ctx) - ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) - ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) RegisterPrebuiltApisBuildComponents(ctx) @@ -85,15 +83,8 @@ func testContext() *android.TestContext { ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory)) // Register module types and mutators from cc needed for JNI testing - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) - ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("ndk_prebuilt_shared_stl", cc.NdkPrebuiltSharedStlFactory) - ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - }) return ctx } diff --git a/rust/testing.go b/rust/testing.go index 1dd16cfd5..f9adec828 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -75,97 +75,19 @@ func GatherRequiredDepsForTest() string { ////////////////////////////// // Device module requirements - toolchain_library { - name: "libgcc", - no_libcrt: true, - nocrt: true, - src: "", - system_shared_libs: [], - } - cc_library { - name: "libc", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_library { - name: "libm", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_library { - name: "libdl", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_object { - name: "crtbegin_dynamic", - } - - cc_object { - name: "crtend_android", - } cc_library { name: "liblog", no_libcrt: true, nocrt: true, system_shared_libs: [], } - - ////////////////////////////// - // cc module requirements - - toolchain_library { - name: "libatomic", - src: "", - } - toolchain_library { - name: "libclang_rt.builtins-aarch64-android", - src: "", - } - toolchain_library { - name: "libgcc_stripped", - src: "", - } - cc_library { - name: "libc++_static", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - cc_library { - name: "libc++demangle", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - host_supported: false, - } - cc_library { - name: "libc++", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - cc_library { - name: "libunwind_llvm", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - ` +` + cc.GatherRequiredDepsForTest(android.NoOsType) return bp } func CreateTestContext() *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("rust_binary", RustBinaryFactory) ctx.RegisterModuleType("rust_binary_host", RustBinaryHostFactory) ctx.RegisterModuleType("rust_test", RustTestFactory) @@ -182,13 +104,7 @@ func CreateTestContext() *android.TestContext { ctx.RegisterModuleType("rust_library_host_static", RustLibraryStaticHostFactory) ctx.RegisterModuleType("rust_proc_macro", ProcMacroFactory) ctx.RegisterModuleType("rust_prebuilt_dylib", PrebuiltDylibFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - // cc mutators - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("version", cc.VersionMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - // rust mutators ctx.BottomUp("rust_libraries", LibraryMutator).Parallel() ctx.BottomUp("rust_unit_tests", TestPerSrcMutator).Parallel() diff --git a/sdk/testing.go b/sdk/testing.go index 61043f30a..eec7f0198 100644 --- a/sdk/testing.go +++ b/sdk/testing.go @@ -68,13 +68,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer) ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer) - ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() - }) - ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel() - ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel() - }) ctx.RegisterModuleType("package", android.PackageFactory) // from java package @@ -83,20 +76,9 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr java.RegisterStubsBuildComponents(ctx) // from cc package - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory) ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) - cc.RegisterPrebuiltBuildComponents(ctx) - ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) - ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("vndk", cc.VndkMutator).Parallel() - ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel() - ctx.BottomUp("version", cc.VersionMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - }) // from apex package ctx.RegisterModuleType("apex", apex.BundleFactory) diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go index d24262dde..0c0f2229e 100644 --- a/sysprop/sysprop_test.go +++ b/sysprop/sysprop_test.go @@ -60,25 +60,15 @@ func testContext(config android.Config) *android.TestContext { java.RegisterAppBuildComponents(ctx) java.RegisterSystemModulesBuildComponents(ctx) - ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) - ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel() }) - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory) ctx.RegisterModuleType("cc_library_static", cc.LibraryFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) - ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("vndk", cc.VndkMutator).Parallel() - ctx.BottomUp("version", cc.VersionMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - ctx.BottomUp("sysprop_cc", cc.SyspropMutator).Parallel() ctx.BottomUp("sysprop_java", java.SyspropMutator).Parallel() }) diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go index 90ff70670..711a9c732 100644 --- a/ui/build/paths/config.go +++ b/ui/build/paths/config.go @@ -94,7 +94,6 @@ var Configuration = map[string]PathConfig{ "patch": Allowed, "pstree": Allowed, "python3": Allowed, - "realpath": Allowed, "rsync": Allowed, "sh": Allowed, "tr": Allowed, |