diff options
| -rw-r--r-- | android/arch.go | 8 | ||||
| -rw-r--r-- | android/arch_test.go | 85 | ||||
| -rw-r--r-- | android/config.go | 8 | ||||
| -rw-r--r-- | android/variable.go | 4 | ||||
| -rw-r--r-- | apex/androidmk.go | 10 | ||||
| -rw-r--r-- | apex/apex.go | 3 | ||||
| -rw-r--r-- | apex/apex_test.go | 12 | ||||
| -rw-r--r-- | cc/cc.go | 11 | ||||
| -rw-r--r-- | cc/config/global.go | 4 | ||||
| -rw-r--r-- | cc/linker.go | 7 | ||||
| -rw-r--r-- | cc/sdk.go | 1 | ||||
| -rwxr-xr-x | java/app.go | 4 | ||||
| -rw-r--r-- | java/config/config.go | 5 | ||||
| -rw-r--r-- | java/dexpreopt.go | 4 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars.go | 20 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars_test.go | 2 | ||||
| -rw-r--r-- | java/droiddoc.go | 16 | ||||
| -rw-r--r-- | java/hiddenapi_singleton.go | 2 | ||||
| -rw-r--r-- | java/java.go | 11 | ||||
| -rw-r--r-- | java/sdk_test.go | 6 | ||||
| -rw-r--r-- | java/testing.go | 19 | ||||
| -rw-r--r-- | python/androidmk.go | 12 | ||||
| -rw-r--r-- | python/test.go | 4 | ||||
| -rw-r--r-- | rust/library.go | 11 | ||||
| -rw-r--r-- | rust/library_test.go | 14 | ||||
| -rw-r--r-- | rust/test.go | 4 | ||||
| -rw-r--r-- | sdk/java_sdk_test.go | 4 | ||||
| -rw-r--r-- | sh/sh_binary.go | 13 | ||||
| -rw-r--r-- | ui/build/config.go | 1 | ||||
| -rw-r--r-- | ui/build/dumpvars.go | 2 |
30 files changed, 202 insertions, 105 deletions
diff --git a/android/arch.go b/android/arch.go index 08c0256b7..9a5461474 100644 --- a/android/arch.go +++ b/android/arch.go @@ -810,7 +810,7 @@ func GetOsSpecificVariantsOfCommonOSVariant(mctx BaseModuleContext) []Module { // Valid multilib values include: // "both": compile for all Targets supported by the OsClass (generally x86_64 and x86, or arm64 and arm). // "first": compile for only a single preferred Target supported by the OsClass. This is generally x86_64 or arm64, -// but may be arm for a 32-bit only build or a build with TARGET_PREFER_32_BIT=true set. +// but may be arm for a 32-bit only build. // "32": compile for only a single 32-bit Target supported by the OsClass. // "64": compile for only a single 64-bit Target supported by the OsClass. // "common": compile a for a single Target that will work on all Targets suported by the OsClass (for example Java). @@ -1026,6 +1026,7 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc { "Not_windows", "Arm_on_x86", "Arm_on_x86_64", + "Native_bridge", } for _, os := range OsTypeList { targets = append(targets, os.Field) @@ -1413,6 +1414,11 @@ func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { prefix := "target.arm_on_x86_64" m.appendProperties(ctx, genProps, targetProp, field, prefix) } + if os == Android && m.Target().NativeBridge == NativeBridgeEnabled { + field := "Native_bridge" + prefix := "target.native_bridge" + m.appendProperties(ctx, genProps, targetProp, field, prefix) + } } } } diff --git a/android/arch_test.go b/android/arch_test.go index b987d5697..8525b0349 100644 --- a/android/arch_test.go +++ b/android/arch_test.go @@ -383,3 +383,88 @@ func TestArchMutator(t *testing.T) { }) } } + +func TestArchMutatorNativeBridge(t *testing.T) { + bp := ` + // This module is only enabled for x86. + module { + name: "foo", + } + + // This module is enabled for x86 and arm (via native bridge). + module { + name: "bar", + native_bridge_supported: true, + } + + // This module is enabled for arm (native_bridge) only. + module { + name: "baz", + native_bridge_supported: true, + enabled: false, + target: { + native_bridge: { + enabled: true, + } + } + } + ` + + testCases := []struct { + name string + config func(Config) + fooVariants []string + barVariants []string + bazVariants []string + }{ + { + name: "normal", + config: nil, + fooVariants: []string{"android_x86_64_silvermont", "android_x86_silvermont"}, + barVariants: []string{"android_x86_64_silvermont", "android_native_bridge_arm64_armv8-a", "android_x86_silvermont", "android_native_bridge_arm_armv7-a-neon"}, + bazVariants: []string{"android_native_bridge_arm64_armv8-a", "android_native_bridge_arm_armv7-a-neon"}, + }, + } + + enabledVariants := func(ctx *TestContext, name string) []string { + var ret []string + variants := ctx.ModuleVariantsForTests(name) + for _, variant := range variants { + m := ctx.ModuleForTests(name, variant) + if m.Module().Enabled() { + ret = append(ret, variant) + } + } + return ret + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + config := TestArchConfigNativeBridge(buildDir, nil, bp, nil) + + ctx := NewTestArchContext() + ctx.RegisterModuleType("module", archTestModuleFactory) + ctx.Register(config) + if tt.config != nil { + tt.config(config) + } + + _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) + FailIfErrored(t, errs) + _, errs = ctx.PrepareBuildActions(config) + FailIfErrored(t, errs) + + if g, w := enabledVariants(ctx, "foo"), tt.fooVariants; !reflect.DeepEqual(w, g) { + t.Errorf("want foo variants:\n%q\ngot:\n%q\n", w, g) + } + + if g, w := enabledVariants(ctx, "bar"), tt.barVariants; !reflect.DeepEqual(w, g) { + t.Errorf("want bar variants:\n%q\ngot:\n%q\n", w, g) + } + + if g, w := enabledVariants(ctx, "baz"), tt.bazVariants; !reflect.DeepEqual(w, g) { + t.Errorf("want qux variants:\n%q\ngot:\n%q\n", w, g) + } + }) + } +} diff --git a/android/config.go b/android/config.go index 59118ce86..675660ecb 100644 --- a/android/config.go +++ b/android/config.go @@ -732,14 +732,6 @@ func (c *config) Eng() bool { return Bool(c.productVariables.Eng) } -func (c *config) DevicePrefer32BitApps() bool { - return Bool(c.productVariables.DevicePrefer32BitApps) -} - -func (c *config) DevicePrefer32BitExecutables() bool { - return Bool(c.productVariables.DevicePrefer32BitExecutables) -} - func (c *config) DevicePrimaryArchType() ArchType { return c.Targets[Android][0].Arch.ArchType } diff --git a/android/variable.go b/android/variable.go index 3c08405dd..e025ae00c 100644 --- a/android/variable.go +++ b/android/variable.go @@ -272,10 +272,6 @@ type productVariables struct { CoveragePaths []string `json:",omitempty"` CoverageExcludePaths []string `json:",omitempty"` - DevicePrefer32BitApps *bool `json:",omitempty"` - DevicePrefer32BitExecutables *bool `json:",omitempty"` - HostPrefer32BitExecutables *bool `json:",omitempty"` - SanitizeHost []string `json:",omitempty"` SanitizeDevice []string `json:",omitempty"` SanitizeDeviceDiag []string `json:",omitempty"` diff --git a/apex/androidmk.go b/apex/androidmk.go index 1b3a4ba10..774b62d99 100644 --- a/apex/androidmk.go +++ b/apex/androidmk.go @@ -180,13 +180,17 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo } switch fi.class { case javaSharedLib: - javaModule := fi.module.(java.Dependency) // soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise // we will have foo.jar.jar fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".jar")) - fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String()) - fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String()) + if javaModule, ok := fi.module.(java.Dependency); ok { + fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String()) + fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String()) + } else { + fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", fi.builtFile.String()) + fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", fi.builtFile.String()) + } fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String()) fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false") fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") diff --git a/apex/apex.go b/apex/apex.go index 2f7b2e535..d45dd6f0f 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2280,9 +2280,6 @@ func newApexBundle() *apexBundle { module.AddProperties(&module.properties) module.AddProperties(&module.targetProperties) module.AddProperties(&module.overridableProperties) - module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { - return class == android.Device && ctx.Config().DevicePrefer32BitExecutables() - }) android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) android.InitSdkAwareModule(module) diff --git a/apex/apex_test.go b/apex/apex_test.go index d6a5d0909..7bd037481 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -329,7 +329,7 @@ func ensureListEmpty(t *testing.T, result []string) { // Minimal test func TestBasicApex(t *testing.T) { - ctx, _ := testApex(t, ` + ctx, config := testApex(t, ` apex_defaults { name: "myapex-defaults", manifest: ":myapex.manifest", @@ -484,6 +484,16 @@ func TestBasicApex(t *testing.T) { apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule") + // Make sure that Android.mk is created + ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) + data := android.AndroidMkDataForTest(t, config, "", ab) + var builder strings.Builder + data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) + + androidMk := builder.String() + ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n") + ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n") + optFlags := apexRule.Args["opt_flags"] ensureContains(t, optFlags, "--pubkey vendor/foo/devkeys/testkey.avbpubkey") // Ensure that the NOTICE output is being packaged as an asset. @@ -825,15 +825,8 @@ func (c *Module) Init() android.Module { } c.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { - switch class { - case android.Device: - return ctx.Config().DevicePrefer32BitExecutables() - case android.HostCross: - // Windows builds always prefer 32-bit - return true - default: - return false - } + // Windows builds always prefer 32-bit + return class == android.HostCross }) android.InitAndroidArchModule(c, c.hod, c.multilib) android.InitApexModule(c) diff --git a/cc/config/global.go b/cc/config/global.go index 1dd8a2d03..7b651bc84 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -128,8 +128,8 @@ var ( // prebuilts/clang default settings. ClangDefaultBase = "prebuilts/clang/host" - ClangDefaultVersion = "clang-r383902" - ClangDefaultShortVersion = "11.0.1" + ClangDefaultVersion = "clang-r383902b" + ClangDefaultShortVersion = "11.0.2" // Directories with warnings from Android.bp files. WarningAllowedProjects = []string{ diff --git a/cc/linker.go b/cc/linker.go index 57a0c016a..c9cbd9baf 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -177,7 +177,10 @@ type BaseLinkerProperties struct { Version_script *string `android:"path,arch_variant"` // list of static libs that should not be used to build this module - Exclude_static_libs []string + Exclude_static_libs []string `android:"arch_variant"` + + // list of shared libs that should not be used to build this module + Exclude_shared_libs []string `android:"arch_variant"` } func NewBaseLinker(sanitize *sanitize) *baseLinker { @@ -223,6 +226,8 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps { deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...) deps.ReexportGeneratedHeaders = append(deps.ReexportGeneratedHeaders, linker.Properties.Export_generated_headers...) + deps.SharedLibs = removeListFromList(deps.SharedLibs, linker.Properties.Exclude_shared_libs) + deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Exclude_static_libs) deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Exclude_static_libs) if Bool(linker.Properties.Use_version_lib) { @@ -43,6 +43,7 @@ func sdkMutator(ctx android.BottomUpMutatorContext) { if ctx.Config().UnbundledBuild() { modules[0].(*Module).Properties.HideFromMake = true + modules[0].(*Module).Properties.PreventInstall = true } else { modules[1].(*Module).Properties.SdkAndPlatformVariantVisibleToMake = true modules[1].(*Module).Properties.PreventInstall = true diff --git a/java/app.go b/java/app.go index 5c0a83b9d..7a109be56 100755 --- a/java/app.go +++ b/java/app.go @@ -973,10 +973,6 @@ func AndroidAppFactory() android.Module { &module.overridableAppProperties, &module.usesLibrary.usesLibraryProperties) - module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { - return class == android.Device && ctx.Config().DevicePrefer32BitApps() - }) - android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) android.InitOverridableModule(module, &module.appProperties.Overrides) diff --git a/java/config/config.go b/java/config/config.go index edaed2a10..bb5be3aca 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -28,8 +28,9 @@ import ( var ( pctx = android.NewPackageContext("android/soong/java/config") - DefaultBootclasspathLibraries = []string{"core.platform.api.stubs", "core-lambda-stubs"} - DefaultSystemModules = "core-platform-api-stubs-system-modules" + // TODO(b/157640067): Don't depend on the legacy API by default in the long term. + DefaultBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"} + DefaultSystemModules = "legacy-core-platform-api-stubs-system-modules" DefaultLibraries = []string{"ext", "framework"} DefaultLambdaStubsLibrary = "core-lambda-stubs" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar" diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 2911fd9b9..c33415ef6 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -77,10 +77,6 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool { return true } - if ctx.Config().UnbundledBuild() { - return true - } - if d.isTest { return true } diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 9d9383814..41205598e 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -179,15 +179,7 @@ func RegisterDexpreoptBootJarsComponents(ctx android.RegistrationContext) { } func skipDexpreoptBootJars(ctx android.PathContext) bool { - if dexpreopt.GetGlobalConfig(ctx).DisablePreopt { - return true - } - - if ctx.Config().UnbundledBuild() { - return true - } - - return false + return dexpreopt.GetGlobalConfig(ctx).DisablePreopt } type dexpreoptBootJars struct { @@ -340,10 +332,12 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI bootFrameworkProfileRule(ctx, image, missingDeps) updatableBcpPackagesRule(ctx, image, missingDeps) - var allFiles android.Paths + var zipFiles android.Paths for _, variant := range image.variants { files := buildBootImageVariant(ctx, variant, profile, missingDeps) - allFiles = append(allFiles, files.Paths()...) + if variant.target.Os == android.Android { + zipFiles = append(zipFiles, files.Paths()...) + } } if image.zip != nil { @@ -351,8 +345,8 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI rule.Command(). BuiltTool(ctx, "soong_zip"). FlagWithOutput("-o ", image.zip). - FlagWithArg("-C ", image.dir.String()). - FlagWithInputList("-f ", allFiles, " -f ") + FlagWithArg("-C ", image.dir.Join(ctx, android.Android.String()).String()). + FlagWithInputList("-f ", zipFiles, " -f ") rule.Build(pctx, ctx, "zip_"+image.name, "zip "+image.name+" image") } diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index e9704dc2a..9670c7f4b 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -118,7 +118,7 @@ func TestDexpreoptBootZip(t *testing.T) { ctx := android.PathContextForTesting(testConfig(nil, "", nil)) expectedInputs := []string{} - for _, target := range dexpreoptTargets(ctx) { + for _, target := range ctx.Config().Targets[android.Android] { for _, ext := range []string{".art", ".oat", ".vdex"} { for _, jar := range []string{"foo", "bar", "baz"} { expectedInputs = append(expectedInputs, diff --git a/java/droiddoc.go b/java/droiddoc.go index d61c62c60..4c3e11236 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -1424,10 +1424,9 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi rule.HighMem() cmd := rule.Command() - rspFile := "" + var implicitsRsp android.WritablePath if len(implicits) > 0 { - implicitsRsp := android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"implicits.rsp") - rspFile = implicitsRsp.String() + implicitsRsp = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"implicits.rsp") impRule := android.NewRuleBuilder() impCmd := impRule.Command() // A dummy action that copies the ninja generated rsp file to a new location. This allows us to @@ -1454,10 +1453,10 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi inputs = append(inputs, strings.Split(v, ",")...) } cmd.Text((&remoteexec.REParams{ - Labels: map[string]string{"type": "compile", "lang": "java", "compiler": "metalava"}, + Labels: map[string]string{"type": "compile", "lang": "java", "compiler": "metalava", "shallow": "true"}, ExecStrategy: execStrategy, Inputs: inputs, - RSPFile: rspFile, + RSPFile: implicitsRsp.String(), ToolchainInputs: []string{config.JavaCmd(ctx).String()}, Platform: map[string]string{remoteexec.PoolKey: pool}, }).NoVarTemplate(ctx.Config())) @@ -1468,7 +1467,12 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi FlagWithArg("-encoding ", "UTF-8"). FlagWithArg("-source ", javaVersion.String()). FlagWithRspFileInputList("@", srcs). - FlagWithInput("@", srcJarList) + FlagWithInput("@", srcJarList). + FlagWithOutput("--strict-input-files:warn ", android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"violations.txt")) + + if implicitsRsp.String() != "" { + cmd.FlagWithArg("--strict-input-files-exempt ", "@"+implicitsRsp.String()) + } if len(bootclasspath) > 0 { cmd.FlagWithInputList("-bootclasspath ", bootclasspath.Paths(), ":") diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index 2f35798b5..bff591cb0 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -116,7 +116,7 @@ func stubFlagsRule(ctx android.SingletonContext) { // Core Platform API stubs corePlatformStubModules := []string{ - "core.platform.api.stubs", + "legacy.core.platform.api.stubs", } // Allow products to define their own stubs for custom product jars that apps can use. diff --git a/java/java.go b/java/java.go index 77e6a61df..5f8ad034d 100644 --- a/java/java.go +++ b/java/java.go @@ -838,8 +838,9 @@ type linkTypeContext interface { func (m *Module) getLinkType(name string) (ret linkType, stubs bool) { switch name { - case "core.current.stubs", "core.platform.api.stubs", "stub-annotations", - "private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs": + case "core.current.stubs", "legacy.core.platform.api.stubs", "stable.core.platform.api.stubs", + "stub-annotations", "private-stub-annotations-jar", + "core-lambda-stubs", "core-generated-annotation-stubs": return javaCore, true case "android_stubs_current": return javaSdk, true @@ -2762,8 +2763,10 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.maybeStrippedDexJarFile = dexOutputFile - ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), - j.Stem()+".jar", dexOutputFile) + if j.IsForPlatform() { + ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), + j.Stem()+".jar", dexOutputFile) + } } func (j *DexImport) DexJarBuildPath() android.Path { diff --git a/java/sdk_test.go b/java/sdk_test.go index 52d2df552..e5d322c58 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -156,9 +156,9 @@ func TestClasspath(t *testing.T) { { name: "nostdlib system_modules", - properties: `sdk_version: "none", system_modules: "core-platform-api-stubs-system-modules"`, - system: "core-platform-api-stubs-system-modules", - bootclasspath: []string{"core-platform-api-stubs-system-modules-lib"}, + properties: `sdk_version: "none", system_modules: "legacy-core-platform-api-stubs-system-modules"`, + system: "legacy-core-platform-api-stubs-system-modules", + bootclasspath: []string{"legacy-core-platform-api-stubs-system-modules-lib"}, java8classpath: []string{}, }, { diff --git a/java/testing.go b/java/testing.go index faf4d32b4..f993f56b3 100644 --- a/java/testing.go +++ b/java/testing.go @@ -173,7 +173,8 @@ func GatherRequiredDepsForTest() string { "android_module_lib_stubs_current", "android_system_server_stubs_current", "core.current.stubs", - "core.platform.api.stubs", + "legacy.core.platform.api.stubs", + "stable.core.platform.api.stubs", "kotlin-stdlib", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8", @@ -186,7 +187,7 @@ func GatherRequiredDepsForTest() string { name: "%s", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", } `, extra) } @@ -196,7 +197,7 @@ func GatherRequiredDepsForTest() string { name: "framework", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", aidl: { export_include_dirs: ["framework/aidl"], }, @@ -211,7 +212,7 @@ func GatherRequiredDepsForTest() string { name: "android.hidl.base-V1.0-java", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", installable: true, } @@ -219,7 +220,7 @@ func GatherRequiredDepsForTest() string { name: "android.hidl.manager-V1.0-java", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", installable: true, } @@ -227,7 +228,7 @@ func GatherRequiredDepsForTest() string { name: "org.apache.http.legacy", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", installable: true, } @@ -235,7 +236,7 @@ func GatherRequiredDepsForTest() string { name: "android.test.base", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", installable: true, } @@ -243,14 +244,14 @@ func GatherRequiredDepsForTest() string { name: "android.test.mock", srcs: ["a.java"], sdk_version: "none", - system_modules: "core-platform-api-stubs-system-modules", + system_modules: "legacy-core-platform-api-stubs-system-modules", installable: true, } ` systemModules := []string{ "core-current-stubs-system-modules", - "core-platform-api-stubs-system-modules", + "legacy-core-platform-api-stubs-system-modules", } for _, extra := range systemModules { diff --git a/python/androidmk.go b/python/androidmk.go index d293d52a1..247b80dc0 100644 --- a/python/androidmk.go +++ b/python/androidmk.go @@ -66,15 +66,9 @@ func (p *testDecorator) AndroidMk(base *Module, ret *android.AndroidMkData) { fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=", strings.Join(p.binaryDecorator.binaryProperties.Test_suites, " ")) } - // If the test config has an explicit config specified use it. - if p.testProperties.Test_config != nil { - fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=", - *p.testProperties.Test_config) - } else { - if p.testConfig != nil { - fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", - p.testConfig.String()) - } + if p.testConfig != nil { + fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", + p.testConfig.String()) } if !BoolDefault(p.binaryProperties.Auto_gen_config, true) { diff --git a/python/test.go b/python/test.go index f684fd51d..a669c73a6 100644 --- a/python/test.go +++ b/python/test.go @@ -29,11 +29,11 @@ func init() { type TestProperties struct { // the name of the test configuration (for example "AndroidTest.xml") that should be // installed with the module. - Test_config *string `android:"arch_variant"` + Test_config *string `android:"path,arch_variant"` // the name of the test configuration template (for example "AndroidTestTemplate.xml") that // should be installed with the module. - Test_config_template *string `android:"arch_variant"` + Test_config_template *string `android:"path,arch_variant"` } type testDecorator struct { diff --git a/rust/library.go b/rust/library.go index 8aa033c0f..2e5126639 100644 --- a/rust/library.go +++ b/rust/library.go @@ -329,12 +329,21 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { return deps } + +func (library *libraryDecorator) sharedLibFilename(ctx ModuleContext) string { + return library.getStem(ctx) + ctx.toolchain().SharedLibSuffix() +} + func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags { flags.RustFlags = append(flags.RustFlags, "-C metadata="+ctx.baseModuleName()) flags = library.baseCompiler.compilerFlags(ctx, flags) if library.shared() || library.static() { library.includeDirs = append(library.includeDirs, android.PathsForModuleSrc(ctx, library.Properties.Include_dirs)...) } + if library.shared() { + flags.LinkFlags = append(flags.LinkFlags, "-Wl,-soname="+library.sharedLibFilename(ctx)) + } + return flags } @@ -371,7 +380,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa outputs := TransformSrctoStatic(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) library.coverageFile = outputs.coverageFile } else if library.shared() { - fileName := library.getStem(ctx) + ctx.toolchain().SharedLibSuffix() + fileName := library.sharedLibFilename(ctx) outputFile = android.PathForModuleOut(ctx, fileName) outputs := TransformSrctoShared(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) diff --git a/rust/library_test.go b/rust/library_test.go index 9f9f374b9..37dd5414c 100644 --- a/rust/library_test.go +++ b/rust/library_test.go @@ -114,3 +114,17 @@ func TestValidateLibraryStem(t *testing.T) { }`) } + +func TestSharedLibraryFlags(t *testing.T) { + ctx := testRust(t, ` + rust_library_host { + name: "libfoo", + srcs: ["foo.rs"], + crate_name: "foo", + }`) + + libfooShared := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_shared").Output("libfoo.so") + if !strings.Contains(libfooShared.Args["linkFlags"], "-Wl,-soname=libfoo.so") { + t.Errorf("missing expected -Wl,-soname linker flag for libfoo shared lib, linkFlags: %#v", libfooShared.Args["linkFlags"]) + } +} diff --git a/rust/test.go b/rust/test.go index 94568c1cc..10c278597 100644 --- a/rust/test.go +++ b/rust/test.go @@ -25,11 +25,11 @@ import ( type TestProperties struct { // the name of the test configuration (for example "AndroidTest.xml") that should be // installed with the module. - Test_config *string `android:"arch_variant"` + Test_config *string `android:"path,arch_variant"` // the name of the test configuration template (for example "AndroidTestTemplate.xml") that // should be installed with the module. - Test_config_template *string `android:"arch_variant"` + Test_config_template *string `android:"path,arch_variant"` // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go index af792f2e6..56706c7ee 100644 --- a/sdk/java_sdk_test.go +++ b/sdk/java_sdk_test.go @@ -43,10 +43,10 @@ java_system_modules_import { name: "core-current-stubs-system-modules", } java_system_modules_import { - name: "core-platform-api-stubs-system-modules", + name: "legacy-core-platform-api-stubs-system-modules", } java_import { - name: "core.platform.api.stubs", + name: "legacy.core.platform.api.stubs", } java_import { name: "android_stubs_current", diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 9276a62e9..7bb267da2 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -70,7 +70,7 @@ type TestProperties struct { // the name of the test configuration (for example "AndroidTest.xml") that should be // installed with the module. - Test_config *string `android:"arch_variant"` + Test_config *string `android:"path,arch_variant"` // list of files or filegroup modules that provide data that should be installed alongside // the test. @@ -231,12 +231,8 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries { s.customAndroidMkEntries(entries) entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...) - if s.testProperties.Test_config != nil { - entries.SetString("LOCAL_TEST_CONFIG", proptools.String(s.testProperties.Test_config)) - } else { - if s.testConfig != nil { - entries.SetString("LOCAL_FULL_TEST_CONFIG", s.testConfig.String()) - } + if s.testConfig != nil { + entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig) } for _, d := range s.data { rel := d.Rel() @@ -260,9 +256,6 @@ func InitShBinaryModule(s *ShBinary) { // executable binary to <partition>/bin. func ShBinaryFactory() android.Module { module := &ShBinary{} - module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { - return class == android.Device && ctx.Config().DevicePrefer32BitExecutables() - }) InitShBinaryModule(module) android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst) return module diff --git a/ui/build/config.go b/ui/build/config.go index 49f506ef9..c4bbad76f 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -592,6 +592,7 @@ func (c *configImpl) Lunch(ctx Context, product, variant string) { c.environ.Set("TARGET_BUILD_VARIANT", variant) c.environ.Set("TARGET_BUILD_TYPE", "release") c.environ.Unset("TARGET_BUILD_APPS") + c.environ.Unset("TARGET_BUILD_UNBUNDLED") } // Tapas configures the environment to build one or more unbundled apps, diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go index 7dc4915e2..e22985675 100644 --- a/ui/build/dumpvars.go +++ b/ui/build/dumpvars.go @@ -143,6 +143,7 @@ var BannerVars = []string{ "TARGET_BUILD_VARIANT", "TARGET_BUILD_TYPE", "TARGET_BUILD_APPS", + "TARGET_BUILD_UNBUNDLED", "TARGET_ARCH", "TARGET_ARCH_VARIANT", "TARGET_CPU_VARIANT", @@ -187,6 +188,7 @@ func runMakeProductConfig(ctx Context, config Config) { "TARGET_PRODUCT", "TARGET_BUILD_VARIANT", "TARGET_BUILD_APPS", + "TARGET_BUILD_UNBUNDLED", // compiler wrappers set up by make "CC_WRAPPER", |