Merge "Add support for the remote execution of metalava actions."
diff --git a/android/apex.go b/android/apex.go
index f9350d1..9056c3d 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -18,6 +18,7 @@
"fmt"
"sort"
"strconv"
+ "strings"
"sync"
"github.com/google/blueprint"
@@ -403,3 +404,85 @@
m.AddProperties(&base.ApexProperties)
}
+
+// A dependency info for a single ApexModule, either direct or transitive.
+type ApexModuleDepInfo struct {
+ // Name of the dependency
+ To string
+ // List of dependencies To belongs to. Includes APEX itself, if a direct dependency.
+ From []string
+ // Whether the dependency belongs to the final compiled APEX.
+ IsExternal bool
+ // min_sdk_version of the ApexModule
+ MinSdkVersion string
+}
+
+// A map of a dependency name to its ApexModuleDepInfo
+type DepNameToDepInfoMap map[string]ApexModuleDepInfo
+
+type ApexBundleDepsInfo struct {
+ minSdkVersion string
+ flatListPath OutputPath
+ fullListPath OutputPath
+}
+
+type ApexDepsInfoIntf interface {
+ MinSdkVersion() string
+ FlatListPath() Path
+ FullListPath() Path
+}
+
+func (d *ApexBundleDepsInfo) MinSdkVersion() string {
+ return d.minSdkVersion
+}
+
+func (d *ApexBundleDepsInfo) FlatListPath() Path {
+ return d.flatListPath
+}
+
+func (d *ApexBundleDepsInfo) FullListPath() Path {
+ return d.fullListPath
+}
+
+var _ ApexDepsInfoIntf = (*ApexBundleDepsInfo)(nil)
+
+// Generate two module out files:
+// 1. FullList with transitive deps and their parents in the dep graph
+// 2. FlatList with a flat list of transitive deps
+func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion string, depInfos DepNameToDepInfoMap) {
+ d.minSdkVersion = minSdkVersion
+
+ var fullContent strings.Builder
+ var flatContent strings.Builder
+
+ fmt.Fprintf(&flatContent, "%s(minSdkVersion:%s):\\n", ctx.ModuleName(), minSdkVersion)
+ for _, key := range FirstUniqueStrings(SortedStringKeys(depInfos)) {
+ info := depInfos[key]
+ toName := fmt.Sprintf("%s(minSdkVersion:%s)", info.To, info.MinSdkVersion)
+ if info.IsExternal {
+ toName = toName + " (external)"
+ }
+ fmt.Fprintf(&fullContent, "%s <- %s\\n", toName, strings.Join(SortedUniqueStrings(info.From), ", "))
+ fmt.Fprintf(&flatContent, " %s\\n", toName)
+ }
+
+ d.fullListPath = PathForModuleOut(ctx, "depsinfo", "fulllist.txt").OutputPath
+ ctx.Build(pctx, BuildParams{
+ Rule: WriteFile,
+ Description: "Full Dependency Info",
+ Output: d.fullListPath,
+ Args: map[string]string{
+ "content": fullContent.String(),
+ },
+ })
+
+ d.flatListPath = PathForModuleOut(ctx, "depsinfo", "flatlist.txt").OutputPath
+ ctx.Build(pctx, BuildParams{
+ Rule: WriteFile,
+ Description: "Flat Dependency Info",
+ Output: d.flatListPath,
+ Args: map[string]string{
+ "content": flatContent.String(),
+ },
+ })
+}
diff --git a/android/config.go b/android/config.go
index c297b05..ee31c10 100644
--- a/android/config.go
+++ b/android/config.go
@@ -906,13 +906,18 @@
return apexJarPair[0], apexJarPair[1]
}
-func (c *config) BootJars() []string {
- jars := c.productVariables.BootJars
- for _, p := range c.productVariables.UpdatableBootJars {
+func GetJarsFromApexJarPairs(apexJarPairs []string) []string {
+ modules := make([]string, len(apexJarPairs))
+ for i, p := range apexJarPairs {
_, jar := SplitApexJarPair(p)
- jars = append(jars, jar)
+ modules[i] = jar
}
- return jars
+ return modules
+}
+
+func (c *config) BootJars() []string {
+ return append(GetJarsFromApexJarPairs(c.productVariables.BootJars),
+ GetJarsFromApexJarPairs(c.productVariables.UpdatableBootJars)...)
}
func (c *config) DexpreoptGlobalConfig(ctx PathContext) ([]byte, error) {
diff --git a/android/defaults.go b/android/defaults.go
index fd707a4..6a908ea 100644
--- a/android/defaults.go
+++ b/android/defaults.go
@@ -176,18 +176,18 @@
defaultsVisibility := module.defaultsVisibility()
module.AddProperties(&base.nameProperties, defaultsVisibility)
- // The defaults_visibility property controls the visibility of a defaults module.
- base.primaryVisibilityProperty =
- newVisibilityProperty("defaults_visibility", &defaultsVisibility.Defaults_visibility)
-
// Unlike non-defaults modules the visibility property is not stored in m.base().commonProperties.
- // Instead it is stored in a separate instance of commonProperties created above so use that.
+ // Instead it is stored in a separate instance of commonProperties created above so clear the
+ // existing list of properties.
+ clearVisibilityProperties(module)
+
+ // The defaults_visibility property controls the visibility of a defaults module so it must be
+ // set as the primary property, which also adds it to the list.
+ setPrimaryVisibilityProperty(module, "defaults_visibility", &defaultsVisibility.Defaults_visibility)
+
// The visibility property needs to be checked (but not parsed) by the visibility module during
- // its checking phase and parsing phase.
- base.visibilityPropertyInfo = []visibilityProperty{
- base.primaryVisibilityProperty,
- newVisibilityProperty("visibility", &commonProperties.Visibility),
- }
+ // its checking phase and parsing phase so add it to the list as a normal property.
+ AddVisibilityProperty(module, "visibility", &commonProperties.Visibility)
base.module = module
}
diff --git a/android/module.go b/android/module.go
index 02b2c89..f5cfe66 100644
--- a/android/module.go
+++ b/android/module.go
@@ -611,10 +611,8 @@
base.customizableProperties = m.GetProperties()
// The default_visibility property needs to be checked and parsed by the visibility module during
- // its checking and parsing phases.
- base.primaryVisibilityProperty =
- newVisibilityProperty("visibility", &base.commonProperties.Visibility)
- base.visibilityPropertyInfo = []visibilityProperty{base.primaryVisibilityProperty}
+ // its checking and parsing phases so make it the primary visibility property.
+ setPrimaryVisibilityProperty(m, "visibility", &base.commonProperties.Visibility)
}
func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
diff --git a/android/mutator.go b/android/mutator.go
index 10a815a..247eb4d 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -81,11 +81,53 @@
var preArch = []RegisterMutatorFunc{
RegisterNamespaceMutator,
+
// Rename package module types.
+ //
+ // The package module type does not have a name property, instead its name is determined
+ // by the location of the containing .bp file relative to the root of the file structure
+ // being built by Soong. Unfortunately, due to limitations in LoadHook the module has to
+ // be given a synthetic temporary name which is then fixed up by these mutators.
RegisterPackageRenamer,
+
+ // Create an association between prebuilt modules and their corresponding source
+ // modules (if any).
RegisterPrebuiltsPreArchMutators,
+
+ // Check the visibility rules are valid.
+ //
+ // This must run after the package renamer mutators so that any issues found during
+ // validation of the package's default_visibility property are reported using the
+ // correct package name and not the synthetic name.
+ //
+ // This must also be run before defaults mutators as the rules for validation are
+ // different before checking the rules than they are afterwards. e.g.
+ // visibility: ["//visibility:private", "//visibility:public"]
+ // would be invalid if specified in a module definition but is valid if it results
+ // from something like this:
+ //
+ // defaults {
+ // name: "defaults",
+ // // Be inaccessible outside a package by default.
+ // visibility: ["//visibility:private"]
+ // }
+ //
+ // defaultable_module {
+ // name: "defaultable_module",
+ // defaults: ["defaults"],
+ // // Override the default.
+ // visibility: ["//visibility:public"]
+ // }
+ //
RegisterVisibilityRuleChecker,
+
+ // Apply properties from defaults modules to the referencing modules.
RegisterDefaultsPreArchMutators,
+
+ // Gather the visibility rules for all modules for us during visibility enforcement.
+ //
+ // This must come after the defaults mutators to ensure that any visibility supplied
+ // in a defaults module has been successfully applied before the rules are gathered.
RegisterVisibilityRuleGatherer,
}
diff --git a/android/package.go b/android/package.go
index 077c4a4..bb5f4e7 100644
--- a/android/package.go
+++ b/android/package.go
@@ -101,10 +101,8 @@
module.AddProperties(&module.properties)
// The default_visibility property needs to be checked and parsed by the visibility module during
- // its checking and parsing phases.
- module.primaryVisibilityProperty =
- newVisibilityProperty("default_visibility", &module.properties.Default_visibility)
- module.visibilityPropertyInfo = []visibilityProperty{module.primaryVisibilityProperty}
+ // its checking and parsing phases so make it the primary visibility property.
+ setPrimaryVisibilityProperty(module, "default_visibility", &module.properties.Default_visibility)
return module
}
diff --git a/android/variable.go b/android/variable.go
index 3b3916e..3c08405 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -49,6 +49,14 @@
Exclude_static_libs []string `android:"arch_variant"`
} `android:"arch_variant"`
+ Malloc_zero_contents struct {
+ Cflags []string `android:"arch_variant"`
+ } `android:"arch_variant"`
+
+ Malloc_pattern_fill_contents struct {
+ Cflags []string `android:"arch_variant"`
+ } `android:"arch_variant"`
+
Safestack struct {
Cflags []string `android:"arch_variant"`
} `android:"arch_variant"`
@@ -210,6 +218,8 @@
Unbundled_build *bool `json:",omitempty"`
Unbundled_build_sdks_from_source *bool `json:",omitempty"`
Malloc_not_svelte *bool `json:",omitempty"`
+ Malloc_zero_contents *bool `json:",omitempty"`
+ Malloc_pattern_fill_contents *bool `json:",omitempty"`
Safestack *bool `json:",omitempty"`
HostStaticBinaries *bool `json:",omitempty"`
Binder32bit *bool `json:",omitempty"`
@@ -376,8 +386,10 @@
AAPTCharacteristics: stringPtr("nosdcard"),
AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"},
- Malloc_not_svelte: boolPtr(true),
- Safestack: boolPtr(false),
+ Malloc_not_svelte: boolPtr(true),
+ Malloc_zero_contents: boolPtr(false),
+ Malloc_pattern_fill_contents: boolPtr(false),
+ Safestack: boolPtr(false),
}
if runtime.GOOS == "linux" {
diff --git a/android/visibility.go b/android/visibility.go
index 3f04123..1e3b91d 100644
--- a/android/visibility.go
+++ b/android/visibility.go
@@ -246,14 +246,8 @@
}
for _, v := range visibility {
- ok, pkg, name := splitRule(v, currentPkg)
+ ok, pkg, name := splitRule(ctx, v, currentPkg, property)
if !ok {
- // Visibility rule is invalid so ignore it. Keep going rather than aborting straight away to
- // ensure all the rules on this module are checked.
- ctx.PropertyErrorf(property,
- "invalid visibility pattern %q must match"+
- " //<package>:<module>, //<package> or :<module>",
- v)
continue
}
@@ -301,21 +295,24 @@
// Parse the visibility rules that control access to the module and store them by id
// for use when enforcing the rules.
- if visibility := m.visibility(); visibility != nil {
- rule := parseRules(ctx, currentPkg, m.visibility())
- if rule != nil {
- moduleToVisibilityRuleMap(ctx.Config()).Store(qualifiedModuleId, rule)
+ primaryProperty := m.base().primaryVisibilityProperty
+ if primaryProperty != nil {
+ if visibility := primaryProperty.getStrings(); visibility != nil {
+ rule := parseRules(ctx, currentPkg, primaryProperty.getName(), visibility)
+ if rule != nil {
+ moduleToVisibilityRuleMap(ctx.Config()).Store(qualifiedModuleId, rule)
+ }
}
}
}
-func parseRules(ctx BaseModuleContext, currentPkg string, visibility []string) compositeRule {
+func parseRules(ctx BaseModuleContext, currentPkg, property string, visibility []string) compositeRule {
rules := make(compositeRule, 0, len(visibility))
hasPrivateRule := false
hasPublicRule := false
hasNonPrivateRule := false
for _, v := range visibility {
- ok, pkg, name := splitRule(v, currentPkg)
+ ok, pkg, name := splitRule(ctx, v, currentPkg, property)
if !ok {
continue
}
@@ -376,10 +373,16 @@
return !isAncestor("vendor", pkg)
}
-func splitRule(ruleExpression string, currentPkg string) (bool, string, string) {
+func splitRule(ctx BaseModuleContext, ruleExpression string, currentPkg, property string) (bool, string, string) {
// Make sure that the rule is of the correct format.
matches := visibilityRuleRegexp.FindStringSubmatch(ruleExpression)
if ruleExpression == "" || matches == nil {
+ // Visibility rule is invalid so ignore it. Keep going rather than aborting straight away to
+ // ensure all the rules on this module are checked.
+ ctx.PropertyErrorf(property,
+ "invalid visibility pattern %q must match"+
+ " //<package>:<module>, //<package> or :<module>",
+ ruleExpression)
return false, "", ""
}
@@ -480,3 +483,28 @@
return rule.Strings()
}
+
+// Clear the default visibility properties so they can be replaced.
+func clearVisibilityProperties(module Module) {
+ module.base().visibilityPropertyInfo = nil
+}
+
+// Add a property that contains visibility rules so that they are checked for
+// correctness.
+func AddVisibilityProperty(module Module, name string, stringsProperty *[]string) {
+ addVisibilityProperty(module, name, stringsProperty)
+}
+
+func addVisibilityProperty(module Module, name string, stringsProperty *[]string) visibilityProperty {
+ base := module.base()
+ property := newVisibilityProperty(name, stringsProperty)
+ base.visibilityPropertyInfo = append(base.visibilityPropertyInfo, property)
+ return property
+}
+
+// Set the primary visibility property.
+//
+// Also adds the property to the list of properties to be validated.
+func setPrimaryVisibilityProperty(module Module, name string, stringsProperty *[]string) {
+ module.base().primaryVisibilityProperty = addVisibilityProperty(module, name, stringsProperty)
+}
diff --git a/apex/apex.go b/apex/apex.go
index 714cf9c..d196e95 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1276,12 +1276,6 @@
return false
}
-type depInfo struct {
- to string
- from []string
- isExternal bool
-}
-
type apexBundle struct {
android.ModuleBase
android.DefaultableModuleBase
@@ -1316,7 +1310,7 @@
requiredDeps []string
// list of module names that this APEX is including (to be shown via *-deps-info target)
- depInfos map[string]depInfo
+ android.ApexBundleDepsInfo
testApex bool
vndkApex bool
@@ -1885,38 +1879,11 @@
if String(a.properties.Min_sdk_version) == "" {
ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well")
}
+
+ a.checkJavaStableSdkVersion(ctx)
}
}
-// Collects the list of module names that directly or indirectly contributes to the payload of this APEX
-func (a *apexBundle) collectDepsInfo(ctx android.ModuleContext) {
- a.depInfos = make(map[string]depInfo)
- a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
- if from.Name() == to.Name() {
- // This can happen for cc.reuseObjTag. We are not interested in tracking this.
- // As soon as the dependency graph crosses the APEX boundary, don't go further.
- return !externalDep
- }
-
- if info, exists := a.depInfos[to.Name()]; exists {
- if !android.InList(from.Name(), info.from) {
- info.from = append(info.from, from.Name())
- }
- info.isExternal = info.isExternal && externalDep
- a.depInfos[to.Name()] = info
- } else {
- a.depInfos[to.Name()] = depInfo{
- to: to.Name(),
- from: []string{from.Name()},
- isExternal: externalDep,
- }
- }
-
- // As soon as the dependency graph crosses the APEX boundary, don't go further.
- return !externalDep
- })
-}
-
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
buildFlattenedAsDefault := ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
switch a.properties.ApexType {
@@ -1955,8 +1922,6 @@
a.checkApexAvailability(ctx)
a.checkUpdatable(ctx)
- a.collectDepsInfo(ctx)
-
handleSpecialLibs := !android.Bool(a.properties.Ignore_system_library_special_case)
// native lib dependencies
@@ -2082,13 +2047,13 @@
// We do not add this variation to `filesInfo`, as it has no output;
// however, we do add the other variations of this module as indirect
// dependencies (see below).
- return true
} else {
// Single-output test module (where `test_per_src: false`).
af := apexFileForExecutable(ctx, ccTest)
af.class = nativeTest
filesInfo = append(filesInfo, af)
}
+ return true // track transitive dependencies
} else {
ctx.PropertyErrorf("tests", "%q is not a cc module", depName)
}
@@ -2274,6 +2239,23 @@
a.buildApexDependencyInfo(ctx)
}
+// Enforce that Java deps of the apex are using stable SDKs to compile
+func (a *apexBundle) checkJavaStableSdkVersion(ctx android.ModuleContext) {
+ // Visit direct deps only. As long as we guarantee top-level deps are using
+ // stable SDKs, java's checkLinkType guarantees correct usage for transitive deps
+ ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) {
+ tag := ctx.OtherModuleDependencyTag(module)
+ switch tag {
+ case javaLibTag, androidAppTag:
+ if m, ok := module.(interface{ CheckStableSdkVersion() error }); ok {
+ if err := m.CheckStableSdkVersion(); err != nil {
+ ctx.ModuleErrorf("cannot depend on \"%v\": %v", ctx.OtherModuleName(module), err)
+ }
+ }
+ }
+ })
+}
+
func whitelistedApexAvailable(apex, moduleName string) bool {
key := apex
moduleName = normalizeModuleName(moduleName)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index dea7a08..ce39b39 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -504,12 +504,19 @@
ensureListContains(t, noticeInputs, "custom_notice")
ensureListContains(t, noticeInputs, "custom_notice_for_static_lib")
- depsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("myapex-deps-info.txt").Args["content"], "\\n")
- ensureListContains(t, depsInfo, "myjar <- myapex")
- ensureListContains(t, depsInfo, "mylib <- myapex")
- ensureListContains(t, depsInfo, "mylib2 <- mylib")
- ensureListContains(t, depsInfo, "myotherjar <- myjar")
- ensureListContains(t, depsInfo, "mysharedjar (external) <- myjar")
+ fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
+ ensureListContains(t, fullDepsInfo, "myjar(minSdkVersion:(no version)) <- myapex")
+ ensureListContains(t, fullDepsInfo, "mylib(minSdkVersion:(no version)) <- myapex")
+ ensureListContains(t, fullDepsInfo, "mylib2(minSdkVersion:(no version)) <- mylib")
+ ensureListContains(t, fullDepsInfo, "myotherjar(minSdkVersion:(no version)) <- myjar")
+ ensureListContains(t, fullDepsInfo, "mysharedjar(minSdkVersion:(no version)) (external) <- myjar")
+
+ flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
+ ensureListContains(t, flatDepsInfo, " myjar(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " mylib(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " mylib2(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " myotherjar(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " mysharedjar(minSdkVersion:(no version)) (external)")
}
func TestDefaults(t *testing.T) {
@@ -818,11 +825,15 @@
// Ensure that libfoo stubs is not linking to libbar (since it is a stubs)
ensureNotContains(t, libFooStubsLdFlags, "libbar.so")
- depsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("myapex2-deps-info.txt").Args["content"], "\\n")
+ fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
+ ensureListContains(t, fullDepsInfo, "mylib(minSdkVersion:(no version)) <- myapex2")
+ ensureListContains(t, fullDepsInfo, "libbaz(minSdkVersion:(no version)) <- mylib")
+ ensureListContains(t, fullDepsInfo, "libfoo(minSdkVersion:(no version)) (external) <- mylib")
- ensureListContains(t, depsInfo, "mylib <- myapex2")
- ensureListContains(t, depsInfo, "libbaz <- mylib")
- ensureListContains(t, depsInfo, "libfoo (external) <- mylib")
+ flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
+ ensureListContains(t, flatDepsInfo, " mylib(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " libbaz(minSdkVersion:(no version))")
+ ensureListContains(t, flatDepsInfo, " libfoo(minSdkVersion:(no version)) (external)")
}
func TestApexWithRuntimeLibsDependency(t *testing.T) {
@@ -1411,6 +1422,122 @@
`)
}
+func TestJavaStableSdkVersion(t *testing.T) {
+ testCases := []struct {
+ name string
+ expectedError string
+ bp string
+ }{
+ {
+ name: "Non-updatable apex with non-stable dep",
+ bp: `
+ apex {
+ name: "myapex",
+ java_libs: ["myjar"],
+ key: "myapex.key",
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ java_library {
+ name: "myjar",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "core_platform",
+ apex_available: ["myapex"],
+ }
+ `,
+ },
+ {
+ name: "Updatable apex with stable dep",
+ bp: `
+ apex {
+ name: "myapex",
+ java_libs: ["myjar"],
+ key: "myapex.key",
+ updatable: true,
+ min_sdk_version: "29",
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ java_library {
+ name: "myjar",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "current",
+ apex_available: ["myapex"],
+ }
+ `,
+ },
+ {
+ name: "Updatable apex with non-stable dep",
+ expectedError: "cannot depend on \"myjar\"",
+ bp: `
+ apex {
+ name: "myapex",
+ java_libs: ["myjar"],
+ key: "myapex.key",
+ updatable: true,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ java_library {
+ name: "myjar",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "core_platform",
+ apex_available: ["myapex"],
+ }
+ `,
+ },
+ {
+ name: "Updatable apex with non-stable transitive dep",
+ expectedError: "compiles against Android API, but dependency \"transitive-jar\" is compiling against non-public Android API.",
+ bp: `
+ apex {
+ name: "myapex",
+ java_libs: ["myjar"],
+ key: "myapex.key",
+ updatable: true,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ java_library {
+ name: "myjar",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "current",
+ apex_available: ["myapex"],
+ static_libs: ["transitive-jar"],
+ }
+ java_library {
+ name: "transitive-jar",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "core_platform",
+ apex_available: ["myapex"],
+ }
+ `,
+ },
+ }
+
+ for _, test := range testCases {
+ t.Run(test.name, func(t *testing.T) {
+ if test.expectedError == "" {
+ testApex(t, test.bp)
+ } else {
+ testApexError(t, test.expectedError, test.bp)
+ }
+ })
+ }
+}
+
func TestFilesInSubDir(t *testing.T) {
ctx, _ := testApex(t, `
apex {
@@ -3145,11 +3272,19 @@
gtest: false,
srcs: ["mytest.cpp"],
relative_install_path: "test",
+ shared_libs: ["mylib"],
system_shared_libs: [],
static_executable: true,
stl: "none",
}
+ cc_library {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ }
+
cc_test {
name: "mytests",
gtest: false,
@@ -3169,8 +3304,9 @@
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
- // Ensure that test dep is copied into apex.
+ // Ensure that test dep (and their transitive dependencies) are copied into apex.
ensureContains(t, copyCmds, "image.apex/bin/test/mytest")
+ ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
// Ensure that test deps built with `test_per_src` are copied into apex.
ensureContains(t, copyCmds, "image.apex/bin/test/mytest1")
@@ -4449,6 +4585,7 @@
java_library {
name: "some-updatable-apex-lib",
srcs: ["a.java"],
+ sdk_version: "current",
apex_available: [
"some-updatable-apex",
],
@@ -4465,12 +4602,14 @@
java_library {
name: "some-platform-lib",
srcs: ["a.java"],
+ sdk_version: "current",
installable: true,
}
java_library {
name: "some-art-lib",
srcs: ["a.java"],
+ sdk_version: "current",
apex_available: [
"com.android.art.something",
],
@@ -4517,68 +4656,68 @@
// updatable jar from ART apex in the ART boot image => ok
transform = func(config *dexpreopt.GlobalConfig) {
- config.ArtApexJars = []string{"some-art-lib"}
+ config.ArtApexJars = []string{"com.android.art.something:some-art-lib"}
}
testNoUpdatableJarsInBootImage(t, "", bp, transform)
// updatable jar from ART apex in the framework boot image => error
error = "module 'some-art-lib' from updatable apex 'com.android.art.something' is not allowed in the framework boot image"
transform = func(config *dexpreopt.GlobalConfig) {
- config.BootJars = []string{"some-art-lib"}
+ config.BootJars = []string{"com.android.art.something:some-art-lib"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// updatable jar from some other apex in the ART boot image => error
error = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the ART boot image"
transform = func(config *dexpreopt.GlobalConfig) {
- config.ArtApexJars = []string{"some-updatable-apex-lib"}
+ config.ArtApexJars = []string{"some-updatable-apex:some-updatable-apex-lib"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// non-updatable jar from some other apex in the ART boot image => error
error = "module 'some-non-updatable-apex-lib' is not allowed in the ART boot image"
transform = func(config *dexpreopt.GlobalConfig) {
- config.ArtApexJars = []string{"some-non-updatable-apex-lib"}
+ config.ArtApexJars = []string{"some-non-updatable-apex:some-non-updatable-apex-lib"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// updatable jar from some other apex in the framework boot image => error
error = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the framework boot image"
transform = func(config *dexpreopt.GlobalConfig) {
- config.BootJars = []string{"some-updatable-apex-lib"}
+ config.BootJars = []string{"some-updatable-apex:some-updatable-apex-lib"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// non-updatable jar from some other apex in the framework boot image => ok
transform = func(config *dexpreopt.GlobalConfig) {
- config.BootJars = []string{"some-non-updatable-apex-lib"}
+ config.BootJars = []string{"some-non-updatable-apex:some-non-updatable-apex-lib"}
}
testNoUpdatableJarsInBootImage(t, "", bp, transform)
// nonexistent jar in the ART boot image => error
error = "failed to find a dex jar path for module 'nonexistent'"
transform = func(config *dexpreopt.GlobalConfig) {
- config.ArtApexJars = []string{"nonexistent"}
+ config.ArtApexJars = []string{"platform:nonexistent"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// nonexistent jar in the framework boot image => error
error = "failed to find a dex jar path for module 'nonexistent'"
transform = func(config *dexpreopt.GlobalConfig) {
- config.BootJars = []string{"nonexistent"}
+ config.BootJars = []string{"platform:nonexistent"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// platform jar in the ART boot image => error
error = "module 'some-platform-lib' is not allowed in the ART boot image"
transform = func(config *dexpreopt.GlobalConfig) {
- config.ArtApexJars = []string{"some-platform-lib"}
+ config.ArtApexJars = []string{"platform:some-platform-lib"}
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// platform jar in the framework boot image => ok
transform = func(config *dexpreopt.GlobalConfig) {
- config.BootJars = []string{"some-platform-lib"}
+ config.BootJars = []string{"platform:some-platform-lib"}
}
testNoUpdatableJarsInBootImage(t, "", bp, transform)
}
diff --git a/apex/builder.go b/apex/builder.go
index fba6b94..ca24f2c 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -688,29 +688,48 @@
return
}
- var content strings.Builder
- for _, key := range android.SortedStringKeys(a.depInfos) {
- info := a.depInfos[key]
- toName := info.to
- if info.isExternal {
- toName = toName + " (external)"
+ depInfos := android.DepNameToDepInfoMap{}
+ a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
+ if from.Name() == to.Name() {
+ // This can happen for cc.reuseObjTag. We are not interested in tracking this.
+ // As soon as the dependency graph crosses the APEX boundary, don't go further.
+ return !externalDep
}
- fmt.Fprintf(&content, "%s <- %s\\n", toName, strings.Join(android.SortedUniqueStrings(info.from), ", "))
- }
- depsInfoFile := android.PathForOutput(ctx, a.Name()+"-deps-info.txt")
- ctx.Build(pctx, android.BuildParams{
- Rule: android.WriteFile,
- Description: "Dependency Info",
- Output: depsInfoFile,
- Args: map[string]string{
- "content": content.String(),
- },
+ if info, exists := depInfos[to.Name()]; exists {
+ if !android.InList(from.Name(), info.From) {
+ info.From = append(info.From, from.Name())
+ }
+ info.IsExternal = info.IsExternal && externalDep
+ depInfos[to.Name()] = info
+ } else {
+ toMinSdkVersion := "(no version)"
+ if m, ok := to.(interface{ MinSdkVersion() string }); ok {
+ if v := m.MinSdkVersion(); v != "" {
+ toMinSdkVersion = v
+ }
+ }
+
+ depInfos[to.Name()] = android.ApexModuleDepInfo{
+ To: to.Name(),
+ From: []string{from.Name()},
+ IsExternal: externalDep,
+ MinSdkVersion: toMinSdkVersion,
+ }
+ }
+
+ // As soon as the dependency graph crosses the APEX boundary, don't go further.
+ return !externalDep
})
+ a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, proptools.String(a.properties.Min_sdk_version), depInfos)
+
ctx.Build(pctx, android.BuildParams{
Rule: android.Phony,
Output: android.PathForPhony(ctx, a.Name()+"-deps-info"),
- Inputs: []android.Path{depsInfoFile},
+ Inputs: []android.Path{
+ a.ApexBundleDepsInfo.FullListPath(),
+ a.ApexBundleDepsInfo.FlatListPath(),
+ },
})
}
diff --git a/apex/vndk.go b/apex/vndk.go
index f948d76..5cc0e2a 100644
--- a/apex/vndk.go
+++ b/apex/vndk.go
@@ -154,10 +154,12 @@
// TODO(b/124106384): Clean up compat symlinks for ART binaries.
if strings.HasPrefix(name, "com.android.art.") {
- artBinaries := []string{"dalvikvm", "dex2oat"}
- for _, b := range artBinaries {
- addSymlink("/apex/com.android.art/bin/"+b, "$(TARGET_OUT)/bin", b)
+ addSymlink("/apex/com.android.art/bin/dalvikvm", "$(TARGET_OUT)/bin", "dalvikvm")
+ dex2oat := "dex2oat32"
+ if ctx.Config().Android64() {
+ dex2oat = "dex2oat64"
}
+ addSymlink("/apex/com.android.art/bin/"+dex2oat, "$(TARGET_OUT)/bin", "dex2oat")
return
}
return
diff --git a/cc/binary_sdk_member.go b/cc/binary_sdk_member.go
index 1d9cc54..88ac513 100644
--- a/cc/binary_sdk_member.go
+++ b/cc/binary_sdk_member.go
@@ -111,7 +111,7 @@
ccModule := variant.(*Module)
p.archType = ccModule.Target().Arch.ArchType.String()
- p.outputFile = ccModule.OutputFile().Path()
+ p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
diff --git a/cc/builder.go b/cc/builder.go
index 2bedd9c..4e8f1fa 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -255,7 +255,11 @@
kytheExtract = pctx.StaticRule("kythe",
blueprint.RuleParams{
Command: `rm -f $out && ` +
- `KYTHE_CORPUS=${kytheCorpus} KYTHE_OUTPUT_FILE=$out KYTHE_VNAMES=$kytheVnames KYTHE_KZIP_ENCODING=${kytheCuEncoding} ` +
+ `KYTHE_CORPUS=${kytheCorpus} ` +
+ `KYTHE_OUTPUT_FILE=$out ` +
+ `KYTHE_VNAMES=$kytheVnames ` +
+ `KYTHE_KZIP_ENCODING=${kytheCuEncoding} ` +
+ `KYTHE_CANONICALIZE_VNAME_PATHS=prefer-relative ` +
`$cxxExtractor $cFlags $in `,
CommandDeps: []string{"$cxxExtractor", "$kytheVnames"},
},
diff --git a/cc/cc.go b/cc/cc.go
index 082816e..49605cc 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -581,6 +581,10 @@
return String(c.Properties.Sdk_version)
}
+func (c *Module) MinSdkVersion() string {
+ return String(c.Properties.Min_sdk_version)
+}
+
func (c *Module) AlwaysSdk() bool {
return c.Properties.AlwaysSdk || Bool(c.Properties.Sdk_variant_only)
}
diff --git a/cc/config/clang.go b/cc/config/clang.go
index bdd9030..24dc6b9 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -48,6 +48,8 @@
"-Wunused-but-set-parameter",
"-Wunused-but-set-variable",
"-fdiagnostics-color",
+ // http://b/153759688
+ "-fuse-init-array",
// arm + arm64
"-fgcse-after-reload",
@@ -113,9 +115,6 @@
// color codes if it is not running in a terminal.
"-fcolor-diagnostics",
- // http://b/68236239 Allow 0/NULL instead of using nullptr everywhere.
- "-Wno-zero-as-null-pointer-constant",
-
// Warnings from clang-7.0
"-Wno-sign-compare",
@@ -166,6 +165,17 @@
"-Wno-int-in-bool-context", // http://b/148287349
"-Wno-sizeof-array-div", // http://b/148815709
"-Wno-tautological-overlap-compare", // http://b/148815696
+ // New warnings to be fixed after clang-r383902.
+ "-Wno-deprecated-copy", // http://b/153746672
+ "-Wno-range-loop-construct", // http://b/153747076
+ "-Wno-misleading-indentation", // http://b/153746954
+ "-Wno-zero-as-null-pointer-constant", // http://b/68236239
+ "-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
+ "-Wno-deprecated-enum-enum-conversion", // http://b/153746563
+ "-Wno-string-compare", // http://b/153764102
+ "-Wno-enum-enum-conversion", // http://b/154138986
+ "-Wno-enum-float-conversion", // http://b/154255917
+ "-Wno-pessimizing-move", // http://b/154270751
}, " "))
// Extra cflags for external third-party projects to disable warnings that
diff --git a/cc/config/global.go b/cc/config/global.go
index f9255be..923dd29 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -128,8 +128,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r377782d"
- ClangDefaultShortVersion = "10.0.6"
+ ClangDefaultVersion = "clang-r383902"
+ ClangDefaultShortVersion = "11.0.1"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/fuzz.go b/cc/fuzz.go
index ebe4252..948595b 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -126,7 +126,7 @@
func collectAllSharedDependencies(ctx android.SingletonContext, module android.Module) android.Paths {
var fringe []android.Module
- seen := make(map[android.Module]bool)
+ seen := make(map[string]bool)
// Enumerate the first level of dependencies, as we discard all non-library
// modules in the BFS loop below.
@@ -140,15 +140,15 @@
for i := 0; i < len(fringe); i++ {
module := fringe[i]
- if seen[module] {
+ if seen[module.Name()] {
continue
}
- seen[module] = true
+ seen[module.Name()] = true
ccModule := module.(*Module)
sharedLibraries = append(sharedLibraries, ccModule.UnstrippedOutputFile())
ctx.VisitDirectDeps(module, func(dep android.Module) {
- if isValidSharedDependency(dep) && !seen[dep] {
+ if isValidSharedDependency(dep) && !seen[dep.Name()] {
fringe = append(fringe, dep)
}
})
@@ -255,13 +255,13 @@
}
// Grab the list of required shared libraries.
- seen := make(map[android.Module]bool)
+ seen := make(map[string]bool)
var sharedLibraries android.Paths
ctx.WalkDeps(func(child, parent android.Module) bool {
- if seen[child] {
+ if seen[child.Name()] {
return false
}
- seen[child] = true
+ seen[child.Name()] = true
if isValidSharedDependency(child) {
sharedLibraries = append(sharedLibraries, child.(*Module).UnstrippedOutputFile())
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 953e85f..2c8e311 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -354,7 +354,7 @@
// If the library has some link types then it produces an output binary file, otherwise it
// is header only.
if !p.memberType.noOutputFiles {
- p.outputFile = ccModule.OutputFile().Path()
+ p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
}
// Separate out the generated include dirs (which are arch specific) from the
@@ -388,6 +388,17 @@
}
}
+func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path {
+ var path android.Path
+ outputFile := ccModule.OutputFile()
+ if outputFile.Valid() {
+ path = outputFile.Path()
+ } else {
+ ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", ccModule)
+ }
+ return path
+}
+
func (p *nativeLibInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
addPossiblyArchSpecificProperties(ctx.SdkModuleContext(), ctx.SnapshotBuilder(), p, propertySet)
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index d32efda..3412c9b 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1041,7 +1041,7 @@
}
// Export the static lib name to make
- if c.static() {
+ if c.static() && c.ExportedToMake() {
if t == cfi {
appendStringSync(c.Name(), cfiStaticLibs(mctx.Config()), &cfiStaticLibsMutex)
} else if t == hwasan {
diff --git a/cc/tidy.go b/cc/tidy.go
index cfb5b68..364e56c 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -121,6 +121,12 @@
// many local projects enable cert-* checks, which
// trigger bugprone-reserved-identifier.
tidyChecks = tidyChecks + ",-bugprone-reserved-identifier*,-cert-dcl51-cpp,-cert-dcl37-c"
+ // http://b/153757728
+ tidyChecks = tidyChecks + ",-readability-qualified-auto"
+ // http://b/155034563
+ tidyChecks = tidyChecks + ",-bugprone-signed-char-misuse"
+ // http://b/155034972
+ tidyChecks = tidyChecks + ",-bugprone-branch-clone"
flags.TidyFlags = append(flags.TidyFlags, tidyChecks)
if len(tidy.Properties.Tidy_checks_as_errors) > 0 {
diff --git a/cmd/path_interposer/main.go b/cmd/path_interposer/main.go
index cd28b96..a4fe3e4 100644
--- a/cmd/path_interposer/main.go
+++ b/cmd/path_interposer/main.go
@@ -53,14 +53,7 @@
os.Exit(1)
}
- disableError := false
- if e, ok := os.LookupEnv("TEMPORARY_DISABLE_PATH_RESTRICTIONS"); ok {
- disableError = e == "1" || e == "y" || e == "yes" || e == "on" || e == "true"
- }
-
exitCode, err := Main(os.Stdout, os.Stderr, interposer, os.Args, mainOpts{
- disableError: disableError,
-
sendLog: paths.SendLog,
config: paths.GetConfig,
lookupParents: lookupParents,
@@ -79,8 +72,6 @@
socket at <interposer>_log.`)
type mainOpts struct {
- disableError bool
-
sendLog func(logSocket string, entry *paths.LogEntry, done chan interface{})
config func(name string) paths.PathConfig
lookupParents func() []paths.LogProcess
@@ -131,7 +122,7 @@
}, waitForLog)
defer func() { <-waitForLog }()
}
- if config.Error && !opts.disableError {
+ if config.Error {
return 1, fmt.Errorf("%q is not allowed to be used. See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.", base)
}
}
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index f984966..f1dde9c 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -82,7 +82,7 @@
if !dexpreoptDisabled(ctx, global, module) {
// Don't preopt individual boot jars, they will be preopted together.
- if !contains(global.BootJars, module.Name) {
+ if !contains(android.GetJarsFromApexJarPairs(global.BootJars), module.Name) {
appImage := (generateProfile || module.ForceCreateAppImage || global.DefaultAppImages) &&
!module.NoCreateAppImage
@@ -113,7 +113,7 @@
// Also preopt system server jars since selinux prevents system server from loading anything from
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
// or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options.
- if global.OnlyPreoptBootImageAndSystemServer && !contains(global.BootJars, module.Name) &&
+ if global.OnlyPreoptBootImageAndSystemServer && !contains(android.GetJarsFromApexJarPairs(global.BootJars), module.Name) &&
!contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk {
return true
}
@@ -566,15 +566,6 @@
return filepath.Join("/apex", apex, "javalib", jar+".jar")
}
-func GetJarsFromApexJarPairs(apexJarPairs []string) []string {
- modules := make([]string, len(apexJarPairs))
- for i, p := range apexJarPairs {
- _, jar := android.SplitApexJarPair(p)
- modules[i] = jar
- }
- return modules
-}
-
var nonUpdatableSystemServerJarsKey = android.NewOnceKey("nonUpdatableSystemServerJars")
// TODO: eliminate the superficial global config parameter by moving global config definition
@@ -582,7 +573,7 @@
func NonUpdatableSystemServerJars(ctx android.PathContext, global *GlobalConfig) []string {
return ctx.Config().Once(nonUpdatableSystemServerJarsKey, func() interface{} {
return android.RemoveListFromList(global.SystemServerJars,
- GetJarsFromApexJarPairs(global.UpdatableSystemServerJars))
+ android.GetJarsFromApexJarPairs(global.UpdatableSystemServerJars))
}).([]string)
}
diff --git a/java/app.go b/java/app.go
index 2fd397a..d25575c 100755
--- a/java/app.go
+++ b/java/app.go
@@ -580,28 +580,14 @@
// Build a final signed app package.
packageFile := android.PathForModuleOut(ctx, a.installApkName+".apk")
- v4SigningRequested := Bool(a.Module.deviceProperties.V4_signature)
- var v4SignatureFile android.WritablePath = nil
- if v4SigningRequested {
- v4SignatureFile = android.PathForModuleOut(ctx, a.installApkName+".apk.idsig")
- }
- CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, v4SignatureFile)
+ CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps)
a.outputFile = packageFile
- if v4SigningRequested {
- a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
- }
for _, split := range a.aapt.splits {
// Sign the split APKs
packageFile := android.PathForModuleOut(ctx, a.installApkName+"_"+split.suffix+".apk")
- if v4SigningRequested {
- v4SignatureFile = android.PathForModuleOut(ctx, a.installApkName+"_"+split.suffix+".apk.idsig")
- }
- CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, v4SignatureFile)
+ CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps)
a.extraOutputFiles = append(a.extraOutputFiles, packageFile)
- if v4SigningRequested {
- a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
- }
}
// Build an app bundle.
@@ -1250,7 +1236,7 @@
}
a.certificate = certificates[0]
signed := android.PathForModuleOut(ctx, "signed", apkFilename)
- SignAppPackage(ctx, signed, dexOutput, certificates, nil)
+ SignAppPackage(ctx, signed, dexOutput, certificates)
a.outputFile = signed
} else {
alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename)
@@ -1406,7 +1392,8 @@
})
android.InitApexModule(module)
- InitJavaModule(module, android.DeviceSupported)
+ android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ android.InitDefaultableModule(module)
android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk")
return module
@@ -1506,7 +1493,7 @@
_, certificates := collectAppDeps(ctx, false, false)
certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx)
signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk")
- SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil)
+ SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates)
r.certificate = certificates[0]
r.outputFile = signed
diff --git a/java/app_builder.go b/java/app_builder.go
index b2780bc..5e7fbe6 100644
--- a/java/app_builder.go
+++ b/java/app_builder.go
@@ -45,7 +45,7 @@
})
func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
- packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath) {
+ packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths) {
unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
@@ -66,10 +66,10 @@
Implicits: deps,
})
- SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile)
+ SignAppPackage(ctx, outputFile, unsignedApk, certificates)
}
-func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath) {
+func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate) {
var certificateArgs []string
var deps android.Paths
@@ -78,22 +78,14 @@
deps = append(deps, c.Pem, c.Key)
}
- outputFiles := android.WritablePaths{signedApk}
- var flag string = ""
- if v4SignatureFile != nil {
- outputFiles = append(outputFiles, v4SignatureFile)
- flag = "--enable-v4"
- }
-
ctx.Build(pctx, android.BuildParams{
Rule: Signapk,
Description: "signapk",
- Outputs: outputFiles,
+ Output: signedApk,
Input: unsignedApk,
Implicits: deps,
Args: map[string]string{
"certificates": strings.Join(certificateArgs, " "),
- "flags": flag,
},
})
}
diff --git a/java/app_test.go b/java/app_test.go
index aae73ca..998c76a 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -1200,66 +1200,6 @@
}
}
-func TestRequestV4SigningFlag(t *testing.T) {
- testCases := []struct {
- name string
- bp string
- expected string
- }{
- {
- name: "default",
- bp: `
- android_app {
- name: "foo",
- srcs: ["a.java"],
- sdk_version: "current",
- }
- `,
- expected: "",
- },
- {
- name: "default",
- bp: `
- android_app {
- name: "foo",
- srcs: ["a.java"],
- sdk_version: "current",
- v4_signature: false,
- }
- `,
- expected: "",
- },
- {
- name: "module certificate property",
- bp: `
- android_app {
- name: "foo",
- srcs: ["a.java"],
- sdk_version: "current",
- v4_signature: true,
- }
- `,
- expected: "--enable-v4",
- },
- }
-
- for _, test := range testCases {
- t.Run(test.name, func(t *testing.T) {
- config := testAppConfig(nil, test.bp, nil)
- ctx := testContext()
-
- run(t, ctx, config)
- foo := ctx.ModuleForTests("foo", "android_common")
-
- signapk := foo.Output("foo.apk")
- signFlags := signapk.Args["flags"]
- if test.expected != signFlags {
- t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expected, signFlags)
- }
- })
- }
-}
-
func TestPackageNameOverride(t *testing.T) {
testCases := []struct {
name string
@@ -2641,3 +2581,62 @@
checkAapt2LinkFlag(t, aapt2Flags, "rename-overlay-target-package", expected.targetPackageFlag)
}
}
+
+func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
+ ctx, config := testJava(t, `
+ java_defaults {
+ name: "rro_defaults",
+ theme: "default_theme",
+ product_specific: true,
+ aaptflags: ["--keep-raw-values"],
+ }
+
+ runtime_resource_overlay {
+ name: "foo_with_defaults",
+ defaults: ["rro_defaults"],
+ }
+
+ runtime_resource_overlay {
+ name: "foo_barebones",
+ }
+ `)
+
+ //
+ // RRO module with defaults
+ //
+ m := ctx.ModuleForTests("foo_with_defaults", "android_common")
+
+ // Check AAPT2 link flags.
+ aapt2Flags := strings.Split(m.Output("package-res.apk").Args["flags"], " ")
+ expectedFlags := []string{"--keep-raw-values", "--no-resource-deduping", "--no-resource-removal"}
+ absentFlags := android.RemoveListFromList(expectedFlags, aapt2Flags)
+ if len(absentFlags) > 0 {
+ t.Errorf("expected values, %q are missing in aapt2 link flags, %q", absentFlags, aapt2Flags)
+ }
+
+ // Check device location.
+ path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ expectedPath := []string{"/tmp/target/product/test_device/product/overlay/default_theme"}
+ if !reflect.DeepEqual(path, expectedPath) {
+ t.Errorf("Unexpected LOCAL_MODULE_PATH value: %q, expected: %q", path, expectedPath)
+ }
+
+ //
+ // RRO module without defaults
+ //
+ m = ctx.ModuleForTests("foo_barebones", "android_common")
+
+ // Check AAPT2 link flags.
+ aapt2Flags = strings.Split(m.Output("package-res.apk").Args["flags"], " ")
+ unexpectedFlags := "--keep-raw-values"
+ if inList(unexpectedFlags, aapt2Flags) {
+ t.Errorf("unexpected value, %q is present in aapt2 link flags, %q", unexpectedFlags, aapt2Flags)
+ }
+
+ // Check device location.
+ path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ expectedPath = []string{"/tmp/target/product/test_device/system/overlay"}
+ if !reflect.DeepEqual(path, expectedPath) {
+ t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
+ }
+}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index c3825cb..dffdc24 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -113,7 +113,7 @@
// Dexpreopt on the boot class path produces multiple files. The first dex file
// is converted into 'name'.art (to match the legacy assumption that 'name'.art
// exists), and the rest are converted to 'name'-<jar>.art.
- m := image.modules[idx]
+ _, m := android.SplitApexJarPair(image.modules[idx])
name := image.stem
if idx != 0 || image.extends != nil {
name += "-" + stemOf(m)
@@ -261,7 +261,7 @@
}
name := ctx.ModuleName(module)
- index := android.IndexList(name, image.modules)
+ index := android.IndexList(name, android.GetJarsFromApexJarPairs(image.modules))
if index == -1 {
return -1, nil
}
@@ -314,13 +314,13 @@
// Ensure all modules were converted to paths
for i := range bootDexJars {
if bootDexJars[i] == nil {
+ _, m := android.SplitApexJarPair(image.modules[i])
if ctx.Config().AllowMissingDependencies() {
- missingDeps = append(missingDeps, image.modules[i])
+ missingDeps = append(missingDeps, m)
bootDexJars[i] = android.PathForOutput(ctx, "missing")
} else {
ctx.Errorf("failed to find a dex jar path for module '%s'"+
- ", note that some jars may be filtered out by module constraints",
- image.modules[i])
+ ", note that some jars may be filtered out by module constraints", m)
}
}
}
@@ -614,7 +614,7 @@
return ctx.Config().Once(updatableBcpPackagesRuleKey, func() interface{} {
global := dexpreopt.GetGlobalConfig(ctx)
- updatableModules := dexpreopt.GetJarsFromApexJarPairs(global.UpdatableBootJars)
+ updatableModules := android.GetJarsFromApexJarPairs(global.UpdatableBootJars)
// Collect `permitted_packages` for updatable boot jars.
var updatablePackages []string
diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go
index 127c201..0946bf0 100644
--- a/java/dexpreopt_bootjars_test.go
+++ b/java/dexpreopt_bootjars_test.go
@@ -48,7 +48,7 @@
pathCtx := android.PathContextForTesting(config)
dexpreoptConfig := dexpreopt.GlobalConfigForTests(pathCtx)
- dexpreoptConfig.BootJars = []string{"foo", "bar", "baz"}
+ dexpreoptConfig.BootJars = []string{"platform:foo", "platform:bar", "platform:baz"}
dexpreopt.SetTestGlobalConfig(config, dexpreoptConfig)
ctx := testContext()
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 066694c..41a2ca7 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -79,7 +79,22 @@
return moduleName
}
-func getDexLocation(ctx android.PathContext, target android.Target, subdir string, name string) string {
+func getDexLocation(ctx android.PathContext, target android.Target, module string) string {
+ apex, jar := android.SplitApexJarPair(module)
+
+ name := stemOf(jar) + ".jar"
+
+ var subdir string
+ if apex == "platform" {
+ // Special apex name "platform" denotes jars do not come from an apex, but are part
+ // of the platform. Such jars are installed on the /system partition on device.
+ subdir = "system/framework"
+ } else if apex == "system_ext" {
+ subdir = "system_ext/framework"
+ } else {
+ subdir = filepath.Join("apex", apex, "javalib")
+ }
+
if target.Os.Class == android.Host {
return filepath.Join(ctx.Config().Getenv("OUT_DIR"), "host", ctx.Config().PrebuiltOS(), subdir, name)
} else {
@@ -104,10 +119,9 @@
artModules := global.ArtApexJars
// With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco.
if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
- artModules = append(artModules, "jacocoagent")
+ artModules = append(artModules, "com.android.art:jacocoagent")
}
- frameworkModules := android.RemoveListFromList(global.BootJars,
- concat(artModules, dexpreopt.GetJarsFromApexJarPairs(global.UpdatableBootJars)))
+ frameworkModules := android.RemoveListFromList(global.BootJars, artModules)
artSubdir := "apex/com.android.art/javalib"
frameworkSubdir := "system/framework"
@@ -150,7 +164,8 @@
// TODO(b/143682396): use module dependencies instead
inputDir := deviceDir.Join(ctx, "dex_"+c.name+"jars_input")
for _, m := range c.modules {
- c.dexPaths = append(c.dexPaths, inputDir.Join(ctx, stemOf(m)+".jar"))
+ _, jar := android.SplitApexJarPair(m)
+ c.dexPaths = append(c.dexPaths, inputDir.Join(ctx, stemOf(jar)+".jar"))
}
c.dexPathsDeps = c.dexPaths
@@ -165,7 +180,7 @@
imagesDeps: c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"),
}
for _, m := range c.modules {
- variant.dexLocations = append(variant.dexLocations, getDexLocation(ctx, target, c.installSubdir, stemOf(m)+".jar"))
+ variant.dexLocations = append(variant.dexLocations, getDexLocation(ctx, target, m))
}
variant.dexLocationsDeps = variant.dexLocations
c.variants = append(c.variants, variant)
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 96102ff..1c46a2b 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1530,20 +1530,37 @@
updatedBaselineOutput := android.PathForModuleOut(ctx, "api_lint_baseline.txt")
d.apiLintTimestamp = android.PathForModuleOut(ctx, "api_lint.timestamp")
+ msg := `` +
+ `************************************************************\n` +
+ `Your API changes are triggering API Lint warnings or errors.\n` +
+ `To make these errors go away, fix the code according to the\n` +
+ `error and/or warning messages above.\n` +
+ `\n` +
+ `If it's not possible to do so, there are workarounds:\n` +
+ `\n` +
+ `1. You can suppress the errors with @SuppressLint(\"<id>\")\n`
+
if baselineFile.Valid() {
cmd.FlagWithInput("--baseline ", baselineFile.Path())
cmd.FlagWithOutput("--update-baseline ", updatedBaselineOutput)
+
+ msg += fmt.Sprintf(``+
+ `2. You can update the baseline by executing the following\n`+
+ ` command:\n`+
+ ` cp \\ \n`+
+ ` \"$PWD/%s\" \\ \n`+
+ ` \"$PWD/%s\" \n`+
+ ` To submit the revised baseline.txt to the main Android\n`+
+ ` repository, you will need approval.\n`, updatedBaselineOutput, baselineFile.Path())
+ } else {
+ msg += fmt.Sprintf(``+
+ `2. You can add a baseline file of existing lint failures\n`+
+ ` to the build rule of %s.\n`, d.Name())
}
+ msg += `************************************************************\n`
zipSyncCleanupCmd(rule, srcJarDir)
- msg := fmt.Sprintf(`\n******************************\n`+
- `Your API changes are triggering API Lint warnings or errors.\n\n`+
- `To make these errors go away, you have two choices:\n`+
- ` 1. You can suppress the errors with @SuppressLint(\"<id>\").\n\n`+
- ` 2. You can update the baseline by executing the following command:\n`+
- ` cp \"$PWD/%s\" \"$PWD/%s\"\n\n`+
- `******************************\n`, updatedBaselineOutput, baselineFile.Path())
rule.Command().
Text("touch").Output(d.apiLintTimestamp).
Text(") || (").
diff --git a/java/java.go b/java/java.go
index 38f485e..472d3da 100644
--- a/java/java.go
+++ b/java/java.go
@@ -86,6 +86,14 @@
ctx.RegisterSingletonType("kythe_java_extract", kytheExtractJavaFactory)
}
+func (j *Module) CheckStableSdkVersion() error {
+ sdkVersion := j.sdkVersion()
+ if sdkVersion.stable() {
+ return nil
+ }
+ return fmt.Errorf("non stable SDK %v", sdkVersion)
+}
+
func (j *Module) checkSdkVersions(ctx android.ModuleContext) {
if j.SocSpecific() || j.DeviceSpecific() ||
(j.ProductSpecific() && ctx.Config().EnforceProductPartitionInterface()) {
@@ -337,10 +345,6 @@
UncompressDex bool `blueprint:"mutated"`
IsSDKLibrary bool `blueprint:"mutated"`
-
- // If true, generate the signature file of APK Signing Scheme V4, along side the signed APK file.
- // Defaults to false.
- V4_signature *bool
}
func (me *CompilerDeviceProperties) EffectiveOptimizeEnabled() bool {
@@ -596,6 +600,10 @@
return j.sdkVersion()
}
+func (j *Module) MinSdkVersion() string {
+ return j.minSdkVersion().version.String()
+}
+
func (j *Module) AvailableFor(what string) bool {
if what == android.AvailableToPlatform && Bool(j.deviceProperties.Hostdex) {
// Exception: for hostdex: true libraries, the platform variant is created
@@ -2394,6 +2402,10 @@
return j.sdkVersion()
}
+func (j *Import) MinSdkVersion() string {
+ return j.minSdkVersion().version.String()
+}
+
func (j *Import) Prebuilt() *android.Prebuilt {
return &j.prebuilt
}
@@ -2754,6 +2766,7 @@
&sdkLibraryProperties{},
&DexImportProperties{},
&android.ApexProperties{},
+ &RuntimeResourceOverlayProperties{},
)
android.InitDefaultsModule(module)
diff --git a/java/prebuilt_apis.go b/java/prebuilt_apis.go
index 86eddb1..03bc76b 100644
--- a/java/prebuilt_apis.go
+++ b/java/prebuilt_apis.go
@@ -59,7 +59,7 @@
apiver = elements[0]
scope = elements[1]
- if scope != "public" && scope != "system" && scope != "test" {
+ if scope != "public" && scope != "system" && scope != "test" && scope != "module-lib" && scope != "system-server" {
ctx.ModuleErrorf("invalid scope %q found in path: %q", scope, path)
return
}
@@ -100,7 +100,7 @@
mydir := mctx.ModuleDir() + "/"
var files []string
for _, apiver := range mctx.Module().(*prebuiltApis).properties.Api_dirs {
- for _, scope := range []string{"public", "system", "test", "core"} {
+ for _, scope := range []string{"public", "system", "test", "core", "module-lib", "system-server"} {
vfiles, err := mctx.GlobWithDeps(mydir+apiver+"/"+scope+"/"+name, nil)
if err != nil {
mctx.ModuleErrorf("failed to glob %s files under %q: %s", name, mydir+apiver+"/"+scope, err)
diff --git a/java/sdk.go b/java/sdk.go
index 92076f4..690451c 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -169,9 +169,12 @@
return false
}
switch s.kind {
+ case sdkNone:
+ // there is nothing to manage and version in this case; de facto stable API.
+ return true
case sdkCore, sdkPublic, sdkSystem, sdkModule, sdkSystemServer:
return true
- case sdkNone, sdkCorePlatform, sdkTest, sdkPrivate:
+ case sdkCorePlatform, sdkTest, sdkPrivate:
return false
default:
panic(fmt.Errorf("unknown sdkKind=%v", s.kind))
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 9e3ad5b..d70f632 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -90,6 +90,9 @@
// Extra arguments to pass to droidstubs for this scope.
droidstubsArgs []string
+
+ // Whether the api scope can be treated as unstable, and should skip compat checks.
+ unstable bool
}
// Initialize a scope, creating and adding appropriate dependency tags
@@ -142,6 +145,7 @@
moduleSuffix: sdkTestApiSuffix,
sdkVersion: "test_current",
droidstubsArgs: []string{"-showAnnotation android.annotation.TestApi"},
+ unstable: true,
})
allApiScopes = apiScopes{
apiScopePublic,
@@ -560,12 +564,14 @@
props.Check_api.Current.Api_file = proptools.StringPtr(currentApiFileName)
props.Check_api.Current.Removed_api_file = proptools.StringPtr(removedApiFileName)
- // check against the latest released API
- props.Check_api.Last_released.Api_file = proptools.StringPtr(
- module.latestApiFilegroupName(apiScope))
- props.Check_api.Last_released.Removed_api_file = proptools.StringPtr(
- module.latestRemovedApiFilegroupName(apiScope))
- props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true)
+ if !apiScope.unstable {
+ // check against the latest released API
+ props.Check_api.Last_released.Api_file = proptools.StringPtr(
+ module.latestApiFilegroupName(apiScope))
+ props.Check_api.Last_released.Removed_api_file = proptools.StringPtr(
+ module.latestRemovedApiFilegroupName(apiScope))
+ props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true)
+ }
// Dist the api txt artifact for sdk builds.
if !Bool(module.sdkLibraryProperties.No_dist) {
diff --git a/rust/builder.go b/rust/builder.go
index 27eeec2..2d5e602 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -108,8 +108,8 @@
}
// TODO once we have static libraries in the host prebuilt .bp, this
// should be unconditionally added.
- if !ctx.Host() {
- // If we're on a device build, do not use an implicit sysroot
+ if !(ctx.Host() && ctx.TargetPrimary()) {
+ // If we're not targeting the host primary arch, do not use an implicit sysroot
rustcFlags = append(rustcFlags, "--sysroot=/dev/null")
}
// Collect linker flags
diff --git a/rust/compiler.go b/rust/compiler.go
index 81b258c..7499776 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -183,8 +183,8 @@
if !Bool(compiler.Properties.No_stdlibs) {
for _, stdlib := range config.Stdlibs {
- // If we're building for host, use the compiler's stdlibs
- if ctx.Host() {
+ // If we're building for the primary host target, use the compiler's stdlibs
+ if ctx.Host() && ctx.TargetPrimary() {
stdlib = stdlib + "_" + ctx.toolchain().RustTriple()
}
@@ -192,9 +192,12 @@
// static linking is the default, if one of our static
// dependencies uses a dynamic library, we need to dynamically
// link the stdlib as well.
- if (len(deps.Dylibs) > 0) || (!ctx.Host()) {
+ if (len(deps.Dylibs) > 0) || ctx.Device() {
// Dynamically linked stdlib
deps.Dylibs = append(deps.Dylibs, stdlib)
+ } else if ctx.Host() && !ctx.TargetPrimary() {
+ // Otherwise use the static in-tree stdlib for host secondary arch
+ deps.Rlibs = append(deps.Rlibs, stdlib+".static")
}
}
}
diff --git a/rust/compiler_test.go b/rust/compiler_test.go
index bbf9f8d..bcde757 100644
--- a/rust/compiler_test.go
+++ b/rust/compiler_test.go
@@ -74,3 +74,33 @@
host_supported: true,
}`)
}
+
+func TestInstallDir(t *testing.T) {
+ ctx := testRust(t, `
+ rust_library_dylib {
+ name: "libfoo",
+ srcs: ["foo.rs"],
+ crate_name: "foo",
+ }
+ rust_binary {
+ name: "fizzbuzz",
+ srcs: ["foo.rs"],
+ }`)
+
+ install_path_lib64 := ctx.ModuleForTests("libfoo",
+ "android_arm64_armv8-a_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
+ install_path_lib32 := ctx.ModuleForTests("libfoo",
+ "android_arm_armv7-a-neon_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
+ install_path_bin := ctx.ModuleForTests("fizzbuzz",
+ "android_arm64_armv8-a").Module().(*Module).compiler.(*binaryDecorator).path.String()
+
+ if !strings.HasSuffix(install_path_lib64, "system/lib64/libfoo.dylib.so") {
+ t.Fatalf("unexpected install path for 64-bit library: %#v", install_path_lib64)
+ }
+ if !strings.HasSuffix(install_path_lib32, "system/lib/libfoo.dylib.so") {
+ t.Fatalf("unexpected install path for 32-bit library: %#v", install_path_lib32)
+ }
+ if !strings.HasSuffix(install_path_bin, "system/bin/fizzbuzz") {
+ t.Fatalf("unexpected install path for binary: %#v", install_path_bin)
+ }
+}
diff --git a/rust/config/arm_device.go b/rust/config/arm_device.go
index aedb42b..ac2580b 100644
--- a/rust/config/arm_device.go
+++ b/rust/config/arm_device.go
@@ -50,7 +50,7 @@
}
type toolchainArm struct {
- toolchain64Bit
+ toolchain32Bit
toolchainRustFlags string
}
diff --git a/rust/config/global.go b/rust/config/global.go
index c0bd0f2..63624c0 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.42.0"
+ RustDefaultVersion = "1.43.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
diff --git a/rust/library.go b/rust/library.go
index bf863bb..87e816d 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -281,7 +281,7 @@
}
func NewRustLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
- module := newModule(hod, android.MultilibFirst)
+ module := newModule(hod, android.MultilibBoth)
library := &libraryDecorator{
MutatedProperties: LibraryMutatedProperties{
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 02b190f..32eddc1 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -240,7 +240,7 @@
rust_binary {
name: "fizz-buzz",
srcs: ["foo.rs"],
- no_stdlibs: true,
+ no_stdlibs: true,
}`)
module := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Module().(*Module)
@@ -248,3 +248,16 @@
t.Errorf("no_stdlibs did not suppress dependency on libstd")
}
}
+
+// Test that libraries provide both 32-bit and 64-bit variants.
+func TestMultilib(t *testing.T) {
+ ctx := testRust(t, `
+ rust_library_rlib {
+ name: "libfoo",
+ srcs: ["foo.rs"],
+ crate_name: "foo",
+ }`)
+
+ _ = ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib")
+ _ = ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_rlib")
+}
diff --git a/rust/testing.go b/rust/testing.go
index c3a4625..aad4ffe 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -46,24 +46,29 @@
crate_name: "std",
srcs: ["foo.rs"],
no_stdlibs: true,
+ host_supported: true,
}
rust_library_rlib {
name: "libstd.static",
crate_name: "std",
srcs: ["foo.rs"],
no_stdlibs: true,
+ host_supported: true,
}
rust_library_dylib {
name: "libtest",
crate_name: "test",
srcs: ["foo.rs"],
no_stdlibs: true,
+ host_supported: true,
+
}
rust_library_rlib {
name: "libtest.static",
crate_name: "test",
srcs: ["foo.rs"],
no_stdlibs: true,
+ host_supported: true,
}
` + cc.GatherRequiredDepsForTest(android.NoOsType)
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 0932873..9f27647 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -494,11 +494,13 @@
})
}
- syspropLibrariesLock.Lock()
- defer syspropLibrariesLock.Unlock()
+ if m.ExportedToMake() {
+ syspropLibrariesLock.Lock()
+ defer syspropLibrariesLock.Unlock()
- libraries := syspropLibraries(ctx.Config())
- *libraries = append(*libraries, ctx.ModuleName())
+ libraries := syspropLibraries(ctx.Config())
+ *libraries = append(*libraries, "//"+ctx.ModuleDir()+":"+ctx.ModuleName())
+ }
}
func syspropDepsMutator(ctx android.BottomUpMutatorContext) {
diff --git a/ui/build/config.go b/ui/build/config.go
index 437e441..7fcc471 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -517,6 +517,9 @@
ctx.Fatalln("Unknown option:", arg)
}
} else if k, v, ok := decodeKeyValue(arg); ok && len(k) > 0 {
+ if k == "OUT_DIR" {
+ ctx.Fatalln("OUT_DIR may only be set in the environment, not as a command line option.")
+ }
c.environ.Set(k, v)
} else if arg == "dist" {
c.dist = true
diff --git a/ui/build/path.go b/ui/build/path.go
index c34ba1b..7122927 100644
--- a/ui/build/path.go
+++ b/ui/build/path.go
@@ -177,9 +177,12 @@
execs = append(execs, parsePathDir(pathEntry)...)
}
- allowAllSymlinks := config.Environment().IsEnvTrue("TEMPORARY_DISABLE_PATH_RESTRICTIONS")
+ if config.Environment().IsEnvTrue("TEMPORARY_DISABLE_PATH_RESTRICTIONS") {
+ ctx.Fatalln("TEMPORARY_DISABLE_PATH_RESTRICTIONS was a temporary migration method, and is now obsolete.")
+ }
+
for _, name := range execs {
- if !paths.GetConfig(name).Symlink && !allowAllSymlinks {
+ if !paths.GetConfig(name).Symlink {
continue
}
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index 98eb028..dab0e75 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -181,15 +181,15 @@
// For now, just map everything. Make most things readonly.
"-R", "/",
+ // Mount a writable tmp dir
+ "-B", "/tmp",
+
// Mount source are read-write
"-B", sandboxConfig.srcDir,
//Mount out dir as read-write
"-B", sandboxConfig.outDir,
- // Mount a writable tmp dir
- "-B", "/tmp",
-
// Disable newcgroup for now, since it may require newer kernels
// TODO: try out cgroups
"--disable_clone_newcgroup",