Merge "Add vintf info and userdata size to Soong's misc_info.txt" into main
diff --git a/android/Android.bp b/android/Android.bp
index 4b75148..00dc50a 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -171,7 +171,3 @@
// Used by plugins
visibility: ["//visibility:public"],
}
-
-otatools_package_filegroup {
- name: "otatools_package_filegroup",
-}
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go
index 9c71d92..bb73f0b 100644
--- a/android/aconfig_providers.go
+++ b/android/aconfig_providers.go
@@ -248,7 +248,7 @@
// Please only access the module's internal data through providers.
func getContainerUsingProviders(ctx OtherModuleProviderContext, m Module) string {
container := "system"
- commonInfo, _ := OtherModuleProvider(ctx, m, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, m, CommonModuleInfoProvider)
if commonInfo.Vendor || commonInfo.Proprietary || commonInfo.SocSpecific {
container = "vendor"
} else if commonInfo.ProductSpecific {
diff --git a/android/all_teams.go b/android/all_teams.go
index 5e76e53..18a050f 100644
--- a/android/all_teams.go
+++ b/android/all_teams.go
@@ -116,7 +116,7 @@
testOnly: testModInfo.TestOnly,
topLevelTestTarget: testModInfo.TopLevelTarget,
kind: ctx.ModuleType(module),
- teamName: OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).Team,
+ teamName: OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).Team,
}
t.teams_for_mods[module.Name()] = entry
diff --git a/android/androidmk.go b/android/androidmk.go
index 694f5d6..7845593 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -888,14 +888,14 @@
}
}
- commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider)
if commonInfo.SkipAndroidMkProcessing {
continue
}
if info, ok := OtherModuleProvider(ctx, mod, AndroidMkInfoProvider); ok {
// Deep copy the provider info since we need to modify the info later
info := deepCopyAndroidMkProviderInfo(info)
- info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo)
+ info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo)
if info.PrimaryInfo.disabled() {
continue
}
@@ -1320,7 +1320,7 @@
// Please only access the module's internal data through providers.
func translateAndroidMkEntriesInfoModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
mod Module, providerInfo *AndroidMkProviderInfo) error {
- commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider)
if commonInfo.SkipAndroidMkProcessing {
return nil
}
@@ -1331,11 +1331,11 @@
aconfigUpdateAndroidMkInfos(ctx, mod, &info)
// Any new or special cases here need review to verify correct propagation of license information.
- info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo)
+ info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo)
info.PrimaryInfo.write(w)
if len(info.ExtraInfo) > 0 {
for _, ei := range info.ExtraInfo {
- ei.fillInEntries(ctx, mod, &commonInfo)
+ ei.fillInEntries(ctx, mod, commonInfo)
ei.write(w)
}
}
diff --git a/android/arch_list.go b/android/arch_list.go
index 389f194..8659549 100644
--- a/android/arch_list.go
+++ b/android/arch_list.go
@@ -27,6 +27,8 @@
"armv8-2a-dotprod",
"armv9-a",
"armv9-2a",
+ "armv9-3a",
+ "armv9-4a",
},
X86: {
"alderlake",
@@ -151,6 +153,12 @@
"armv9-2a": {
"dotprod",
},
+ "armv9-3a": {
+ "dotprod",
+ },
+ "armv9-4a": {
+ "dotprod",
+ },
},
X86: {
"alderlake": {
diff --git a/android/base_module_context.go b/android/base_module_context.go
index eba3670..5cb9e71 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -410,7 +410,7 @@
return &aModule
}
- if !OtherModuleProviderOrDefault(b, module, CommonModuleInfoProvider).Enabled {
+ if !OtherModulePointerProviderOrDefault(b, module, CommonModuleInfoProvider).Enabled {
if t, ok := tag.(AllowDisabledModuleDependency); !ok || !t.AllowDisabledModuleDependencyProxy(b, aModule) {
if b.Config().AllowMissingDependencies() {
b.AddMissingDependencies([]string{b.OtherModuleName(aModule)})
@@ -440,7 +440,7 @@
func (b *baseModuleContext) getDirectDepsProxyInternal(name string, tag blueprint.DependencyTag) []ModuleProxy {
var deps []ModuleProxy
b.VisitDirectDepsProxy(func(module ModuleProxy) {
- if OtherModuleProviderOrDefault(b, module, CommonModuleInfoProvider).BaseModuleName == name {
+ if OtherModulePointerProviderOrDefault(b, module, CommonModuleInfoProvider).BaseModuleName == name {
returnedTag := b.OtherModuleDependencyTag(module)
if tag == nil || returnedTag == tag {
deps = append(deps, module)
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go
index c15a206..16a3853 100644
--- a/android/compliance_metadata.go
+++ b/android/compliance_metadata.go
@@ -304,7 +304,7 @@
rowId := -1
ctx.VisitAllModuleProxies(func(module ModuleProxy) {
- commonInfo, _ := OtherModuleProvider(ctx, module, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider)
if !commonInfo.Enabled {
return
}
diff --git a/android/config.go b/android/config.go
index 885960b..52d7f3b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -22,6 +22,7 @@
"fmt"
"os"
"path/filepath"
+ "reflect"
"runtime"
"strconv"
"strings"
@@ -108,6 +109,10 @@
const testKeyDir = "build/make/target/product/security"
+func (c Config) genericConfig() Config {
+ return Config{c.config.genericConfig}
+}
+
// SoongOutDir returns the build output directory for the configuration.
func (c Config) SoongOutDir() string {
return c.soongOutDir
@@ -238,11 +243,6 @@
return c.config.productVariables.ReleaseAconfigFlagDefaultPermission
}
-// Enable object size sanitizer
-func (c Config) ReleaseBuildObjectSizeSanitizer() bool {
- return c.config.productVariables.GetBuildFlagBool("RELEASE_BUILD_OBJECT_SIZE_SANITIZER")
-}
-
// The flag indicating behavior for the tree wrt building modules or using prebuilts
// derived from RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE
func (c Config) ReleaseDefaultModuleBuildFromSource() bool {
@@ -377,7 +377,7 @@
// regenerate build.ninja.
ninjaFileDepsSet sync.Map
- OncePer
+ *OncePer
// If buildFromSourceStub is true then the Java API stubs are
// built from the source Java files, not the signature text files.
@@ -387,6 +387,17 @@
// modules that aren't mixed-built for at least one variant will cause a build
// failure
ensureAllowlistIntegrity bool
+
+ // If isGeneric is true, this config is the generic config.
+ isGeneric bool
+
+ // InstallPath requires the device name.
+ // This is only for the installPath.
+ deviceNameToInstall *string
+
+ // Copy of this config struct but some product-specific variables are
+ // replaced with the generic configuration values.
+ genericConfig *config
}
type partialCompileFlags struct {
@@ -644,11 +655,9 @@
}
}
-// NewConfig creates a new Config object. The srcDir argument specifies the path
-// to the root source directory. It also loads the config file, if found.
-func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error) {
+func initConfig(cmdArgs CmdArgs, availableEnv map[string]string) (*config, error) {
// Make a config with default options.
- config := &config{
+ newConfig := &config{
ProductVariablesFileName: cmdArgs.SoongVariables,
env: availableEnv,
@@ -662,70 +671,72 @@
moduleListFile: cmdArgs.ModuleListFile,
fs: pathtools.NewOsFs(absSrcDir),
+ OncePer: &OncePer{},
+
buildFromSourceStub: cmdArgs.BuildFromSourceStub,
}
variant, ok := os.LookupEnv("TARGET_BUILD_VARIANT")
isEngBuild := !ok || variant == "eng"
- config.deviceConfig = &deviceConfig{
- config: config,
+ newConfig.deviceConfig = &deviceConfig{
+ config: newConfig,
}
// Soundness check of the build and source directories. This won't catch strange
// configurations with symlinks, but at least checks the obvious case.
absBuildDir, err := filepath.Abs(cmdArgs.SoongOutDir)
if err != nil {
- return Config{}, err
+ return &config{}, err
}
absSrcDir, err := filepath.Abs(".")
if err != nil {
- return Config{}, err
+ return &config{}, err
}
if strings.HasPrefix(absSrcDir, absBuildDir) {
- return Config{}, fmt.Errorf("Build dir must not contain source directory")
+ return &config{}, fmt.Errorf("Build dir must not contain source directory")
}
// Load any configurable options from the configuration file
- err = loadConfig(config)
+ err = loadConfig(newConfig)
if err != nil {
- return Config{}, err
+ return &config{}, err
}
KatiEnabledMarkerFile := filepath.Join(cmdArgs.SoongOutDir, ".soong.kati_enabled")
if _, err := os.Stat(absolutePath(KatiEnabledMarkerFile)); err == nil {
- config.katiEnabled = true
+ newConfig.katiEnabled = true
}
- determineBuildOS(config)
+ determineBuildOS(newConfig)
// Sets up the map of target OSes to the finer grained compilation targets
// that are configured from the product variables.
- targets, err := decodeTargetProductVariables(config)
+ targets, err := decodeTargetProductVariables(newConfig)
if err != nil {
- return Config{}, err
+ return &config{}, err
}
- config.partialCompileFlags, err = config.parsePartialCompileFlags(isEngBuild)
+ newConfig.partialCompileFlags, err = newConfig.parsePartialCompileFlags(isEngBuild)
if err != nil {
- return Config{}, err
+ return &config{}, err
}
// Make the CommonOS OsType available for all products.
targets[CommonOS] = []Target{commonTargetMap[CommonOS.Name]}
var archConfig []archConfig
- if config.NdkAbis() {
+ if newConfig.NdkAbis() {
archConfig = getNdkAbisConfig()
- } else if config.AmlAbis() {
+ } else if newConfig.AmlAbis() {
archConfig = getAmlAbisConfig()
}
if archConfig != nil {
androidTargets, err := decodeAndroidArchSettings(archConfig)
if err != nil {
- return Config{}, err
+ return &config{}, err
}
targets[Android] = androidTargets
}
@@ -733,37 +744,113 @@
multilib := make(map[string]bool)
for _, target := range targets[Android] {
if seen := multilib[target.Arch.ArchType.Multilib]; seen {
- config.multilibConflicts[target.Arch.ArchType] = true
+ newConfig.multilibConflicts[target.Arch.ArchType] = true
}
multilib[target.Arch.ArchType.Multilib] = true
}
// Map of OS to compilation targets.
- config.Targets = targets
+ newConfig.Targets = targets
// Compilation targets for host tools.
- config.BuildOSTarget = config.Targets[config.BuildOS][0]
- config.BuildOSCommonTarget = getCommonTargets(config.Targets[config.BuildOS])[0]
+ newConfig.BuildOSTarget = newConfig.Targets[newConfig.BuildOS][0]
+ newConfig.BuildOSCommonTarget = getCommonTargets(newConfig.Targets[newConfig.BuildOS])[0]
// Compilation targets for Android.
- if len(config.Targets[Android]) > 0 {
- config.AndroidCommonTarget = getCommonTargets(config.Targets[Android])[0]
- config.AndroidFirstDeviceTarget = FirstTarget(config.Targets[Android], "lib64", "lib32")[0]
+ if len(newConfig.Targets[Android]) > 0 {
+ newConfig.AndroidCommonTarget = getCommonTargets(newConfig.Targets[Android])[0]
+ newConfig.AndroidFirstDeviceTarget = FirstTarget(newConfig.Targets[Android], "lib64", "lib32")[0]
}
setBuildMode := func(arg string, mode SoongBuildMode) {
if arg != "" {
- if config.BuildMode != AnalysisNoBazel {
+ if newConfig.BuildMode != AnalysisNoBazel {
fmt.Fprintf(os.Stderr, "buildMode is already set, illegal argument: %s", arg)
os.Exit(1)
}
- config.BuildMode = mode
+ newConfig.BuildMode = mode
}
}
setBuildMode(cmdArgs.ModuleGraphFile, GenerateModuleGraph)
setBuildMode(cmdArgs.DocFile, GenerateDocFile)
- config.productVariables.Build_from_text_stub = boolPtr(config.BuildFromTextStub())
+ newConfig.productVariables.Build_from_text_stub = boolPtr(newConfig.BuildFromTextStub())
+
+ newConfig.deviceNameToInstall = newConfig.productVariables.DeviceName
+
+ return newConfig, err
+}
+
+// Replace variables in config.productVariables that have tags with "generic" key.
+// A generic tag may have a string or an int value for the generic configuration.
+// If the value is "unset", generic configuration will unset the variable.
+func overrideGenericConfig(config *config) {
+ config.genericConfig.isGeneric = true
+ type_pv := reflect.TypeOf(config.genericConfig.productVariables)
+ value_pv := reflect.ValueOf(&config.genericConfig.productVariables)
+ for i := range type_pv.NumField() {
+ type_pv_field := type_pv.Field(i)
+ generic_value := type_pv_field.Tag.Get("generic")
+ // If a product variable has an annotation of "generic" tag, use the
+ // value of the tag to set the generic variable.
+ if generic_value != "" {
+ value_pv_field := value_pv.Elem().Field(i)
+
+ if generic_value == "unset" {
+ // unset the product variable
+ value_pv_field.SetZero()
+ continue
+ }
+
+ kind_of_type_pv := type_pv_field.Type.Kind()
+ is_pointer := false
+ if kind_of_type_pv == reflect.Pointer {
+ is_pointer = true
+ kind_of_type_pv = type_pv_field.Type.Elem().Kind()
+ }
+
+ switch kind_of_type_pv {
+ case reflect.String:
+ if is_pointer {
+ value_pv_field.Set(reflect.ValueOf(stringPtr(generic_value)))
+ } else {
+ value_pv_field.Set(reflect.ValueOf(generic_value))
+ }
+ case reflect.Int:
+ generic_int, err := strconv.Atoi(generic_value)
+ if err != nil {
+ panic(fmt.Errorf("Only an int value can be assigned to int variable: %s", err))
+ }
+ if is_pointer {
+ value_pv_field.Set(reflect.ValueOf(intPtr(generic_int)))
+ } else {
+ value_pv_field.Set(reflect.ValueOf(generic_int))
+ }
+ default:
+ panic(fmt.Errorf("Unknown type to replace for generic variable: %s", &kind_of_type_pv))
+ }
+ }
+ }
+
+ // OncePer must be a singleton.
+ config.genericConfig.OncePer = config.OncePer
+ // keep the device name to get the install path.
+ config.genericConfig.deviceNameToInstall = config.deviceNameToInstall
+}
+
+// NewConfig creates a new Config object. It also loads the config file, if
+// found. The Config object includes a duplicated Config object in it for the
+// generic configuration that does not provide any product specific information.
+func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error) {
+ config, err := initConfig(cmdArgs, availableEnv)
+ if err != nil {
+ return Config{}, err
+ }
+
+ // Initialize generic configuration.
+ config.genericConfig, err = initConfig(cmdArgs, availableEnv)
+ // Update product specific variables with the generic configuration.
+ overrideGenericConfig(config)
return Config{config}, err
}
@@ -951,7 +1038,7 @@
// require them to run and get the current build fingerprint. This ensures they
// don't rebuild on every incremental build when the build number changes.
func (c *config) BuildFingerprintFile(ctx PathContext) Path {
- return PathForArbitraryOutput(ctx, "target", "product", c.DeviceName(), String(c.productVariables.BuildFingerprintFile))
+ return PathForArbitraryOutput(ctx, "target", "product", *c.deviceNameToInstall, String(c.productVariables.BuildFingerprintFile))
}
// BuildNumberFile returns the path to a text file containing metadata
@@ -979,7 +1066,7 @@
// require them to run and get the current build thumbprint. This ensures they
// don't rebuild on every incremental build when the build thumbprint changes.
func (c *config) BuildThumbprintFile(ctx PathContext) Path {
- return PathForArbitraryOutput(ctx, "target", "product", c.DeviceName(), String(c.productVariables.BuildThumbprintFile))
+ return PathForArbitraryOutput(ctx, "target", "product", *c.deviceNameToInstall, String(c.productVariables.BuildThumbprintFile))
}
// DeviceName returns the name of the current device target.
diff --git a/android/config_test.go b/android/config_test.go
index d1b26c1..81b7c3e 100644
--- a/android/config_test.go
+++ b/android/config_test.go
@@ -281,3 +281,72 @@
})
}
}
+
+type configTestProperties struct {
+ Use_generic_config *bool
+}
+
+type configTestModule struct {
+ ModuleBase
+ properties configTestProperties
+}
+
+func (d *configTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
+ deviceName := ctx.Config().DeviceName()
+ if ctx.ModuleName() == "foo" {
+ if ctx.Module().UseGenericConfig() {
+ ctx.PropertyErrorf("use_generic_config", "must not be set for this test")
+ }
+ } else if ctx.ModuleName() == "bar" {
+ if !ctx.Module().UseGenericConfig() {
+ ctx.ModuleErrorf("\"use_generic_config: true\" must be set for this test")
+ }
+ }
+
+ if ctx.Module().UseGenericConfig() {
+ if deviceName != "generic" {
+ ctx.ModuleErrorf("Device name for this module must be \"generic\" but %q\n", deviceName)
+ }
+ } else {
+ if deviceName == "generic" {
+ ctx.ModuleErrorf("Device name for this module must not be \"generic\"\n")
+ }
+ }
+}
+
+func configTestModuleFactory() Module {
+ module := &configTestModule{}
+ module.AddProperties(&module.properties)
+ InitAndroidModule(module)
+ return module
+}
+
+var prepareForConfigTest = GroupFixturePreparers(
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("test", configTestModuleFactory)
+ }),
+)
+
+func TestGenericConfig(t *testing.T) {
+ bp := `
+ test {
+ name: "foo",
+ }
+
+ test {
+ name: "bar",
+ use_generic_config: true,
+ }
+ `
+
+ result := GroupFixturePreparers(
+ prepareForConfigTest,
+ FixtureWithRootAndroidBp(bp),
+ ).RunTest(t)
+
+ foo := result.Module("foo", "").(*configTestModule)
+ bar := result.Module("bar", "").(*configTestModule)
+
+ AssertBoolEquals(t, "Do not use generic config", false, foo.UseGenericConfig())
+ AssertBoolEquals(t, "Use generic config", true, bar.UseGenericConfig())
+}
diff --git a/android/configured_jars.go b/android/configured_jars.go
index c7b808f..657826e 100644
--- a/android/configured_jars.go
+++ b/android/configured_jars.go
@@ -264,7 +264,7 @@
subdir = filepath.Join("apex", apex, "javalib")
}
- if ostype.Class == Host {
+ if ostype.Class == Host || cfg.IsEnvTrue("ART_USE_SIMULATOR") {
paths[i] = filepath.Join(cfg.Getenv("OUT_DIR"), "host", cfg.PrebuiltOS(), subdir, name)
} else {
paths[i] = filepath.Join("/", subdir, name)
diff --git a/android/container.go b/android/container.go
index 5d223b8..547fe81 100644
--- a/android/container.go
+++ b/android/container.go
@@ -39,7 +39,7 @@
// Returns true if the dependency module is a stubs module
var depIsStubsModule exceptionHandleFunc = func(mctx ModuleContext, _ Module, dep ModuleProxy) bool {
- return OtherModuleProviderOrDefault(mctx, dep, CommonModuleInfoProvider).IsStubsModule
+ return OtherModulePointerProviderOrDefault(mctx, dep, CommonModuleInfoProvider).IsStubsModule
}
// Returns true if the dependency module belongs to any of the apexes.
diff --git a/android/early_module_context.go b/android/early_module_context.go
index 8d28285..300edf1 100644
--- a/android/early_module_context.go
+++ b/android/early_module_context.go
@@ -146,6 +146,13 @@
}
func (e *earlyModuleContext) Config() Config {
+ // Only the system image may use the generic config.
+ // If a module builds multiple image variations, provide the generic config only for the core
+ // variant which is installed in the system partition. Other image variant may still read the
+ // original configurations.
+ if e.Module().base().UseGenericConfig() && e.Module().base().commonProperties.ImageVariation == "" {
+ return e.EarlyModuleContext.Config().(Config).genericConfig()
+ }
return e.EarlyModuleContext.Config().(Config)
}
diff --git a/android/filegroup.go b/android/filegroup.go
index 9bcfd0a..4fad52a 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -33,7 +33,6 @@
func RegisterFilegroupBuildComponents(ctx RegistrationContext) {
ctx.RegisterModuleType("filegroup", FileGroupFactory)
ctx.RegisterModuleType("filegroup_defaults", FileGroupDefaultsFactory)
- ctx.RegisterModuleType("otatools_package_filegroup", OtatoolsFileGroupFactory)
}
type fileGroupProperties struct {
@@ -164,54 +163,3 @@
}
}
}
-
-type OtatoolsFileGroup struct {
- ModuleBase
-}
-
-func OtatoolsFileGroupFactory() Module {
- module := &OtatoolsFileGroup{}
- InitAndroidModule(module)
- AddLoadHook(module, func(ctx LoadHookContext) {
- module.createOTAToolsPackagefilegroup(ctx)
- })
- return module
-}
-
-func (fg *OtatoolsFileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
-}
-
-// Create the filegroup to collect cert files for otatools.zip.
-func (fg *OtatoolsFileGroup) createOTAToolsPackagefilegroup(ctx LoadHookContext) {
- ctx.CreateModuleInDirectory(
- FileGroupFactory,
- ".",
- &struct {
- Name *string
- Srcs []string
- Visibility []string
- }{
- Name: proptools.StringPtr("soong_generated_otatools_package_filegroup"),
- Srcs: []string{
- "build/make/target/product/security/**/*.x509.pem",
- "build/make/target/product/security/**/*.pk8",
- "device/**/*.pk8",
- "device/**/verifiedboot*",
- "device/**/*.pem",
- "device/**/oem*.prop",
- "device/**/*.avbpubkey",
- "external/avb/test/data/**/testkey_*.pem",
- "external/avb/test/data/**/atx_metadata.bin",
- "packages/modules/**/*.x509.pem",
- "packages/modules/**/*.pk8",
- "packages/modules/**/*.key.pem",
- "vendor/**/*.pk8",
- "vendor/**/verifiedboot*",
- "vendor/**/*.pem",
- "vendor/**/oem*.prop",
- "vendor/**/*.avbpubkey",
- },
- Visibility: []string{"//build/make/tools/otatools_package"},
- },
- )
-}
diff --git a/android/gen_notice.go b/android/gen_notice.go
index ae83118..45f90f4 100644
--- a/android/gen_notice.go
+++ b/android/gen_notice.go
@@ -60,7 +60,7 @@
for _, name := range gm.For {
mods := ctx.ModuleVariantsFromName(m, name)
for _, mod := range mods {
- if !OtherModuleProviderOrDefault(ctx, mod, CommonModuleInfoProvider).Enabled { // don't depend on variants without build rules
+ if !OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider).Enabled { // don't depend on variants without build rules
continue
}
modules = append(modules, mod)
diff --git a/android/license_metadata.go b/android/license_metadata.go
index e79febb..0b880dd 100644
--- a/android/license_metadata.go
+++ b/android/license_metadata.go
@@ -65,7 +65,7 @@
var allDepMetadataDepSets []depset.DepSet[Path]
ctx.VisitDirectDepsProxy(func(dep ModuleProxy) {
- if !OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider).Enabled {
+ if !OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider).Enabled {
return
}
diff --git a/android/logtags.go b/android/logtags.go
index ef7a612..074f402 100644
--- a/android/logtags.go
+++ b/android/logtags.go
@@ -43,7 +43,7 @@
func (l *logtagsSingleton) GenerateBuildActions(ctx SingletonContext) {
var allLogtags Paths
ctx.VisitAllModuleProxies(func(module ModuleProxy) {
- if !OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ExportedToMake {
+ if !OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ExportedToMake {
return
}
if logtagsInfo, ok := OtherModuleProvider(ctx, module, LogtagsProviderKey); ok {
diff --git a/android/makevars.go b/android/makevars.go
index e1d947d..7017e7d 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -259,7 +259,7 @@
singletonDists.lock.Unlock()
ctx.VisitAllModuleProxies(func(m ModuleProxy) {
- commonInfo, _ := OtherModuleProvider(ctx, m, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, m, CommonModuleInfoProvider)
if provider, ok := OtherModuleProvider(ctx, m, ModuleMakeVarsInfoProvider); ok &&
commonInfo.Enabled {
mctx := &makeVarsContext{
diff --git a/android/module.go b/android/module.go
index 334e5b7..87377cc 100644
--- a/android/module.go
+++ b/android/module.go
@@ -128,6 +128,9 @@
// WARNING: This should not be used outside build/soong/fsgen
// Overrides returns the list of modules which should not be installed if this module is installed.
Overrides() []string
+
+ // If this is true, the module must not read product-specific configurations.
+ UseGenericConfig() bool
}
// Qualified id for a module
@@ -507,6 +510,10 @@
// List of module names that are prevented from being installed when this module gets
// installed.
Overrides []string
+
+ // Set to true if this module must be generic and does not require product-specific information.
+ // To be included in the system image, this property must be set to true.
+ Use_generic_config *bool
}
// Properties common to all modules inheriting from ModuleBase. Unlike commonProperties, these
@@ -1002,11 +1009,19 @@
pv := ctx.Config().productVariables
fullManifest := pv.DeviceArch != nil && pv.DeviceName != nil
if fullManifest {
- addRequiredDeps(ctx)
addVintfFragmentDeps(ctx)
}
}
+// required property can be overridden too; handle it separately
+func (m *ModuleBase) baseOverridablePropertiesDepsMutator(ctx BottomUpMutatorContext) {
+ pv := ctx.Config().productVariables
+ fullManifest := pv.DeviceArch != nil && pv.DeviceName != nil
+ if fullManifest {
+ addRequiredDeps(ctx)
+ }
+}
+
// addRequiredDeps adds required, target_required, and host_required as dependencies.
func addRequiredDeps(ctx BottomUpMutatorContext) {
addDep := func(target Target, depName string) {
@@ -1488,7 +1503,7 @@
// Installation is still handled by Make, so anything hidden from Make is not
// installable.
info := OtherModuleProviderOrDefault(ctx, dep, InstallFilesProvider)
- commonInfo := OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider)
if !commonInfo.HideFromMake && !commonInfo.SkipInstall {
installDeps = append(installDeps, info.TransitiveInstallFiles)
}
@@ -1505,7 +1520,7 @@
// should also install the output files of the given dependency and dependency tag.
func isInstallDepNeeded(ctx ModuleContext, dep ModuleProxy) bool {
// Don't add a dependency from the platform to a library provided by an apex.
- if OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider).UninstallableApexPlatformVariant {
+ if OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider).UninstallableApexPlatformVariant {
return false
}
// Only install modules if the dependency tag is an InstallDepNeeded tag.
@@ -1928,7 +1943,7 @@
IsPlatform bool
}
-var CommonModuleInfoProvider = blueprint.NewProvider[CommonModuleInfo]()
+var CommonModuleInfoProvider = blueprint.NewProvider[*CommonModuleInfo]()
type PrebuiltModuleInfo struct {
SourceExists bool
@@ -2336,7 +2351,7 @@
if mm, ok := m.module.(interface{ BaseModuleName() string }); ok {
commonData.BaseModuleName = mm.BaseModuleName()
}
- SetProvider(ctx, CommonModuleInfoProvider, commonData)
+ SetProvider(ctx, CommonModuleInfoProvider, &commonData)
if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil {
SetProvider(ctx, PrebuiltModuleInfoProvider, PrebuiltModuleInfo{
SourceExists: p.Prebuilt().SourceExists(),
@@ -2580,6 +2595,10 @@
return m.commonProperties.Overrides
}
+func (m *ModuleBase) UseGenericConfig() bool {
+ return proptools.Bool(m.commonProperties.Use_generic_config)
+}
+
type ConfigContext interface {
Config() Config
}
diff --git a/android/module_proxy.go b/android/module_proxy.go
index 77abc11..561c477 100644
--- a/android/module_proxy.go
+++ b/android/module_proxy.go
@@ -231,3 +231,7 @@
func (m ModuleProxy) VintfFragments(ctx ConfigurableEvaluatorContext) []string {
panic("method is not implemented on ModuleProxy")
}
+
+func (m ModuleProxy) UseGenericConfig() bool {
+ panic("method is not implemented on ModuleProxy")
+}
diff --git a/android/neverallow.go b/android/neverallow.go
index 5c90501..e693f2d 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -388,6 +388,7 @@
"prebuilt_radio",
"prebuilt_gpu",
"prebuilt_vendor_overlay",
+ "prebuilt_tee",
).
DefinedInBpFile().
Because("module type not allowed to be defined in bp file")
diff --git a/android/override_module.go b/android/override_module.go
index 50ddc9b..96620ef 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -367,6 +367,7 @@
}
func overridableModuleDepsMutator(ctx BottomUpMutatorContext) {
+ ctx.Module().base().baseOverridablePropertiesDepsMutator(ctx)
if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled(ctx) {
b.OverridablePropertiesDepsMutator(ctx)
}
diff --git a/android/package.go b/android/package.go
index 0f6a767..52bddf9 100644
--- a/android/package.go
+++ b/android/package.go
@@ -62,7 +62,7 @@
}
func (p *packageModule) GenerateBuildActions(ctx blueprint.ModuleContext) {
- ctx.SetProvider(CommonModuleInfoProvider, CommonModuleInfo{
+ ctx.SetProvider(CommonModuleInfoProvider, &CommonModuleInfo{
Enabled: true,
PrimaryLicensesProperty: p.primaryLicensesProperty,
})
diff --git a/android/paths.go b/android/paths.go
index f7fcd35..6612d37 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -683,7 +683,7 @@
if module == nil {
return nil, missingDependencyError{[]string{moduleName}}
}
- if !OtherModuleProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled {
+ if !OtherModulePointerProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled {
return nil, missingDependencyError{[]string{moduleName}}
}
@@ -2054,7 +2054,7 @@
var partitionPaths []string
if os.Class == Device {
- partitionPaths = []string{"target", "product", ctx.Config().DeviceName(), partition}
+ partitionPaths = []string{"target", "product", *ctx.Config().deviceNameToInstall, partition}
} else {
osName := os.String()
if os == Linux {
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 0178f76..1ff009b 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -358,7 +358,7 @@
}
func IsModulePreferredProxy(ctx OtherModuleProviderContext, module ModuleProxy) bool {
- if OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt {
+ if OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt {
// A source module that has been replaced by a prebuilt counterpart.
return false
}
@@ -397,7 +397,7 @@
// the right module. This function is only safe to call after all TransitionMutators
// have run, e.g. in GenerateAndroidBuildActions.
func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module {
- if !OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt {
+ if !OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt {
return module
}
if _, ok := OtherModuleProvider(ctx, module, PrebuiltModuleInfoProvider); ok {
diff --git a/android/provider.go b/android/provider.go
index d005daf..aae93ef 100644
--- a/android/provider.go
+++ b/android/provider.go
@@ -41,6 +41,14 @@
return value
}
+func OtherModulePointerProviderOrDefault[K *T, T any](ctx OtherModuleProviderContext, module blueprint.Module, provider blueprint.ProviderKey[K]) K {
+ if value, ok := OtherModuleProvider(ctx, module, provider); ok {
+ return value
+ }
+ var val T
+ return &val
+}
+
// ModuleProviderContext is a helper interface that is a subset of ModuleContext or BottomUpMutatorContext
// for use in ModuleProvider.
type ModuleProviderContext interface {
diff --git a/android/test_config.go b/android/test_config.go
index 3609e6b..5d79df0 100644
--- a/android/test_config.go
+++ b/android/test_config.go
@@ -23,8 +23,7 @@
"github.com/google/blueprint/proptools"
)
-// TestConfig returns a Config object for testing.
-func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
+func initTestConfig(buildDir string, env map[string]string) *config {
envCopy := make(map[string]string)
for k, v := range env {
envCopy[k] = v
@@ -58,6 +57,7 @@
soongOutDir: filepath.Join(buildDir, "soong"),
captureBuild: true,
env: envCopy,
+ OncePer: &OncePer{},
// Set testAllowNonExistentPaths so that test contexts don't need to specify every path
// passed to PathForSource or PathForModuleSrc.
@@ -69,10 +69,21 @@
config: config,
}
config.TestProductVariables = &config.productVariables
+ config.deviceNameToInstall = config.TestProductVariables.DeviceName
+
+ determineBuildOS(config)
+
+ return config
+}
+
+// TestConfig returns a Config object for testing.
+func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
+ config := initTestConfig(buildDir, env)
config.mockFileSystem(bp, fs)
- determineBuildOS(config)
+ config.genericConfig = initTestConfig(buildDir, env)
+ overrideGenericConfig(config)
return Config{config}
}
diff --git a/android/testing.go b/android/testing.go
index 08c8083..d2949ec 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1197,11 +1197,11 @@
info := OtherModuleProviderOrDefault(ctx, mod, AndroidMkInfoProvider)
aconfigUpdateAndroidMkInfos(ctx, mod, info)
- commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider)
- info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo)
+ commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider)
+ info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo)
if len(info.ExtraInfo) > 0 {
for _, ei := range info.ExtraInfo {
- ei.fillInEntries(ctx, mod, &commonInfo)
+ ei.fillInEntries(ctx, mod, commonInfo)
}
}
diff --git a/android/variable.go b/android/variable.go
index c59857a..8c9a0b1 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -65,12 +65,6 @@
Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
} `android:"arch_variant"`
- // similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt
- // sdk specifically.
- Always_use_prebuilt_sdks struct {
- Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
- } `android:"arch_variant"`
-
Malloc_low_memory struct {
Cflags []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
@@ -231,8 +225,8 @@
Platform_version_last_stable *string `json:",omitempty"`
Platform_version_known_codenames *string `json:",omitempty"`
- DeviceName *string `json:",omitempty"`
- DeviceProduct *string `json:",omitempty"`
+ DeviceName *string `json:",omitempty" generic:"generic"`
+ DeviceProduct *string `json:",omitempty" generic:"generic"`
DeviceArch *string `json:",omitempty"`
DeviceArchVariant *string `json:",omitempty"`
DeviceCpuVariant *string `json:",omitempty"`
diff --git a/android/visibility.go b/android/visibility.go
index 416a3f1..9153687 100644
--- a/android/visibility.go
+++ b/android/visibility.go
@@ -551,7 +551,7 @@
rule := effectiveVisibilityRules(ctx.Config(), depQualified)
if !rule.matches(qualified) {
- ctx.ModuleErrorf("depends on %s which is not visible to this module\nYou may need to add %q to its visibility, %#v", depQualified, "//"+ctx.ModuleDir(), ctx.OtherModuleDependencyTag(dep))
+ ctx.ModuleErrorf("depends on %s which is not visible to this module\nYou may need to add %q to its visibility", depQualified, "//"+ctx.ModuleDir())
}
})
}
diff --git a/apex/apex.go b/apex/apex.go
index dc44e58..a726098 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -569,19 +569,6 @@
shBinary
)
-var (
- classes = map[string]apexFileClass{
- "app": app,
- "appSet": appSet,
- "etc": etc,
- "javaSharedLib": javaSharedLib,
- "nativeExecutable": nativeExecutable,
- "nativeSharedLib": nativeSharedLib,
- "nativeTest": nativeTest,
- "shBinary": shBinary,
- }
-)
-
// apexFile represents a file in an APEX bundle. This is created during the first half of
// GenerateAndroidBuildActions by traversing the dependencies of the APEX. Then in the second half
// of the function, this is used to create commands that copies the files into a staging directory,
@@ -1502,7 +1489,7 @@
func apexFileForJavaModuleWithFile(ctx android.ModuleContext, module android.Module,
javaInfo *java.JavaInfo, dexImplementationJar android.Path) apexFile {
dirInApex := "javalib"
- commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
af := newApexFile(ctx, dexImplementationJar, commonInfo.BaseModuleName, dirInApex, javaSharedLib, module)
af.jacocoReportClassesFile = javaInfo.JacocoReportClassesFile
if lintInfo, ok := android.OtherModuleProvider(ctx, module, java.LintProvider); ok {
@@ -1608,7 +1595,7 @@
// modules. This is used in check* functions below.
func (a *apexBundle) WalkPayloadDeps(ctx android.BaseModuleContext, do android.PayloadDepsCallback) {
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).CanHaveApexVariants {
+ if !android.OtherModulePointerProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).CanHaveApexVariants {
return false
}
// Filter-out unwanted depedendencies
@@ -1821,7 +1808,7 @@
if _, ok := depTag.(android.ExcludeFromApexContentsTag); ok {
return false
}
- commonInfo := android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, child, android.CommonModuleInfoProvider)
if !commonInfo.Enabled {
return false
}
@@ -1839,7 +1826,7 @@
if ch.IsStubs {
ctx.PropertyErrorf(propertyName, "%q is a stub. Remove it from the list.", depName)
}
- fi := apexFileForNativeLibrary(ctx, child, &commonInfo, ch, vctx.handleSpecialLibs)
+ fi := apexFileForNativeLibrary(ctx, child, commonInfo, ch, vctx.handleSpecialLibs)
fi.isJniLib = isJniLib
vctx.filesInfo = append(vctx.filesInfo, fi)
// Collect the list of stub-providing libs except:
@@ -1856,11 +1843,11 @@
case executableTag:
if ccInfo, ok := android.OtherModuleProvider(ctx, child, cc.CcInfoProvider); ok {
- vctx.filesInfo = append(vctx.filesInfo, apexFileForExecutable(ctx, child, &commonInfo, ccInfo))
+ vctx.filesInfo = append(vctx.filesInfo, apexFileForExecutable(ctx, child, commonInfo, ccInfo))
return true // track transitive dependencies
}
if _, ok := android.OtherModuleProvider(ctx, child, rust.RustInfoProvider); ok {
- vctx.filesInfo = append(vctx.filesInfo, apexFileForRustExecutable(ctx, child, &commonInfo))
+ vctx.filesInfo = append(vctx.filesInfo, apexFileForRustExecutable(ctx, child, commonInfo))
return true // track transitive dependencies
} else {
ctx.PropertyErrorf("binaries",
@@ -1868,7 +1855,7 @@
}
case shBinaryTag:
if csh, ok := android.OtherModuleProvider(ctx, child, sh.ShBinaryInfoProvider); ok {
- vctx.filesInfo = append(vctx.filesInfo, apexFileForShBinary(ctx, child, &commonInfo, &csh))
+ vctx.filesInfo = append(vctx.filesInfo, apexFileForShBinary(ctx, child, commonInfo, &csh))
} else {
ctx.PropertyErrorf("sh_binaries", "%q is not a sh_binary module", depName)
}
@@ -1922,7 +1909,7 @@
af.certificate = java.PresignedCertificate
vctx.filesInfo = append(vctx.filesInfo, af)
} else {
- vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, child, &commonInfo, appInfo)...)
+ vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, child, commonInfo, appInfo)...)
if !appInfo.Prebuilt && !appInfo.TestHelperApp {
return true // track transitive dependencies
}
@@ -1969,8 +1956,12 @@
}
case testTag:
if ccInfo, ok := android.OtherModuleProvider(ctx, child, cc.CcInfoProvider); ok {
- af := apexFileForExecutable(ctx, child, &commonInfo, ccInfo)
- af.class = nativeTest
+ af := apexFileForExecutable(ctx, child, commonInfo, ccInfo)
+ // We make this a nativeExecutable instead of a nativeTest because we don't want
+ // the androidmk modules generated in AndroidMkForFiles to be treated as real
+ // tests that are then packaged into suites. Our AndroidMkForFiles does not
+ // implement enough functionality to support real tests.
+ af.class = nativeExecutable
vctx.filesInfo = append(vctx.filesInfo, af)
return true // track transitive dependencies
} else {
@@ -2006,7 +1997,7 @@
// tags used below are private (e.g. `cc.sharedDepTag`).
if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) {
if ch, ok := android.OtherModuleProvider(ctx, child, cc.LinkableInfoProvider); ok {
- af := apexFileForNativeLibrary(ctx, child, &commonInfo, ch, vctx.handleSpecialLibs)
+ af := apexFileForNativeLibrary(ctx, child, commonInfo, ch, vctx.handleSpecialLibs)
af.transitiveDep = true
if ch.IsStubs || ch.HasStubsVariants {
@@ -2068,7 +2059,7 @@
}
linkableInfo := android.OtherModuleProviderOrDefault(ctx, child, cc.LinkableInfoProvider)
- af := apexFileForNativeLibrary(ctx, child, &commonInfo, linkableInfo, vctx.handleSpecialLibs)
+ af := apexFileForNativeLibrary(ctx, child, commonInfo, linkableInfo, vctx.handleSpecialLibs)
af.transitiveDep = true
vctx.filesInfo = append(vctx.filesInfo, af)
return true // track transitive dependencies
@@ -2100,7 +2091,7 @@
javaInfo := android.OtherModuleProviderOrDefault(ctx, child, java.JavaInfoProvider)
af := apexFileForJavaModule(ctx, child, javaInfo)
vctx.filesInfo = append(vctx.filesInfo, af)
- if profileAf := apexFileForJavaModuleProfile(ctx, &commonInfo, javaInfo); profileAf != nil {
+ if profileAf := apexFileForJavaModuleProfile(ctx, commonInfo, javaInfo); profileAf != nil {
vctx.filesInfo = append(vctx.filesInfo, *profileAf)
}
return true // track transitive dependencies
@@ -2116,7 +2107,7 @@
ctx.ModuleErrorf("unexpected tag %s for indirect dependency %q", android.PrettyPrintTag(depTag), depName)
} else if android.IsVintfDepTag(depTag) {
if vf, ok := android.OtherModuleProvider(ctx, child, android.VintfFragmentInfoProvider); ok {
- apexFile := apexFileForVintfFragment(ctx, child, &commonInfo, &vf)
+ apexFile := apexFileForVintfFragment(ctx, child, commonInfo, &vf)
vctx.filesInfo = append(vctx.filesInfo, apexFile)
}
}
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index 0bf4ba7..797f47b 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -164,7 +164,7 @@
prebuiltInfo, exists := android.OtherModuleProvider(ctx, m, android.PrebuiltInfoProvider)
// Use prebuiltInfoProvider to filter out non apex soong modules.
// Use HideFromMake to filter out the unselected variants of a specific apex.
- if exists && !android.OtherModuleProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).HideFromMake {
+ if exists && !android.OtherModulePointerProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).HideFromMake {
prebuiltInfos = append(prebuiltInfos, prebuiltInfo)
}
})
diff --git a/apex/builder.go b/apex/builder.go
index 8042a3b..23c2ed8 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -1111,7 +1111,7 @@
// Skip dependencies that are only available to APEXes; they are developed with updatability
// in mind and don't need manual approval.
- if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform {
+ if android.OtherModulePointerProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform {
return !externalDep
}
diff --git a/bloaty/bloaty.go b/bloaty/bloaty.go
index a076d47..d78a907 100644
--- a/bloaty/bloaty.go
+++ b/bloaty/bloaty.go
@@ -85,7 +85,7 @@
func (singleton *sizesSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var deps android.Paths
ctx.VisitAllModuleProxies(func(m android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).ExportedToMake {
+ if !android.OtherModulePointerProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).ExportedToMake {
return
}
filePaths, ok := android.OtherModuleProvider(ctx, m, fileSizeMeasurerKey)
diff --git a/cc/cc.go b/cc/cc.go
index ae6f3b0..85d2ebf 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3422,7 +3422,7 @@
return
}
- commonInfo := android.OtherModuleProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
if commonInfo.Target.Os != ctx.Os() {
ctx.ModuleErrorf("OS mismatch between %q (%s) and %q (%s)", ctx.ModuleName(), ctx.Os().Name, depName, dep.Target().Os.Name)
return
@@ -3676,7 +3676,7 @@
c.sabi.Properties.ReexportedSystemIncludes, depExporterInfo.SystemIncludeDirs.Strings()...)
}
- makeLibName := MakeLibName(ccInfo, linkableInfo, &commonInfo, commonInfo.BaseModuleName) + libDepTag.makeSuffix
+ makeLibName := MakeLibName(ccInfo, linkableInfo, commonInfo, commonInfo.BaseModuleName) + libDepTag.makeSuffix
switch {
case libDepTag.header():
c.Properties.AndroidMkHeaderLibs = append(
@@ -3703,7 +3703,7 @@
switch depTag {
case runtimeDepTag:
c.Properties.AndroidMkRuntimeLibs = append(
- c.Properties.AndroidMkRuntimeLibs, MakeLibName(ccInfo, linkableInfo, &commonInfo,
+ c.Properties.AndroidMkRuntimeLibs, MakeLibName(ccInfo, linkableInfo, commonInfo,
commonInfo.BaseModuleName)+libDepTag.makeSuffix)
case objDepTag:
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
@@ -3779,7 +3779,7 @@
// platform APIs, use stubs only when it is from an APEX (and not from
// platform) However, for host, ramdisk, vendor_ramdisk, recovery or
// bootstrap modules, always link to non-stub variant
- isNotInPlatform := android.OtherModuleProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider).NotInPlatform
+ isNotInPlatform := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider).NotInPlatform
useStubs = isNotInPlatform && !bootstrap
} else {
diff --git a/cc/compdb.go b/cc/compdb.go
index 4132e09..3818e9c 100644
--- a/cc/compdb.go
+++ b/cc/compdb.go
@@ -193,7 +193,7 @@
}
builds[src.String()] = compDbEntry{
Directory: android.AbsSrcDirForExistingUseCases(),
- Arguments: getArguments(src, ctx, ccModule, ccPath, cxxPath),
+ Arguments: args,
File: src.String(),
}
}
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index 45b1580..25edb79 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -53,6 +53,16 @@
"-mbranch-protection=standard",
"-fno-stack-protector",
},
+ "armv9-3a": []string{
+ "-march=armv9.3-a",
+ "-mbranch-protection=standard",
+ "-fno-stack-protector",
+ },
+ "armv9-4a": []string{
+ "-march=armv9.4-a",
+ "-mbranch-protection=standard",
+ "-fno-stack-protector",
+ },
}
arm64Ldflags = []string{
diff --git a/cc/fuzz.go b/cc/fuzz.go
index ba34387..79874fc 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -486,7 +486,7 @@
sharedLibsInstallDirPrefix = "lib/vendor"
}
- commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
isHost := commonInfo.Target.Os.Class == android.Host
hostOrTargetString := "target"
if commonInfo.Target.HostCross {
diff --git a/cc/ndk_abi.go b/cc/ndk_abi.go
index a59cc11..b96a779 100644
--- a/cc/ndk_abi.go
+++ b/cc/ndk_abi.go
@@ -40,7 +40,7 @@
func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var depPaths android.Paths
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
@@ -78,7 +78,7 @@
func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var depPaths android.Paths
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go
index 82a19d0..1677862 100644
--- a/cc/ndk_sysroot.go
+++ b/cc/ndk_sysroot.go
@@ -212,7 +212,7 @@
var licensePaths android.Paths
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index b704ef4..f0b0308 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1422,6 +1422,7 @@
sanitizers = append(sanitizers,
"bool",
"integer-divide-by-zero",
+ "object-size",
"return",
"returns-nonnull-attribute",
"shift-exponent",
@@ -1438,10 +1439,6 @@
//"shift-base",
//"signed-integer-overflow",
)
-
- if mctx.Config().ReleaseBuildObjectSizeSanitizer() {
- sanitizers = append(sanitizers, "object-size")
- }
}
sanitizers = append(sanitizers, sanProps.Misc_undefined...)
}
diff --git a/cc/tidy.go b/cc/tidy.go
index e8e1dc2..bf273e9 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -220,7 +220,7 @@
// (1) Collect all obj/tidy files into OS-specific groups.
ctx.VisitAllModuleVariantProxies(module, func(variant android.ModuleProxy) {
- osName := android.OtherModuleProviderOrDefault(ctx, variant, android.CommonModuleInfoProvider).Target.Os.Name
+ osName := android.OtherModulePointerProviderOrDefault(ctx, variant, android.CommonModuleInfoProvider).Target.Os.Name
info := android.OtherModuleProviderOrDefault(ctx, variant, CcObjectInfoProvider)
addToOSGroup(osName, info.ObjFiles, allObjFileGroups, subsetObjFileGroups)
addToOSGroup(osName, info.TidyFiles, allTidyFileGroups, subsetTidyFileGroups)
diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go
index 95249aa..d7aaa66 100644
--- a/ci_tests/ci_test_package_zip.go
+++ b/ci_tests/ci_test_package_zip.go
@@ -284,6 +284,10 @@
android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(p.output),
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
+ }},
},
}
}
diff --git a/cmd/find_input_delta/find_input_delta_lib/internal_state.go b/cmd/find_input_delta/find_input_delta_lib/internal_state.go
index bf4f866..0f88159 100644
--- a/cmd/find_input_delta/find_input_delta_lib/internal_state.go
+++ b/cmd/find_input_delta/find_input_delta_lib/internal_state.go
@@ -95,9 +95,14 @@
}
ret := []*fid_proto.PartialCompileInput{}
for _, v := range rc.File {
+ // Only include timestamp when there is no CRC.
+ timeNsec := proto.Int64(v.ModTime().UnixNano())
+ if v.CRC32 != 0 {
+ timeNsec = nil
+ }
pci := &fid_proto.PartialCompileInput{
Name: proto.String(v.Name),
- MtimeNsec: proto.Int64(v.ModTime().UnixNano()),
+ MtimeNsec: timeNsec,
Hash: proto.String(fmt.Sprintf("%08x", v.CRC32)),
}
ret = append(ret, pci)
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index 9cec9db..af09dbc 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -139,6 +139,11 @@
// Returns all jars that system_server loads.
func (g *GlobalConfig) AllSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
+ // dexpreopt does not initialize the soong config.
+ // Initialize the OncePer here.
+ if ctx.Config().OncePer == nil {
+ ctx.Config().OncePer = &android.OncePer{}
+ }
return ctx.Config().Once(allSystemServerJarsKey, func() interface{} {
res := g.AllPlatformSystemServerJars(ctx).AppendList(g.AllApexSystemServerJars(ctx))
return &res
@@ -464,7 +469,7 @@
func (d dex2oatDependencyTag) AllowDisabledModuleDependencyProxy(
ctx android.OtherModuleProviderContext, target android.ModuleProxy) bool {
- return android.OtherModuleProviderOrDefault(
+ return android.OtherModulePointerProviderOrDefault(
ctx, target, android.CommonModuleInfoProvider).ReplacedByPrebuilt
}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 3b0c032..7820047 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -78,6 +78,7 @@
ctx.RegisterModuleType("prebuilt_rfs", PrebuiltRfsFactory)
ctx.RegisterModuleType("prebuilt_framework", PrebuiltFrameworkFactory)
ctx.RegisterModuleType("prebuilt_res", PrebuiltResFactory)
+ ctx.RegisterModuleType("prebuilt_tee", PrebuiltTeeFactory)
ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory)
ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory)
ctx.RegisterModuleType("prebuilt_vendor_dlkm", PrebuiltVendorDlkmFactory)
@@ -910,6 +911,16 @@
return module
}
+// prebuilt_tee installs files in <partition>/tee directory.
+func PrebuiltTeeFactory() android.Module {
+ module := &PrebuiltEtc{}
+ InitPrebuiltEtcModule(module, "tee")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ android.InitDefaultableModule(module)
+ return module
+}
+
// prebuilt_media installs media files in <partition>/media directory.
func PrebuiltMediaFactory() android.Module {
module := &PrebuiltEtc{}
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index af14e81..f8faa49 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -1552,7 +1552,7 @@
deps := f.gatherFilteredPackagingSpecs(ctx)
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
return false
}
for _, ps := range android.OtherModuleProviderOrDefault(
@@ -1573,7 +1573,7 @@
var requireModules []android.ModuleProxy
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
return false
}
_, parentInPackage := modulesInPackageByModule[parent]
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 6d0b490..bf7f5b6 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -723,26 +723,47 @@
// override_android_* modules implicitly override their base module.
// If both of these are listed in `deps`, the base module should not be installed.
+// Also, required deps should be updated too.
func TestOverrideModulesInDeps(t *testing.T) {
result := fixture.RunTestWithBp(t, `
+ cc_library_shared {
+ name: "libfoo",
+ stl: "none",
+ system_shared_libs: [],
+ }
+ cc_library_shared {
+ name: "libbar",
+ stl: "none",
+ system_shared_libs: [],
+ }
android_filesystem {
name: "myfilesystem",
+ deps: ["myapp"],
+ }
+ android_filesystem {
+ name: "myfilesystem_overridden",
deps: ["myapp", "myoverrideapp"],
}
android_app {
name: "myapp",
platform_apis: true,
+ required: ["libfoo"],
}
override_android_app {
name: "myoverrideapp",
base: "myapp",
+ required: ["libbar"],
}
`)
partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
- android.AssertStringEquals(t, "filesystem with override app", "app/myoverrideapp/myoverrideapp.apk\n", fileList)
+ android.AssertStringEquals(t, "filesystem without override app", "app/myapp/myapp.apk\nlib64/libfoo.so\n", fileList)
+
+ overriddenPartition := result.ModuleForTests(t, "myfilesystem_overridden", "android_common")
+ overriddenFileList := android.ContentFromFileRuleForTests(t, result.TestContext, overriddenPartition.Output("fileList"))
+ android.AssertStringEquals(t, "filesystem with override app", "app/myoverrideapp/myoverrideapp.apk\nlib64/libbar.so\n", overriddenFileList)
}
func TestRamdiskPartitionSetsDevNodes(t *testing.T) {
diff --git a/fsgen/filesystem_creator_test.go b/fsgen/filesystem_creator_test.go
index 81236a0..651d2d1 100644
--- a/fsgen/filesystem_creator_test.go
+++ b/fsgen/filesystem_creator_test.go
@@ -312,14 +312,14 @@
}),
).RunTest(t)
- checkModuleProp := func(m android.Module, matcher func(actual interface{}) bool) bool {
+ getModuleProp := func(m android.Module, matcher func(actual interface{}) string) string {
for _, prop := range m.GetProperties() {
- if matcher(prop) {
- return true
+ if str := matcher(prop); str != "" {
+ return str
}
}
- return false
+ return ""
}
// check generated prebuilt_* module type install path and install partition
@@ -350,6 +350,37 @@
etcModule.SubDir(),
)
+ // check that generated prebuilt_* module sets correct srcs
+ eval := generatedModule.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct srcs property",
+ "Vendor_0079_Product_0011.kl",
+ getModuleProp(generatedModule, func(actual interface{}) string {
+ if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
+ srcs := p.Srcs.GetOrDefault(eval, nil)
+ if len(srcs) == 2 {
+ return srcs[0]
+ }
+ }
+ return ""
+ }),
+ )
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct srcs property",
+ "Vendor_0079_Product_18d4.kl",
+ getModuleProp(generatedModule, func(actual interface{}) string {
+ if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
+ srcs := p.Srcs.GetOrDefault(eval, nil)
+ if len(srcs) == 2 {
+ return srcs[1]
+ }
+ }
+ return ""
+ }),
+ )
+
// check that prebuilt_* module is not generated for non existing source file
android.AssertStringEquals(
t,
@@ -363,60 +394,130 @@
generatedModule1 := result.ModuleForTests(t, "product-device_sample_etc-etc-1", "android_arm64_armv8-a").Module()
// check that generated prebuilt_* module sets correct srcs and dsts property
- eval := generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
- android.AssertBoolEquals(
+ eval = generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
+ android.AssertStringEquals(
t,
"module expected to set correct srcs property",
- true,
- checkModuleProp(generatedModule0, func(actual interface{}) bool {
+ "apns-full-conf.xml",
+ getModuleProp(generatedModule0, func(actual interface{}) string {
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
srcs := p.Srcs.GetOrDefault(eval, nil)
- return len(srcs) == 1 &&
- srcs[0] == "apns-full-conf.xml"
+ if len(srcs) == 1 {
+ return srcs[0]
+ }
}
- return false
+ return ""
}),
)
- android.AssertBoolEquals(
+ android.AssertStringEquals(
t,
"module expected to set correct dsts property",
- true,
- checkModuleProp(generatedModule0, func(actual interface{}) bool {
+ "apns-conf.xml",
+ getModuleProp(generatedModule0, func(actual interface{}) string {
if p, ok := actual.(*etc.PrebuiltDstsProperties); ok {
dsts := p.Dsts.GetOrDefault(eval, nil)
- return len(dsts) == 1 &&
- dsts[0] == "apns-conf.xml"
+ if len(dsts) == 1 {
+ return dsts[0]
+ }
}
- return false
+ return ""
}),
)
// check that generated prebuilt_* module sets correct srcs and dsts property
eval = generatedModule1.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
- android.AssertBoolEquals(
+ android.AssertStringEquals(
t,
"module expected to set correct srcs property",
- true,
- checkModuleProp(generatedModule1, func(actual interface{}) bool {
+ "apns-full-conf.xml",
+ getModuleProp(generatedModule1, func(actual interface{}) string {
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
srcs := p.Srcs.GetOrDefault(eval, nil)
- return len(srcs) == 1 &&
- srcs[0] == "apns-full-conf.xml"
+ if len(srcs) == 1 {
+ return srcs[0]
+ }
}
- return false
+ return ""
}),
)
- android.AssertBoolEquals(
+ android.AssertStringEquals(
t,
"module expected to set correct dsts property",
- true,
- checkModuleProp(generatedModule1, func(actual interface{}) bool {
+ "apns-conf-2.xml",
+ getModuleProp(generatedModule1, func(actual interface{}) string {
if p, ok := actual.(*etc.PrebuiltDstsProperties); ok {
dsts := p.Dsts.GetOrDefault(eval, nil)
- return len(dsts) == 1 &&
- dsts[0] == "apns-conf-2.xml"
+ if len(dsts) == 1 {
+ return dsts[0]
+ }
}
- return false
+ return ""
+ }),
+ )
+
+ generatedModule0 = result.ModuleForTests(t, "system-device_sample_etc-foo-0", "android_common").Module()
+ generatedModule1 = result.ModuleForTests(t, "system-device_sample_etc-foo-1", "android_common").Module()
+
+ // check that generated prebuilt_* module sets correct srcs and dsts property
+ eval = generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct srcs property",
+ "apns-full-conf.xml",
+ getModuleProp(generatedModule0, func(actual interface{}) string {
+ if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
+ srcs := p.Srcs.GetOrDefault(eval, nil)
+ if len(srcs) == 1 {
+ return srcs[0]
+ }
+ }
+ return ""
+ }),
+ )
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct dsts property",
+ "foo/file.txt",
+ getModuleProp(generatedModule0, func(actual interface{}) string {
+ if p, ok := actual.(*etc.PrebuiltDstsProperties); ok {
+ dsts := p.Dsts.GetOrDefault(eval, nil)
+ if len(dsts) == 1 {
+ return dsts[0]
+ }
+ }
+ return ""
+ }),
+ )
+
+ // check generated prebuilt_* module specifies correct install path and relative install path
+ etcModule, _ = generatedModule1.(*etc.PrebuiltEtc)
+ android.AssertStringEquals(
+ t,
+ "module expected to have . install path",
+ ".",
+ etcModule.BaseDir(),
+ )
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct relative_install_path properties",
+ "foo",
+ etcModule.SubDir(),
+ )
+
+ // check that generated prebuilt_* module sets correct srcs
+ eval = generatedModule1.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
+ android.AssertStringEquals(
+ t,
+ "module expected to set correct srcs property",
+ "apns-full-conf.xml",
+ getModuleProp(generatedModule1, func(actual interface{}) string {
+ if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
+ srcs := p.Srcs.GetOrDefault(eval, nil)
+ if len(srcs) == 1 {
+ return srcs[0]
+ }
+ }
+ return ""
}),
)
}
diff --git a/fsgen/prebuilt_etc_modules_gen.go b/fsgen/prebuilt_etc_modules_gen.go
index df36197..e9dabe4 100644
--- a/fsgen/prebuilt_etc_modules_gen.go
+++ b/fsgen/prebuilt_etc_modules_gen.go
@@ -215,6 +215,7 @@
"system": etc.PrebuiltSystemFactory,
"res": etc.PrebuiltResFactory,
"rfs": etc.PrebuiltRfsFactory,
+ "tee": etc.PrebuiltTeeFactory,
"tts": etc.PrebuiltVoicepackFactory,
"tvconfig": etc.PrebuiltTvConfigFactory,
"tvservice": etc.PrebuiltTvServiceFactory,
@@ -340,28 +341,35 @@
// Set appropriate srcs, dsts, and releative_install_path based on
// the source and install file names
- if allCopyFileNamesUnchanged {
- modulePropsPtr.Srcs = srcBaseFiles
+ modulePropsPtr.Srcs = srcBaseFiles
- // Specify relative_install_path if it is not installed in the root directory of the
- // partition
+ // prebuilt_root should only be used in very limited cases in prebuilt_etc moddule gen, where:
+ // - all source file names are identical to the installed file names, and
+ // - all source files are installed in root, not the subdirectories of root
+ // prebuilt_root currently does not have a good way to specify the names of the multiple
+ // installed files, and prebuilt_root does not allow installing files at a subdirectory
+ // of the root.
+ // Use prebuilt_any instead of prebuilt_root if either of the conditions are not met as
+ // a fallback behavior.
+ if etcInstallPathKey == "" {
+ if !(allCopyFileNamesUnchanged && android.InList(relDestDirFromInstallDirBase, []string{"", "."})) {
+ moduleFactory = etc.PrebuiltAnyFactory
+ }
+ }
+
+ if allCopyFileNamesUnchanged {
+ // Specify relative_install_path if it is not installed in the base directory of the module.
+ // In case of prebuilt_{root,any} this is equivalent to the root of the partition.
if !android.InList(relDestDirFromInstallDirBase, []string{"", "."}) {
propsList = append(propsList, &prebuiltSubdirProperties{
Relative_install_path: proptools.StringPtr(relDestDirFromInstallDirBase),
})
}
} else {
- // If dsts property has to be set and the selected module type is prebuilt_root,
- // use prebuilt_any instead.
- if etcInstallPathKey == "" {
- moduleFactory = etc.PrebuiltAnyFactory
- }
- modulePropsPtr.Srcs = srcBaseFiles
dsts := proptools.NewConfigurable[[]string](nil, nil)
for _, installBaseFile := range installBaseFiles {
dsts.AppendSimpleValue([]string{filepath.Join(relDestDirFromInstallDirBase, installBaseFile)})
}
-
propsList = append(propsList, &etc.PrebuiltDstsProperties{
Dsts: dsts,
})
diff --git a/genrule/genrule.go b/genrule/genrule.go
index e976e6b..710ec95 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -112,7 +112,7 @@
func (t hostToolDependencyTag) AllowDisabledModuleDependencyProxy(
ctx android.OtherModuleProviderContext, target android.ModuleProxy) bool {
- return android.OtherModuleProviderOrDefault(
+ return android.OtherModulePointerProviderOrDefault(
ctx, target, android.CommonModuleInfoProvider).ReplacedByPrebuilt
}
@@ -353,7 +353,7 @@
if h, ok := android.OtherModuleProvider(ctx, module, android.HostToolProviderInfoProvider); ok {
// A HostToolProvider provides the path to a tool, which will be copied
// into the sandbox.
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
if ctx.Config().AllowMissingDependencies() {
ctx.AddMissingDependencies([]string{tool})
} else {
diff --git a/java/app.go b/java/app.go
index 560129b..553c658 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1233,7 +1233,7 @@
seenModulePaths := make(map[string]bool)
ctx.WalkDepsProxy(func(module, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return false
}
otherName := ctx.OtherModuleName(module)
@@ -1253,7 +1253,7 @@
}
seenModulePaths[path.String()] = true
- commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
if checkNativeSdkVersion && commonInfo.SdkVersion == "" {
ctx.PropertyErrorf("jni_libs", "JNI dependency %q uses platform APIs, but this module does not",
otherName)
@@ -1316,7 +1316,7 @@
// Skip dependencies that are only available to APEXes; they are developed with updatability
// in mind and don't need manual approval.
- if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform {
+ if android.OtherModulePointerProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform {
return true
}
diff --git a/java/base.go b/java/base.go
index 8453a68..1a12075 100644
--- a/java/base.go
+++ b/java/base.go
@@ -629,7 +629,7 @@
return nil
}
if info.SdkVersion.Kind == android.SdkCorePlatform {
- if useLegacyCorePlatformApi(ctx, android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).BaseModuleName) {
+ if useLegacyCorePlatformApi(ctx, android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).BaseModuleName) {
return fmt.Errorf("non stable SDK %v - uses legacy core platform", info.SdkVersion)
} else {
// Treat stable core platform as stable.
diff --git a/java/java.go b/java/java.go
index 7f897a0..dd9f852 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2235,7 +2235,7 @@
// install these alongside the java binary.
ctx.VisitDirectDepsProxyWithTag(jniInstallTag, func(jni android.ModuleProxy) {
// Use the BaseModuleName of the dependency (without any prebuilt_ prefix)
- commonInfo, _ := android.OtherModuleProvider(ctx, jni, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, jni, android.CommonModuleInfoProvider)
j.androidMkNamesOfJniLibs = append(j.androidMkNamesOfJniLibs, commonInfo.BaseModuleName+":"+commonInfo.Target.Arch.ArchType.Bitness())
})
// Check that native libraries are not listed in `required`. Prompt users to use `jni_libs` instead.
diff --git a/java/jdeps.go b/java/jdeps.go
index 7ef6c89..56142c8 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -46,7 +46,7 @@
moduleInfos := make(map[string]android.IdeInfo)
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
diff --git a/java/lint.go b/java/lint.go
index 61b50dc..dc1e51f 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -659,7 +659,7 @@
var outputs []*LintInfo
var dirs []string
ctx.VisitAllModuleProxies(func(m android.ModuleProxy) {
- commonInfo, _ := android.OtherModuleProvider(ctx, m, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, m, android.CommonModuleInfoProvider)
if ctx.Config().KatiEnabled() && !commonInfo.ExportedToMake {
return
}
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index b2d6ca1..d2ec8bd 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -277,7 +277,7 @@
var compatConfigMetadata android.Paths
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
if c, ok := android.OtherModuleProvider(ctx, module, PlatformCompatConfigMetadataInfoProvider); ok {
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index d117c52..925d7b1 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -127,7 +127,7 @@
for _, m := range requireModules {
if _, ok := android.OtherModuleProvider(ctx, m, cc.CcInfoProvider); ok {
if android.OtherModuleProviderOrDefault(ctx, m, cc.LinkableInfoProvider).HasStubsVariants &&
- !android.OtherModuleProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).Host {
+ !android.OtherModulePointerProviderOrDefault(ctx, m, android.CommonModuleInfoProvider).Host {
name := ctx.OtherModuleName(m)
if ccInfo, ok := android.OtherModuleProvider(ctx, m, cc.CcInfoProvider); ok && ccInfo.LinkerInfo != nil && ccInfo.LinkerInfo.ImplementationModuleName != nil {
name = *ccInfo.LinkerInfo.ImplementationModuleName
diff --git a/python/python.go b/python/python.go
index e2786b8..de21e39 100644
--- a/python/python.go
+++ b/python/python.go
@@ -768,7 +768,7 @@
Rule: zip,
Description: "bundle shared libraries for python binary",
Output: srcsZip,
- Implicits: paths,
+ Implicits: paths,
Args: map[string]string{
"args": strings.Join(parArgs, " "),
},
@@ -776,7 +776,6 @@
return srcsZip
}
-
// chckForDuplicateOutputPath checks whether outputPath has already been included in map m, which
// would result in two files being placed in the same location.
// If there is a duplicate path, an error is thrown and true is returned
diff --git a/rust/config/arm64_device.go b/rust/config/arm64_device.go
index 94a4457..efcd56a 100644
--- a/rust/config/arm64_device.go
+++ b/rust/config/arm64_device.go
@@ -45,6 +45,14 @@
"-Z branch-protection=bti,pac-ret",
"-Z stack-protector=none",
},
+ "armv9-3a": []string{
+ "-Z branch-protection=bti,pac-ret",
+ "-Z stack-protector=none",
+ },
+ "armv9-4a": []string{
+ "-Z branch-protection=bti,pac-ret",
+ "-Z stack-protector=none",
+ },
}
)
diff --git a/rust/doc.go b/rust/doc.go
index cf2f8b3..3616c8e 100644
--- a/rust/doc.go
+++ b/rust/doc.go
@@ -38,7 +38,7 @@
FlagWithArg("-D ", docDir.String())
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
+ if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled {
return
}
diff --git a/rust/image.go b/rust/image.go
index 51b8289..aa10a6d 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -137,7 +137,7 @@
// Additionally check if this module is inVendor() that means it is a "vendor" variant of a
// module. As well as SoC specific modules, vendor variants must be installed to /vendor
// unless they have "odm_available: true".
- return mod.InVendor() && !mod.VendorVariantToOdm()
+ return mod.HasVendorVariant() && mod.InVendor() && !mod.VendorVariantToOdm()
}
func (mod *Module) InstallInOdm() bool {
diff --git a/rust/rust.go b/rust/rust.go
index 5f3d7a9..54b5d92 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1480,10 +1480,10 @@
rustInfo, hasRustInfo := android.OtherModuleProvider(ctx, dep, RustInfoProvider)
ccInfo, _ := android.OtherModuleProvider(ctx, dep, cc.CcInfoProvider)
linkableInfo, hasLinkableInfo := android.OtherModuleProvider(ctx, dep, cc.LinkableInfoProvider)
- commonInfo := android.OtherModuleProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
if hasRustInfo && !linkableInfo.Static && !linkableInfo.Shared {
//Handle Rust Modules
- makeLibName := rustMakeLibName(rustInfo, linkableInfo, &commonInfo, depName+rustInfo.RustSubName)
+ makeLibName := rustMakeLibName(rustInfo, linkableInfo, commonInfo, depName+rustInfo.RustSubName)
switch {
case depTag == dylibDepTag:
@@ -1628,7 +1628,7 @@
}
} else if hasLinkableInfo {
//Handle C dependencies
- makeLibName := cc.MakeLibName(ccInfo, linkableInfo, &commonInfo, depName)
+ makeLibName := cc.MakeLibName(ccInfo, linkableInfo, commonInfo, depName)
if !hasRustInfo {
if commonInfo.Target.Os != ctx.Os() {
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
diff --git a/rust/test.go b/rust/test.go
index 2fed0d6..cedced2 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -165,7 +165,7 @@
if linkableDep.OutputFile.Valid() {
// Copy the output in "lib[64]" so that it's compatible with
// the default rpath values.
- commonInfo := android.OtherModuleProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
libDir := "lib"
if commonInfo.Target.Arch.ArchType.Multilib == "lib64" {
libDir = "lib64"
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 7041642..57f5ad1 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -510,7 +510,7 @@
// so that it's compatible with the default rpath values.
var relPath string
linkableInfo := android.OtherModuleProviderOrDefault(ctx, dep, cc.LinkableInfoProvider)
- commonInfo := android.OtherModuleProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
if commonInfo.Target.Arch.ArchType.Multilib == "lib64" {
relPath = filepath.Join("lib64", linkableInfo.OutputFile.Path().Base())
@@ -613,6 +613,8 @@
entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", s.extraTestConfigs.Strings()...)
}
+ entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !proptools.BoolDefault(s.testProperties.Auto_gen_config, true))
+
s.testProperties.Test_options.SetAndroidMkEntries(entries)
},
},