diff --git a/android/arch.go b/android/arch.go index 6aeccb0c8..953e6cfc7 100644 --- a/android/arch.go +++ b/android/arch.go @@ -1169,7 +1169,7 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) { targets := make(map[OsType][]Target) var targetErr error - addTarget := func(os OsType, archName string, archVariant, cpuVariant *string, abi *[]string) { + addTarget := func(os OsType, archName string, archVariant, cpuVariant *string, abi []string) { if targetErr != nil { return } @@ -1358,7 +1358,7 @@ func decodeArchSettings(os OsType, archConfigs []archConfig) ([]Target, error) { for _, config := range archConfigs { arch, err := decodeArch(os, config.arch, &config.archVariant, - &config.cpuVariant, &config.abi) + &config.cpuVariant, config.abi) if err != nil { return nil, err } @@ -1373,7 +1373,7 @@ func decodeArchSettings(os OsType, archConfigs []archConfig) ([]Target, error) { } // Convert a set of strings from product variables into a single Arch struct -func decodeArch(os OsType, arch string, archVariant, cpuVariant *string, abi *[]string) (Arch, error) { +func decodeArch(os OsType, arch string, archVariant, cpuVariant *string, abi []string) (Arch, error) { stringPtr := func(p *string) string { if p != nil { return *p @@ -1381,13 +1381,6 @@ func decodeArch(os OsType, arch string, archVariant, cpuVariant *string, abi *[] return "" } - slicePtr := func(p *[]string) []string { - if p != nil { - return *p - } - return nil - } - archType, ok := archTypeMap[arch] if !ok { return Arch{}, fmt.Errorf("unknown arch %q", arch) @@ -1397,7 +1390,7 @@ func decodeArch(os OsType, arch string, archVariant, cpuVariant *string, abi *[] ArchType: archType, ArchVariant: stringPtr(archVariant), CpuVariant: stringPtr(cpuVariant), - Abi: slicePtr(abi), + Abi: abi, Native: true, } diff --git a/android/config.go b/android/config.go index cda6c3e69..92010fc53 100644 --- a/android/config.go +++ b/android/config.go @@ -202,10 +202,10 @@ func TestConfig(buildDir string, env map[string]string) Config { productVariables: productVariables{ DeviceName: stringPtr("test_device"), Platform_sdk_version: intPtr(26), - AAPTConfig: &[]string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"}, + AAPTConfig: []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"}, AAPTPreferredConfig: stringPtr("xhdpi"), AAPTCharacteristics: stringPtr("nosdcard"), - AAPTPrebuiltDPI: &[]string{"xhdpi", "xxhdpi"}, + AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"}, }, buildDir: buildDir, @@ -476,10 +476,7 @@ func (c *config) DeviceName() string { } func (c *config) ResourceOverlays() []string { - if c.productVariables.ResourceOverlays == nil { - return nil - } - return *c.productVariables.ResourceOverlays + return c.productVariables.ResourceOverlays } func (c *config) PlatformVersionName() string { @@ -544,7 +541,7 @@ func (c *config) PlatformVersionCombinedCodenames() []string { } func (c *config) ProductAAPTConfig() []string { - return stringSlice(c.productVariables.AAPTConfig) + return c.productVariables.AAPTConfig } func (c *config) ProductAAPTPreferredConfig() string { @@ -556,7 +553,7 @@ func (c *config) ProductAAPTCharacteristics() string { } func (c *config) ProductAAPTPrebuiltDPI() []string { - return stringSlice(c.productVariables.AAPTPrebuiltDPI) + return c.productVariables.AAPTPrebuiltDPI } func (c *config) DefaultAppCertificateDir(ctx PathContext) SourcePath { @@ -738,10 +735,10 @@ func (c *config) ArtUseReadBarrier() bool { func (c *config) EnforceRROForModule(name string) bool { enforceList := c.productVariables.EnforceRROTargets if enforceList != nil { - if len(*enforceList) == 1 && (*enforceList)[0] == "*" { + if len(enforceList) == 1 && (enforceList)[0] == "*" { return true } - return InList(name, *enforceList) + return InList(name, enforceList) } return false } @@ -749,7 +746,7 @@ func (c *config) EnforceRROForModule(name string) bool { func (c *config) EnforceRROExcludedOverlay(path string) bool { excluded := c.productVariables.EnforceRROExcludedOverlays if excluded != nil { - for _, exclude := range *excluded { + for _, exclude := range excluded { if strings.HasPrefix(path, exclude) { return true } @@ -834,10 +831,7 @@ func (c *deviceConfig) ExtraVndkVersions() []string { } func (c *deviceConfig) SystemSdkVersions() []string { - if c.config.productVariables.DeviceSystemSdkVersions == nil { - return nil - } - return *c.config.productVariables.DeviceSystemSdkVersions + return c.config.productVariables.DeviceSystemSdkVersions } func (c *deviceConfig) PlatformSystemSdkVersions() []string { @@ -880,12 +874,12 @@ func (c *deviceConfig) NativeCoverageEnabled() bool { func (c *deviceConfig) CoverageEnabledForPath(path string) bool { coverage := false if c.config.productVariables.CoveragePaths != nil { - if PrefixInList(path, *c.config.productVariables.CoveragePaths) { + if PrefixInList(path, c.config.productVariables.CoveragePaths) { coverage = true } } if coverage && c.config.productVariables.CoverageExcludePaths != nil { - if PrefixInList(path, *c.config.productVariables.CoverageExcludePaths) { + if PrefixInList(path, c.config.productVariables.CoverageExcludePaths) { coverage = false } } @@ -966,28 +960,28 @@ func (c *config) IntegerOverflowDisabledForPath(path string) bool { if c.productVariables.IntegerOverflowExcludePaths == nil { return false } - return PrefixInList(path, *c.productVariables.IntegerOverflowExcludePaths) + return PrefixInList(path, c.productVariables.IntegerOverflowExcludePaths) } func (c *config) CFIDisabledForPath(path string) bool { if c.productVariables.CFIExcludePaths == nil { return false } - return PrefixInList(path, *c.productVariables.CFIExcludePaths) + return PrefixInList(path, c.productVariables.CFIExcludePaths) } func (c *config) CFIEnabledForPath(path string) bool { if c.productVariables.CFIIncludePaths == nil { return false } - return PrefixInList(path, *c.productVariables.CFIIncludePaths) + return PrefixInList(path, c.productVariables.CFIIncludePaths) } func (c *config) XOMDisabledForPath(path string) bool { if c.productVariables.XOMExcludePaths == nil { return false } - return PrefixInList(path, *c.productVariables.XOMExcludePaths) + return PrefixInList(path, c.productVariables.XOMExcludePaths) } func (c *config) VendorConfig(name string) VendorConfig { @@ -1039,11 +1033,3 @@ func (c *config) HiddenAPIFlags() string { func (c *config) HiddenAPIExtraAppUsageJars() []string { return c.productVariables.HiddenAPIExtraAppUsageJars } - -func stringSlice(s *[]string) []string { - if s != nil { - return *s - } else { - return nil - } -} diff --git a/android/module.go b/android/module.go index 551824d6c..f2f1af1d3 100644 --- a/android/module.go +++ b/android/module.go @@ -481,6 +481,8 @@ type ModuleBase struct { prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool } +func (a *ModuleBase) DepsMutator(BottomUpMutatorContext) {} + func (a *ModuleBase) AddProperties(props ...interface{}) { a.registerProps = append(a.registerProps, props...) } diff --git a/android/namespace.go b/android/namespace.go index b027cebb0..dca2b8c95 100644 --- a/android/namespace.go +++ b/android/namespace.go @@ -366,9 +366,6 @@ type NamespaceModule struct { } } -func (n *NamespaceModule) DepsMutator(context BottomUpMutatorContext) { -} - func (n *NamespaceModule) GenerateAndroidBuildActions(ctx ModuleContext) { } diff --git a/android/neverallow_test.go b/android/neverallow_test.go index 9e4886c2c..8d530874d 100644 --- a/android/neverallow_test.go +++ b/android/neverallow_test.go @@ -222,9 +222,6 @@ func newMockCcLibraryModule() Module { return m } -func (p *mockCcLibraryModule) DepsMutator(ctx BottomUpMutatorContext) { -} - func (p *mockCcLibraryModule) GenerateAndroidBuildActions(ModuleContext) { } @@ -244,8 +241,5 @@ func newMockJavaLibraryModule() Module { return m } -func (p *mockJavaLibraryModule) DepsMutator(ctx BottomUpMutatorContext) { -} - func (p *mockJavaLibraryModule) GenerateAndroidBuildActions(ModuleContext) { } diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index cd1ffae12..b30ca1a55 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -212,9 +212,6 @@ func (p *prebuiltModule) Name() string { return p.prebuilt.Name(p.ModuleBase.Name()) } -func (p *prebuiltModule) DepsMutator(ctx BottomUpMutatorContext) { -} - func (p *prebuiltModule) GenerateAndroidBuildActions(ModuleContext) { } diff --git a/android/variable.go b/android/variable.go index fb7bf4eb1..f38cf25cc 100644 --- a/android/variable.go +++ b/android/variable.go @@ -144,18 +144,18 @@ type productVariables struct { Platform_vndk_version *string `json:",omitempty"` Platform_systemsdk_versions []string `json:",omitempty"` - DeviceName *string `json:",omitempty"` - DeviceArch *string `json:",omitempty"` - DeviceArchVariant *string `json:",omitempty"` - DeviceCpuVariant *string `json:",omitempty"` - DeviceAbi *[]string `json:",omitempty"` - DeviceVndkVersion *string `json:",omitempty"` - DeviceSystemSdkVersions *[]string `json:",omitempty"` + DeviceName *string `json:",omitempty"` + DeviceArch *string `json:",omitempty"` + DeviceArchVariant *string `json:",omitempty"` + DeviceCpuVariant *string `json:",omitempty"` + DeviceAbi []string `json:",omitempty"` + DeviceVndkVersion *string `json:",omitempty"` + DeviceSystemSdkVersions []string `json:",omitempty"` - DeviceSecondaryArch *string `json:",omitempty"` - DeviceSecondaryArchVariant *string `json:",omitempty"` - DeviceSecondaryCpuVariant *string `json:",omitempty"` - DeviceSecondaryAbi *[]string `json:",omitempty"` + DeviceSecondaryArch *string `json:",omitempty"` + DeviceSecondaryArchVariant *string `json:",omitempty"` + DeviceSecondaryCpuVariant *string `json:",omitempty"` + DeviceSecondaryAbi []string `json:",omitempty"` HostArch *string `json:",omitempty"` HostSecondaryArch *string `json:",omitempty"` @@ -164,14 +164,14 @@ type productVariables struct { CrossHostArch *string `json:",omitempty"` CrossHostSecondaryArch *string `json:",omitempty"` - ResourceOverlays *[]string `json:",omitempty"` - EnforceRROTargets *[]string `json:",omitempty"` - EnforceRROExcludedOverlays *[]string `json:",omitempty"` + ResourceOverlays []string `json:",omitempty"` + EnforceRROTargets []string `json:",omitempty"` + EnforceRROExcludedOverlays []string `json:",omitempty"` - AAPTCharacteristics *string `json:",omitempty"` - AAPTConfig *[]string `json:",omitempty"` - AAPTPreferredConfig *string `json:",omitempty"` - AAPTPrebuiltDPI *[]string `json:",omitempty"` + AAPTCharacteristics *string `json:",omitempty"` + AAPTConfig []string `json:",omitempty"` + AAPTPreferredConfig *string `json:",omitempty"` + AAPTPrebuiltDPI []string `json:",omitempty"` DefaultAppCertificate *string `json:",omitempty"` @@ -207,16 +207,16 @@ type productVariables struct { DisableDexPreoptModules []string `json:",omitempty"` DexPreoptProfileDir *string `json:",omitempty"` - IntegerOverflowExcludePaths *[]string `json:",omitempty"` + IntegerOverflowExcludePaths []string `json:",omitempty"` - EnableCFI *bool `json:",omitempty"` - CFIExcludePaths *[]string `json:",omitempty"` - CFIIncludePaths *[]string `json:",omitempty"` + EnableCFI *bool `json:",omitempty"` + CFIExcludePaths []string `json:",omitempty"` + CFIIncludePaths []string `json:",omitempty"` DisableScudo *bool `json:",omitempty"` - EnableXOM *bool `json:",omitempty"` - XOMExcludePaths *[]string `json:",omitempty"` + EnableXOM *bool `json:",omitempty"` + XOMExcludePaths []string `json:",omitempty"` VendorPath *string `json:",omitempty"` OdmPath *string `json:",omitempty"` @@ -226,9 +226,9 @@ type productVariables struct { ClangTidy *bool `json:",omitempty"` TidyChecks *string `json:",omitempty"` - NativeCoverage *bool `json:",omitempty"` - CoveragePaths *[]string `json:",omitempty"` - CoverageExcludePaths *[]string `json:",omitempty"` + NativeCoverage *bool `json:",omitempty"` + CoveragePaths []string `json:",omitempty"` + CoverageExcludePaths []string `json:",omitempty"` DevicePrefer32BitApps *bool `json:",omitempty"` DevicePrefer32BitExecutables *bool `json:",omitempty"` @@ -308,16 +308,16 @@ func (v *productVariables) SetDefaultConfig() { DeviceArch: stringPtr("arm64"), DeviceArchVariant: stringPtr("armv8-a"), DeviceCpuVariant: stringPtr("generic"), - DeviceAbi: &[]string{"arm64-v8a"}, + DeviceAbi: []string{"arm64-v8a"}, DeviceSecondaryArch: stringPtr("arm"), DeviceSecondaryArchVariant: stringPtr("armv8-a"), DeviceSecondaryCpuVariant: stringPtr("generic"), - DeviceSecondaryAbi: &[]string{"armeabi-v7a", "armeabi"}, + DeviceSecondaryAbi: []string{"armeabi-v7a", "armeabi"}, - AAPTConfig: &[]string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"}, + AAPTConfig: []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"}, AAPTPreferredConfig: stringPtr("xhdpi"), AAPTCharacteristics: stringPtr("nosdcard"), - AAPTPrebuiltDPI: &[]string{"xhdpi", "xxhdpi"}, + AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"}, Malloc_not_svelte: boolPtr(true), Safestack: boolPtr(false), diff --git a/apex/key.go b/apex/key.go index 7e98d2b67..6d1032d35 100644 --- a/apex/key.go +++ b/apex/key.go @@ -19,6 +19,7 @@ import ( "io" "android/soong/android" + "github.com/google/blueprint/proptools" ) @@ -61,9 +62,6 @@ func (m *apexKey) installable() bool { return m.properties.Installable == nil || proptools.Bool(m.properties.Installable) } -func (m *apexKey) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) { if ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() { // Flattened APEXes are not signed diff --git a/cc/cc.go b/cc/cc.go index 4c26e6006..5a2f0ae72 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -1869,9 +1869,6 @@ type Defaults struct { func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { } -func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func defaultsFactory() android.Module { return DefaultsFactory() } diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go index 504a6a0ea..c0ce9c356 100644 --- a/cc/ndk_headers.go +++ b/cc/ndk_headers.go @@ -93,9 +93,6 @@ type headerModule struct { licensePath android.ModuleSrcPath } -func (m *headerModule) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func getHeaderInstallDir(ctx android.ModuleContext, header android.Path, from string, to string) android.OutputPath { // Output path is the sysroot base + "usr/include" + to directory + directory component @@ -210,9 +207,6 @@ type versionedHeaderModule struct { licensePath android.ModuleSrcPath } -func (m *versionedHeaderModule) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func (m *versionedHeaderModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { if String(m.properties.License) == "" { ctx.PropertyErrorf("license", "field is required") @@ -335,9 +329,6 @@ type preprocessedHeadersModule struct { licensePath android.ModuleSrcPath } -func (m *preprocessedHeadersModule) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func (m *preprocessedHeadersModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { if String(m.properties.License) == "" { ctx.PropertyErrorf("license", "field is required") diff --git a/genrule/genrule.go b/genrule/genrule.go index 77bc19657..7695ffbd7 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -528,9 +528,6 @@ type Defaults struct { func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { } -func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func defaultsFactory() android.Module { return DefaultsFactory() } diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go index 70b9090b1..19b22f76c 100644 --- a/genrule/genrule_test.go +++ b/genrule/genrule_test.go @@ -519,8 +519,6 @@ func toolFactory() android.Module { return module } -func (t *testTool) DepsMutator(ctx android.BottomUpMutatorContext) {} - func (t *testTool) GenerateAndroidBuildActions(ctx android.ModuleContext) { t.outputFile = android.PathForTesting("out", ctx.ModuleName()) } diff --git a/java/app.go b/java/app.go index cc863e60d..e9c12e0a7 100644 --- a/java/app.go +++ b/java/app.go @@ -503,9 +503,6 @@ func AndroidAppCertificateFactory() android.Module { return module } -func (c *AndroidAppCertificate) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func (c *AndroidAppCertificate) GenerateAndroidBuildActions(ctx android.ModuleContext) { cert := String(c.properties.Certificate) c.Certificate = Certificate{ diff --git a/java/app_test.go b/java/app_test.go index 21bda3c42..2455145fa 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -199,12 +199,12 @@ func TestEnforceRRO(t *testing.T) { for _, testCase := range testEnforceRROTests { t.Run(testCase.name, func(t *testing.T) { config := testConfig(nil) - config.TestProductVariables.ResourceOverlays = &resourceOverlays + config.TestProductVariables.ResourceOverlays = resourceOverlays if testCase.enforceRROTargets != nil { - config.TestProductVariables.EnforceRROTargets = &testCase.enforceRROTargets + config.TestProductVariables.EnforceRROTargets = testCase.enforceRROTargets } if testCase.enforceRROExcludedOverlays != nil { - config.TestProductVariables.EnforceRROExcludedOverlays = &testCase.enforceRROExcludedOverlays + config.TestProductVariables.EnforceRROExcludedOverlays = testCase.enforceRROExcludedOverlays } ctx := testAppContext(config, bp, fs) diff --git a/java/droiddoc.go b/java/droiddoc.go index 01e2989d0..d893c09ae 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -1816,9 +1816,6 @@ type DocDefaults struct { func (*DocDefaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { } -func (d *DocDefaults) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func DocDefaultsFactory() android.Module { module := &DocDefaults{} diff --git a/java/java.go b/java/java.go index 230e8f2b8..70c6c4380 100644 --- a/java/java.go +++ b/java/java.go @@ -1840,9 +1840,6 @@ type Defaults struct { func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { } -func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func defaultsFactory() android.Module { return DefaultsFactory() } diff --git a/java/java_test.go b/java/java_test.go index a8cbfd1de..86dc69595 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -61,7 +61,7 @@ func testConfig(env map[string]string) android.Config { env["ANDROID_JAVA8_HOME"] = "jdk8" } config := android.TestArchConfig(buildDir, env) - config.TestProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"} + config.TestProductVariables.DeviceSystemSdkVersions = []string{"14", "15"} return config } diff --git a/java/prebuilt_apis.go b/java/prebuilt_apis.go index c11e010a0..0410dafbf 100644 --- a/java/prebuilt_apis.go +++ b/java/prebuilt_apis.go @@ -47,10 +47,6 @@ type prebuiltApis struct { properties prebuiltApisProperties } -func (module *prebuiltApis) DepsMutator(ctx android.BottomUpMutatorContext) { - // no need to implement -} - func (module *prebuiltApis) GenerateAndroidBuildActions(ctx android.ModuleContext) { // no need to implement } diff --git a/phony/phony.go b/phony/phony.go index 0c62e8a01..e8a6550fa 100644 --- a/phony/phony.go +++ b/phony/phony.go @@ -38,9 +38,6 @@ func PhonyFactory() android.Module { return module } -func (p *phony) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func (p *phony) GenerateAndroidBuildActions(ctx android.ModuleContext) { p.requiredModuleNames = ctx.RequiredModuleNames() if len(p.requiredModuleNames) == 0 { diff --git a/python/defaults.go b/python/defaults.go index 641aca456..dba23a729 100644 --- a/python/defaults.go +++ b/python/defaults.go @@ -30,9 +30,6 @@ type Defaults struct { func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { } -func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) { -} - func defaultsFactory() android.Module { return DefaultsFactory() }