Merge "Disable header ABI checker for NDK" into main
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index d29e312..71a64dd 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -73,8 +73,9 @@
if len(module.properties.Package) == 0 {
ctx.PropertyErrorf("package", "missing package property")
}
- // TODO(b/311155208): Add mandatory check for container after all pre-existing
- // ones are changed.
+ if len(module.properties.Container) == 0 {
+ ctx.PropertyErrorf("container", "missing container property")
+ }
// Add a dependency on the aconfig_value_sets defined in
// RELEASE_ACONFIG_VALUE_SETS, and add any aconfig_values that
diff --git a/aconfig/aconfig_declarations_test.go b/aconfig/aconfig_declarations_test.go
index 5201fed..c37274c 100644
--- a/aconfig/aconfig_declarations_test.go
+++ b/aconfig/aconfig_declarations_test.go
@@ -88,19 +88,49 @@
android.AssertStringEquals(t, "rule must contain container", rule.Args["container"], "--container com.android.foo")
}
-func TestAconfigDeclarationsWithoutContainer(t *testing.T) {
- bp := `
- aconfig_declarations {
- name: "module_name",
- package: "com.example.package",
- srcs: [
- "foo.aconfig",
- ],
- }
- `
- result := runTest(t, android.FixtureExpectsNoErrors, bp)
-
- module := result.ModuleForTests("module_name", "")
- rule := module.Rule("aconfig")
- android.AssertIntEquals(t, "rule must not contain container", len(rule.Args["container"]), 0)
+func TestMandatoryProperties(t *testing.T) {
+ testCases := []struct {
+ name string
+ expectedError string
+ bp string
+ }{
+ {
+ name: "Srcs missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package",
+ container: "otherapex",
+ }`,
+ expectedError: `missing source files`,
+ },
+ {
+ name: "Package missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ container: "otherapex",
+ srcs: ["foo.aconfig"],
+ }`,
+ expectedError: `missing package property`,
+ },
+ {
+ name: "Container missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package",
+ srcs: ["foo.aconfig"],
+ }`,
+ expectedError: `missing container property`,
+ },
+ }
+ for _, test := range testCases {
+ t.Run(test.name, func(t *testing.T) {
+ errorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
+ android.GroupFixturePreparers(PrepareForTestWithAconfigBuildComponents).
+ ExtendWithErrorHandler(errorHandler).
+ RunTestWithBp(t, test.bp)
+ })
+ }
}
diff --git a/aconfig/codegen/aconfig_declarations_group_test.go b/aconfig/codegen/aconfig_declarations_group_test.go
index ec7cea3..c69d21f 100644
--- a/aconfig/codegen/aconfig_declarations_group_test.go
+++ b/aconfig/codegen/aconfig_declarations_group_test.go
@@ -15,9 +15,10 @@
package codegen
import (
+ "testing"
+
"android/soong/android"
"android/soong/java"
- "testing"
)
func TestAconfigDeclarationsGroup(t *testing.T) {
@@ -28,6 +29,7 @@
aconfig_declarations {
name: "foo-aconfig",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -39,6 +41,7 @@
aconfig_declarations {
name: "bar-aconfig",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
diff --git a/aconfig/codegen/cc_aconfig_library_test.go b/aconfig/codegen/cc_aconfig_library_test.go
index cf9ffbd..d01d13b 100644
--- a/aconfig/codegen/cc_aconfig_library_test.go
+++ b/aconfig/codegen/cc_aconfig_library_test.go
@@ -50,6 +50,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -112,6 +113,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -167,6 +169,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["bar.aconfig"],
}
@@ -241,6 +244,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
diff --git a/aconfig/codegen/java_aconfig_library_test.go b/aconfig/codegen/java_aconfig_library_test.go
index de45b5c..87b54a4 100644
--- a/aconfig/codegen/java_aconfig_library_test.go
+++ b/aconfig/codegen/java_aconfig_library_test.go
@@ -35,6 +35,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_foo",
package: "com.example.package.foo",
+ container: "system",
srcs: ["foo.aconfig"],
}
@@ -46,6 +47,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_bar",
package: "com.example.package.bar",
+ container: "system",
srcs: ["bar.aconfig"],
}
@@ -60,7 +62,7 @@
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
- android.EnsureListContainsSuffix(t, makeVar, "android_common/aconfig_merged.pb")
+ android.EnsureListContainsSuffix(t, makeVar, "android_common/system/aconfig_merged.pb")
}
func TestAndroidMkJavaLibrary(t *testing.T) {
@@ -175,6 +177,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
exportable: true,
}
@@ -200,6 +203,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -234,3 +238,52 @@
func TestUnsupportedMode(t *testing.T) {
testCodegenModeWithError(t, "mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode")
}
+
+func TestMkEntriesMatchedContainer(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithAconfigBuildComponents,
+ java.PrepareForTestWithJavaDefaultModules).
+ ExtendWithErrorHandler(android.FixtureExpectsNoErrors).
+ RunTestWithBp(t, `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package.foo",
+ container: "system",
+ srcs: ["foo.aconfig"],
+ }
+
+ java_aconfig_library {
+ name: "my_java_aconfig_library_foo",
+ aconfig_declarations: "my_aconfig_declarations_foo",
+ }
+
+ aconfig_declarations {
+ name: "my_aconfig_declarations_bar",
+ package: "com.example.package.bar",
+ container: "system_ext",
+ srcs: ["bar.aconfig"],
+ }
+
+ java_aconfig_library {
+ name: "my_java_aconfig_library_bar",
+ aconfig_declarations: "my_aconfig_declarations_bar",
+ }
+
+ java_library {
+ name: "my_module",
+ srcs: [
+ "src/foo.java",
+ ],
+ static_libs: [
+ "my_java_aconfig_library_foo",
+ "my_java_aconfig_library_bar",
+ ],
+ platform_apis: true,
+ }
+ `)
+
+ module := result.ModuleForTests("my_module", "android_common").Module()
+ entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
+ makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
+ android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb")
+}
diff --git a/aconfig/codegen/rust_aconfig_library_test.go b/aconfig/codegen/rust_aconfig_library_test.go
index fe28f94..523b464 100644
--- a/aconfig/codegen/rust_aconfig_library_test.go
+++ b/aconfig/codegen/rust_aconfig_library_test.go
@@ -46,6 +46,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -131,6 +132,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
rust_aconfig_library {
@@ -193,6 +195,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
rust_aconfig_library {
diff --git a/android/androidmk.go b/android/androidmk.go
index 07f7c58..53f0609 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -36,6 +36,7 @@
"github.com/google/blueprint"
"github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/pathtools"
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -541,6 +542,11 @@
a.SetPath("LOCAL_SOONG_INSTALLED_MODULE", base.katiInstalls[len(base.katiInstalls)-1].to)
a.SetString("LOCAL_SOONG_INSTALL_PAIRS", base.katiInstalls.BuiltInstalled())
a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
+ } else {
+ // Soong may not have generated the install rule also when `no_full_install: true`.
+ // Mark this module as uninstallable in order to prevent Make from creating an
+ // install rule there.
+ a.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", proptools.Bool(base.commonProperties.No_full_install))
}
if len(base.testData) > 0 {
diff --git a/android/license_metadata.go b/android/license_metadata.go
index eabb1b1..0cb6c96 100644
--- a/android/license_metadata.go
+++ b/android/license_metadata.go
@@ -195,7 +195,7 @@
for _, path := range paths {
switch path.Ext() {
- case ".zip", ".tar", ".tgz", ".tar.gz", ".img", ".srcszip", ".apex":
+ case ".zip", ".tar", ".tgz", ".tar.gz", ".img", ".srcszip", ".apex", ".capex":
return true
}
}
diff --git a/android/module.go b/android/module.go
index effca03..f8fec3a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -484,6 +484,11 @@
// Set by osMutator.
CommonOSVariant bool `blueprint:"mutated"`
+ // When set to true, this module is not installed to the full install path (ex: under
+ // out/target/product/<name>/<partition>). It can be installed only to the packaging
+ // modules like android_filesystem.
+ No_full_install *bool
+
// When HideFromMake is set to true, no entry for this variant will be emitted in the
// generated Android.mk file.
HideFromMake bool `blueprint:"mutated"`
diff --git a/android/module_context.go b/android/module_context.go
index dea22ba..605d3ba 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -444,6 +444,21 @@
return false
}
+// Tells whether this module is installed to the full install path (ex:
+// out/target/product/<name>/<partition>) or not. If this returns false, the install build rule is
+// not created and this module can only be installed to packaging modules like android_filesystem.
+func (m *moduleContext) requiresFullInstall() bool {
+ if m.skipInstall() {
+ return false
+ }
+
+ if proptools.Bool(m.module.base().commonProperties.No_full_install) {
+ return false
+ }
+
+ return true
+}
+
func (m *moduleContext) InstallFile(installPath InstallPath, name string, srcPath Path,
deps ...InstallPath) InstallPath {
return m.installFile(installPath, name, srcPath, deps, false, true, nil)
@@ -490,7 +505,7 @@
m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
}
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
deps = append(deps, InstallPaths(m.module.base().installFilesDepSet.ToList())...)
deps = append(deps, m.module.base().installedInitRcPaths...)
deps = append(deps, m.module.base().installedVintfFragmentsPaths...)
@@ -563,7 +578,7 @@
if err != nil {
panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
}
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
@@ -612,7 +627,7 @@
fullInstallPath := installPath.Join(m, name)
m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the
diff --git a/android/override_module.go b/android/override_module.go
index 1341f53..163f7b7 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -28,6 +28,7 @@
// module based on it.
import (
+ "fmt"
"sort"
"sync"
@@ -120,7 +121,7 @@
addOverride(o OverrideModule)
getOverrides() []OverrideModule
- override(ctx BaseModuleContext, m Module, o OverrideModule)
+ override(ctx BaseModuleContext, bm OverridableModule, o OverrideModule)
GetOverriddenBy() string
GetOverriddenByModuleDir() string
@@ -191,15 +192,14 @@
}
// Overrides a base module with the given OverrideModule.
-func (b *OverridableModuleBase) override(ctx BaseModuleContext, m Module, o OverrideModule) {
-
+func (b *OverridableModuleBase) override(ctx BaseModuleContext, bm OverridableModule, o OverrideModule) {
for _, p := range b.overridableProperties {
for _, op := range o.getOverridingProperties() {
if proptools.TypeEqual(p, op) {
err := proptools.ExtendProperties(p, op, nil, proptools.OrderReplace)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
- ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
+ ctx.OtherModulePropertyErrorf(bm, propertyErr.Property, "%s", propertyErr.Err.Error())
} else {
panic(err)
}
@@ -210,7 +210,7 @@
// Adds the base module to the overrides property, if exists, of the overriding module. See the
// comment on OverridableModuleBase.overridesProperty for details.
if b.overridesProperty != nil {
- *b.overridesProperty = append(*b.overridesProperty, ctx.ModuleName())
+ *b.overridesProperty = append(*b.overridesProperty, ctx.OtherModuleName(bm))
}
b.overridableModuleProperties.OverriddenBy = o.Name()
b.overridableModuleProperties.OverriddenByModuleDir = o.ModuleDir()
@@ -235,7 +235,7 @@
// to keep them in this order and not put any order mutators between them.
func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel()
- ctx.BottomUp("perform_override", performOverrideMutator).Parallel()
+ ctx.Transition("override", &overrideTransitionMutator{})
// overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can
// add deps from overridable properties.
ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel()
@@ -262,18 +262,6 @@
ctx.PropertyErrorf("base", "%q is not a valid module name", base)
return
}
- // See if there's a prebuilt module that overrides this override module with prefer flag,
- // in which case we call HideFromMake on the corresponding variant later.
- ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {
- prebuilt := GetEmbeddedPrebuilt(dep)
- if prebuilt == nil {
- panic("PrebuiltDepTag leads to a non-prebuilt module " + dep.Name())
- }
- if prebuilt.UsePrebuilt() {
- module.setOverriddenByPrebuilt(dep)
- return
- }
- })
baseModule := ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base)[0]
if o, ok := baseModule.(OverridableModule); ok {
overrideModule := ctx.Module().(OverrideModule)
@@ -285,11 +273,13 @@
// Now, goes through all overridable modules, finds all modules overriding them, creates a local
// variant for each of them, and performs the actual overriding operation by calling override().
-func performOverrideMutator(ctx BottomUpMutatorContext) {
+type overrideTransitionMutator struct{}
+
+func (overrideTransitionMutator) Split(ctx BaseModuleContext) []string {
if b, ok := ctx.Module().(OverridableModule); ok {
overrides := b.getOverrides()
if len(overrides) == 0 {
- return
+ return []string{""}
}
variants := make([]string, len(overrides)+1)
// The first variant is for the original, non-overridden, base module.
@@ -297,27 +287,69 @@
for i, o := range overrides {
variants[i+1] = o.(Module).Name()
}
- mods := ctx.CreateLocalVariations(variants...)
- // Make the original variation the default one to depend on if no other override module variant
- // is specified.
- ctx.AliasVariation(variants[0])
- for i, o := range overrides {
- mods[i+1].(OverridableModule).override(ctx, mods[i+1], o)
- if prebuilt := o.getOverriddenByPrebuilt(); prebuilt != nil {
- // The overriding module itself, too, is overridden by a prebuilt.
- // Perform the same check for replacement
- checkInvariantsForSourceAndPrebuilt(ctx, mods[i+1], prebuilt)
- // Copy the flag and hide it in make
- mods[i+1].ReplacedByPrebuilt()
- }
- }
+ return variants
} else if o, ok := ctx.Module().(OverrideModule); ok {
// Create a variant of the overriding module with its own name. This matches the above local
// variant name rule for overridden modules, and thus allows ReplaceDependencies to match the
// two.
- ctx.CreateLocalVariations(o.Name())
- // To allow dependencies to be added without having to know the above variation.
- ctx.AliasVariation(o.Name())
+ return []string{o.Name()}
+ }
+
+ return []string{""}
+}
+
+func (overrideTransitionMutator) OutgoingTransition(ctx OutgoingTransitionContext, sourceVariation string) string {
+ if o, ok := ctx.Module().(OverrideModule); ok {
+ if ctx.DepTag() == overrideBaseDepTag {
+ return o.Name()
+ }
+ }
+
+ // Variations are always local and shouldn't affect the variant used for dependencies
+ return ""
+}
+
+func (overrideTransitionMutator) IncomingTransition(ctx IncomingTransitionContext, incomingVariation string) string {
+ if _, ok := ctx.Module().(OverridableModule); ok {
+ return incomingVariation
+ } else if o, ok := ctx.Module().(OverrideModule); ok {
+ // To allow dependencies to be added without having to know the variation.
+ return o.Name()
+ }
+
+ return ""
+}
+
+func (overrideTransitionMutator) Mutate(ctx BottomUpMutatorContext, variation string) {
+ if o, ok := ctx.Module().(OverrideModule); ok {
+ overridableDeps := ctx.GetDirectDepsWithTag(overrideBaseDepTag)
+ if len(overridableDeps) > 1 {
+ panic(fmt.Errorf("expected a single dependency with overrideBaseDepTag, found %q", overridableDeps))
+ } else if len(overridableDeps) == 1 {
+ b := overridableDeps[0].(OverridableModule)
+ b.override(ctx, b, o)
+
+ checkPrebuiltReplacesOverride(ctx, b)
+ }
+ }
+}
+
+func checkPrebuiltReplacesOverride(ctx BottomUpMutatorContext, b OverridableModule) {
+ // See if there's a prebuilt module that overrides this override module with prefer flag,
+ // in which case we call HideFromMake on the corresponding variant later.
+ prebuiltDeps := ctx.GetDirectDepsWithTag(PrebuiltDepTag)
+ for _, prebuiltDep := range prebuiltDeps {
+ prebuilt := GetEmbeddedPrebuilt(prebuiltDep)
+ if prebuilt == nil {
+ panic("PrebuiltDepTag leads to a non-prebuilt module " + prebuiltDep.Name())
+ }
+ if prebuilt.UsePrebuilt() {
+ // The overriding module itself, too, is overridden by a prebuilt.
+ // Perform the same check for replacement
+ checkInvariantsForSourceAndPrebuilt(ctx, b, prebuiltDep)
+ // Copy the flag and hide it in make
+ b.ReplacedByPrebuilt()
+ }
}
}
diff --git a/android/packaging.go b/android/packaging.go
index 6677218..fe61da1 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -50,6 +50,25 @@
skipInstall bool
}
+func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
+ if other == nil {
+ return false
+ }
+ if p.relPathInPackage != other.relPathInPackage {
+ return false
+ }
+ if p.srcPath != other.srcPath || p.symlinkTarget != other.symlinkTarget {
+ return false
+ }
+ if p.executable != other.executable {
+ return false
+ }
+ if p.partition != other.partition {
+ return false
+ }
+ return true
+}
+
// Get file name of installed package
func (p *PackagingSpec) FileName() string {
if p.relPathInPackage != "" {
@@ -243,9 +262,15 @@
continue
}
}
- if _, ok := m[ps.relPathInPackage]; !ok {
- m[ps.relPathInPackage] = ps
+ dstPath := ps.relPathInPackage
+ if existingPs, ok := m[dstPath]; ok {
+ if !existingPs.Equals(&ps) {
+ ctx.ModuleErrorf("packaging conflict at %v:\n%v\n%v", dstPath, existingPs, ps)
+ }
+ continue
}
+
+ m[dstPath] = ps
}
})
return m
diff --git a/android/sdk_version.go b/android/sdk_version.go
index b2ff960..01b55d0 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -40,9 +40,15 @@
// SdkKind represents a particular category of an SDK spec like public, system, test, etc.
type SdkKind int
+// These are generally ordered from the narrower sdk version to the wider sdk version,
+// but not all entries have a strict subset/superset relationship.
+// For example, SdkTest and SdkModule do not have a strict subset/superset relationship but both
+// are supersets of SdkSystem.
+// The general trend should be kept when an additional sdk kind is added.
const (
SdkInvalid SdkKind = iota
SdkNone
+ SdkToolchain // API surface provided by ART to compile other API domains
SdkCore
SdkCorePlatform
SdkIntraCore // API surface provided by one core module to another
@@ -53,7 +59,6 @@
SdkModule
SdkSystemServer
SdkPrivate
- SdkToolchain // API surface provided by ART to compile other API domains
)
// String returns the string representation of this SdkKind
diff --git a/android/variable.go b/android/variable.go
index 599f88e..2649fbd 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -67,7 +67,7 @@
Enabled *bool `android:"arch_variant"`
} `android:"arch_variant"`
- Malloc_not_svelte struct {
+ Malloc_low_memory struct {
Cflags []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
Whole_static_libs []string `android:"arch_variant"`
@@ -278,7 +278,7 @@
Unbundled_build_image *bool `json:",omitempty"`
Always_use_prebuilt_sdks *bool `json:",omitempty"`
Skip_boot_jars_check *bool `json:",omitempty"`
- Malloc_not_svelte *bool `json:",omitempty"`
+ Malloc_low_memory *bool `json:",omitempty"`
Malloc_zero_contents *bool `json:",omitempty"`
Malloc_pattern_fill_contents *bool `json:",omitempty"`
Safestack *bool `json:",omitempty"`
@@ -612,7 +612,7 @@
AAPTCharacteristics: stringPtr("nosdcard"),
AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"},
- Malloc_not_svelte: boolPtr(true),
+ Malloc_low_memory: boolPtr(false),
Malloc_zero_contents: boolPtr(true),
Malloc_pattern_fill_contents: boolPtr(false),
Safestack: boolPtr(false),
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 1be1048..0b26f16 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -11407,6 +11407,7 @@
aconfig_declarations {
name: "%[1]s",
package: "com.example.package",
+ container: "system",
srcs: [
"%[1]s.aconfig",
],
diff --git a/cc/builder.go b/cc/builder.go
index e78b8c0..e255cbe 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -608,6 +608,10 @@
ccCmd = "clang++"
moduleFlags = cppflags
moduleToolingFlags = toolingCppflags
+ case ".rs":
+ // A source provider (e.g. rust_bindgen) may provide both rs and c files.
+ // Ignore the rs files.
+ continue
case ".h", ".hpp":
ctx.PropertyErrorf("srcs", "Header file %s is not supported, instead use export_include_dirs or local_include_dirs.", srcFile)
continue
diff --git a/cc/sanitize.go b/cc/sanitize.go
index a0cbb51..0cb54e5 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -82,7 +82,7 @@
hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512",
"export_memory_stats=0", "max_malloc_fill_size=131072", "malloc_fill_byte=0"}
memtagStackCommonFlags = []string{"-march=armv8-a+memtag"}
- memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
+ memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
hostOnlySanitizeFlags = []string{"-fno-sanitize-recover=all"}
deviceOnlySanitizeFlags = []string{"-fsanitize-trap=all"}
@@ -863,7 +863,7 @@
flags.Local.CFlags = append(flags.Local.CFlags, cfiCflags...)
flags.Local.AsFlags = append(flags.Local.AsFlags, cfiAsflags...)
- flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath + "/" + cfiBlocklistFilename))
+ flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath+"/"+cfiBlocklistFilename))
if Bool(s.Properties.Sanitize.Config.Cfi_assembly_support) {
flags.Local.CFlags = append(flags.Local.CFlags, cfiAssemblySupportFlag)
}
@@ -1566,7 +1566,7 @@
addStaticDeps(config.BuiltinsRuntimeLibrary(toolchain), true)
}
- if runtimeSharedLibrary != "" && (toolchain.Bionic() || toolchain.Musl() || c.sanitize.Properties.UbsanRuntimeDep) {
+ if runtimeSharedLibrary != "" && (toolchain.Bionic() || toolchain.Musl()) {
// UBSan is supported on non-bionic linux host builds as well
// Adding dependency to the runtime library. We are using *FarVariation*
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index cadf9c24..b342ae9 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -127,6 +127,10 @@
// the make version.
Include_make_built_files string
+ // When set, builds etc/event-log-tags file by merging logtags from all dependencies.
+ // Default is false
+ Build_logtags *bool
+
Fsverity fsverityProperties
}
@@ -137,6 +141,7 @@
// partitions like system.img. For example, cc_library modules are placed under ./lib[64] directory.
func filesystemFactory() android.Module {
module := &filesystem{}
+ module.filterPackagingSpec = module.filterInstallablePackagingSpec
initFilesystemModule(module)
return module
}
@@ -189,6 +194,12 @@
return proptools.StringDefault(f.properties.Partition_name, f.Name())
}
+func (f *filesystem) filterInstallablePackagingSpec(ps android.PackagingSpec) bool {
+ // Filesystem module respects the installation semantic. A PackagingSpec from a module with
+ // IsSkipInstall() is skipped.
+ return !ps.SkipInstall()
+}
+
var pctx = android.NewPackageContext("android/soong/filesystem")
func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -288,6 +299,7 @@
f.buildNonDepsFiles(ctx, builder, rootDir)
f.addMakeBuiltFiles(ctx, builder, rootDir)
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
+ f.buildEventLogtagsFile(ctx, builder, rebasedDir)
// run host_init_verifier
// Ideally we should have a concept of pluggable linters that verify the generated image.
@@ -428,6 +440,7 @@
f.buildNonDepsFiles(ctx, builder, rootDir)
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
+ f.buildEventLogtagsFile(ctx, builder, rebasedDir)
output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
cmd := builder.Command().
@@ -485,6 +498,37 @@
Text(android.PathForArbitraryOutput(ctx, stagingDir).String())
}
+func (f *filesystem) buildEventLogtagsFile(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) {
+ if !proptools.Bool(f.properties.Build_logtags) {
+ return
+ }
+
+ logtagsFilePaths := make(map[string]bool)
+ ctx.WalkDeps(func(child, parent android.Module) bool {
+ if logtagsInfo, ok := android.OtherModuleProvider(ctx, child, android.LogtagsProviderKey); ok {
+ for _, path := range logtagsInfo.Logtags {
+ logtagsFilePaths[path.String()] = true
+ }
+ }
+ return true
+ })
+
+ if len(logtagsFilePaths) == 0 {
+ return
+ }
+
+ etcPath := rebasedDir.Join(ctx, "etc")
+ eventLogtagsPath := etcPath.Join(ctx, "event-log-tags")
+ builder.Command().Text("mkdir").Flag("-p").Text(etcPath.String())
+ cmd := builder.Command().BuiltTool("merge-event-log-tags").
+ FlagWithArg("-o ", eventLogtagsPath.String()).
+ FlagWithInput("-m ", android.MergedLogtagsPath(ctx))
+
+ for _, path := range android.SortedKeys(logtagsFilePaths) {
+ cmd.Text(path)
+ }
+}
+
type partition interface {
PartitionType() string
}
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 1215048..acd4813 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -442,3 +442,26 @@
}
`)
}
+
+func TestPreventDuplicatedEntries(t *testing.T) {
+ fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(
+ "packaging conflict at")).
+ RunTestWithBp(t, `
+ android_filesystem {
+ name: "fs",
+ deps: [
+ "foo",
+ "foo_dup",
+ ],
+ }
+
+ cc_binary {
+ name: "foo",
+ }
+
+ cc_binary {
+ name: "foo_dup",
+ stem: "foo",
+ }
+ `)
+}
diff --git a/filesystem/system_image.go b/filesystem/system_image.go
index 5028a49..15cacfb 100644
--- a/filesystem/system_image.go
+++ b/filesystem/system_image.go
@@ -98,5 +98,5 @@
// Note that "apex" module installs its contents to "apex"(fake partition) as well
// for symbol lookup by imitating "activated" paths.
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
- return ps.Partition() == "system"
+ return s.filesystem.filterInstallablePackagingSpec(ps) && ps.Partition() == "system"
}
diff --git a/java/aar_test.go b/java/aar_test.go
index d6dbe3c..18efd20 100644
--- a/java/aar_test.go
+++ b/java/aar_test.go
@@ -15,8 +15,9 @@
package java
import (
- "android/soong/android"
"testing"
+
+ "android/soong/android"
)
func TestAarImportProducesJniPackages(t *testing.T) {
@@ -98,6 +99,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -105,6 +107,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/androidmk.go b/java/androidmk.go
index ab5e456..9cd0baf 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -453,6 +453,8 @@
if app.Name() != "framework-res" {
android.SetAconfigFileMkEntries(&app.ModuleBase, entries, app.mergedAconfigFiles)
}
+
+ entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", app.logtagsSrcs.Strings()...)
},
},
ExtraFooters: []android.AndroidMkExtraFootersFunc{
diff --git a/java/app_test.go b/java/app_test.go
index eab40e7..a7c48a1 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -4382,6 +4382,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -4389,6 +4390,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 24caf6f..730be14 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -626,7 +626,8 @@
// privileged apps that are only defined since API level 21 (Lollipop), fallback to public stubs
// for older releases. Similarly, module-lib falls back to system API.
var sdkDirs []string
- switch proptools.StringDefault(d.properties.Api_levels_sdk_type, "public") {
+ apiLevelsSdkType := proptools.StringDefault(d.properties.Api_levels_sdk_type, "public")
+ switch apiLevelsSdkType {
case "system-server":
sdkDirs = []string{"system-server", "module-lib", "system", "public"}
case "module-lib":
@@ -640,9 +641,22 @@
return
}
+ // Construct a pattern to match the appropriate extensions that should be included in the
+ // generated api-versions.xml file.
+ //
// Use the first item in the sdkDirs array as that is the sdk type for the target API levels
// being generated but has the advantage over `Api_levels_sdk_type` as it has been validated.
- extensionsPattern := fmt.Sprintf(`/extensions/[0-9]+/%s/.*\.jar`, sdkDirs[0])
+ // The exception is for system-server which needs to include module-lib and system-server. That
+ // is because while system-server extends module-lib the system-server extension directory only
+ // contains service-* modules which provide system-server APIs it does not list the modules which
+ // only provide a module-lib, so they have to be included separately.
+ extensionSurfacesPattern := sdkDirs[0]
+ if apiLevelsSdkType == "system-server" {
+ // Take the first two items in sdkDirs, which are system-server and module-lib, and construct
+ // a pattern that will match either.
+ extensionSurfacesPattern = strings.Join(sdkDirs[0:2], "|")
+ }
+ extensionsPattern := fmt.Sprintf(`/extensions/[0-9]+/(%s)/.*\.jar`, extensionSurfacesPattern)
var dirs []string
var extensions_dir string
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 8da695f..6a14f36 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -379,6 +379,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -434,6 +435,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/java/java_test.go b/java/java_test.go
index a1192bb..2f27932 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2801,6 +2801,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/java/rro_test.go b/java/rro_test.go
index d697ec6..742c839 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -421,6 +421,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -428,6 +429,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 0f163e6..34c63ac 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -1715,6 +1715,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/rust/bindgen.go b/rust/bindgen.go
index eaed1b9..4277753 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -102,8 +102,17 @@
// "my_bindgen [flags] wrapper_header.h -o [output_path] -- [clang flags]"
Custom_bindgen string
- // flag to indicate if bindgen should handle `static inline` functions (default is false)
- Handle_static_inline bool
+ // flag to indicate if bindgen should handle `static inline` functions (default is false).
+ // If true, Static_inline_library must be set.
+ Handle_static_inline *bool
+
+ // module name of the corresponding cc_library_static which includes the static_inline wrapper
+ // generated functions from bindgen. Must be used together with handle_static_inline.
+ //
+ // If there are no static inline functions provided through the header file,
+ // then bindgen (as of 0.69.2) will silently fail to output a .c file, and
+ // the cc_library_static depending on this module will fail compilation.
+ Static_inline_library *string
}
type bindgenDecorator struct {
@@ -159,6 +168,18 @@
var cflags []string
var implicits android.Paths
+ var implicitOutputs android.WritablePaths
+ var validations android.Paths
+
+ if Bool(b.Properties.Handle_static_inline) && b.Properties.Static_inline_library == nil {
+ ctx.PropertyErrorf("handle_static_inline",
+ "requires declaring static_inline_library to the corresponding cc_library module that includes the generated C source from bindgen.")
+ }
+
+ if b.Properties.Static_inline_library != nil && !Bool(b.Properties.Handle_static_inline) {
+ ctx.PropertyErrorf("static_inline_library",
+ "requires declaring handle_static_inline.")
+ }
implicits = append(implicits, deps.depGeneratedHeaders...)
@@ -235,8 +256,11 @@
bindgenFlags := defaultBindgenFlags
bindgenFlags = append(bindgenFlags, esc(b.Properties.Bindgen_flags)...)
- if b.Properties.Handle_static_inline {
- bindgenFlags = append(bindgenFlags, "--experimental --wrap-static-fns")
+ if Bool(b.Properties.Handle_static_inline) {
+ outputStaticFnsFile := android.PathForModuleOut(ctx, b.BaseSourceProvider.getStem(ctx)+".c")
+ implicitOutputs = append(implicitOutputs, outputStaticFnsFile)
+ validations = append(validations, outputStaticFnsFile)
+ bindgenFlags = append(bindgenFlags, []string{"--experimental", "--wrap-static-fns", "--wrap-static-fns-path=" + outputStaticFnsFile.String()}...)
}
// cat reads from stdin if its command line is empty,
@@ -285,11 +309,13 @@
}
ctx.Build(pctx, android.BuildParams{
- Rule: bindgen,
- Description: strings.Join([]string{cmdDesc, wrapperFile.Path().Rel()}, " "),
- Output: outputFile,
- Input: wrapperFile.Path(),
- Implicits: implicits,
+ Rule: bindgen,
+ Description: strings.Join([]string{cmdDesc, wrapperFile.Path().Rel()}, " "),
+ Output: outputFile,
+ Input: wrapperFile.Path(),
+ Implicits: implicits,
+ ImplicitOutputs: implicitOutputs,
+ Validations: validations,
Args: map[string]string{
"cmd": cmd,
"flags": strings.Join(bindgenFlags, " "),
@@ -299,6 +325,14 @@
})
b.BaseSourceProvider.OutputFiles = android.Paths{outputFile}
+
+ // Append any additional implicit outputs after the entry point source.
+ // We append any generated .c file here so it can picked up by cc_library_static modules.
+ // Those CC modules need to be sure not to pass any included .rs files to Clang.
+ // We don't have to worry about the additional .c files for Rust modules as only the entry point
+ // is passed to rustc.
+ b.BaseSourceProvider.OutputFiles = append(b.BaseSourceProvider.OutputFiles, implicitOutputs.Paths()...)
+
return outputFile
}
@@ -350,6 +384,14 @@
deps = muslDeps(ctx, deps, false)
}
+ if !ctx.RustModule().Source() && b.Properties.Static_inline_library != nil {
+ // This is not the source variant, so add the static inline library as a dependency.
+ //
+ // This is necessary to avoid a circular dependency between the source variant and the
+ // dependent cc module.
+ deps.StaticLibs = append(deps.StaticLibs, String(b.Properties.Static_inline_library))
+ }
+
deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...)
deps.StaticLibs = append(deps.StaticLibs, b.ClangProperties.Static_libs...)
deps.HeaderLibs = append(deps.HeaderLibs, b.ClangProperties.Header_libs...)
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go
index 11cfe4e..2b7362f 100644
--- a/rust/bindgen_test.go
+++ b/rust/bindgen_test.go
@@ -228,7 +228,6 @@
// we may be able to check libbinder.RuleParams.Command to see if it contains $(cat /dev/null flag_file.txt)
}
-
func TestBindgenHandleStaticInlining(t *testing.T) {
ctx := testRust(t, `
rust_bindgen {
@@ -237,12 +236,54 @@
crate_name: "bindgen",
stem: "libbindgen",
source_stem: "bindings",
+ handle_static_inline: true,
+ static_inline_library: "libbindgen_staticfns"
+ }
+
+ cc_library_static {
+ name: "libbindgen_staticfns",
+ srcs: [":libbindgen"],
+ include_dirs: ["src/"],
+ }
+ `)
+ libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ // Make sure the flag to support `static inline` functions is present
+ if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns") {
+ t.Errorf("missing flag to handle static inlining in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
+ }
+
+ if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns-path") {
+ t.Errorf("missing flag to define path for static inlining C source from bindgen (--wrap-static-fns-path): flags %#v", libbindgen.Args["flags"])
+ }
+
+}
+
+func TestBindgenStaticInlineProperties(t *testing.T) {
+ // Make sure handle_static_inline without static_inline_library generates an error
+ testRustError(t, "requires declaring static_inline_library to the corresponding cc_library module that includes the generated C source from bindgen", `
+ rust_bindgen {
+ name: "libbindgen",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
handle_static_inline: true
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
- // Make sure the flag to support `static inline` functions is present
- if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns") {
- t.Errorf("missing flag to handle static inlining in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
- }
+ testRustError(t, "requires declaring handle_static_inline", `
+ rust_bindgen {
+ name: "libbindgen",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
+ static_inline_library: "libbindgen_staticfns"
+ }
+
+ cc_library_static {
+ name: "libbindgen_staticfns",
+ srcs: [":libbindgen"],
+ include_dirs: ["src/"],
+ }
+ `)
}
diff --git a/scripts/gen-kotlin-build-file.py b/scripts/gen-kotlin-build-file.py
index 83b4cd8..99afdca 100644
--- a/scripts/gen-kotlin-build-file.py
+++ b/scripts/gen-kotlin-build-file.py
@@ -79,7 +79,7 @@
elif src.endswith('.kt'):
f.write(' <sources path="%s"/>\n' % path)
else:
- raise RuntimeError('unknown source file type %s' % file)
+ raise RuntimeError(f'unknown source file type {src} from rspfile {rsp_file}')
for rsp_file in args.common_srcs:
for src in NinjaRspFileReader(rsp_file):
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index 5142a41..8fa147f 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -159,12 +159,6 @@
fmt.Fprintln(ctx.Writer, "")
return
}
- if config.GoogleProdCredsExist() {
- return
- }
- fmt.Fprintln(ctx.Writer, "")
- fmt.Fprintln(ctx.Writer, "\033[33mWARNING: Missing LOAS credentials, please run `gcert`. This is required for a successful build execution. See go/rbe-android-default-announcement for more information.\033[0m")
- fmt.Fprintln(ctx.Writer, "")
}
// DumpRBEMetrics creates a metrics protobuf file containing RBE related metrics.