Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
diff --git a/cc/androidmk.go b/cc/androidmk.go
index c4b9cd5..4ada55d 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -232,8 +232,8 @@
if len(library.Properties.Overrides) > 0 {
entries.SetString("LOCAL_OVERRIDES_MODULES", strings.Join(makeOverrideModuleNames(ctx, library.Properties.Overrides), " "))
}
- if len(library.post_install_cmds) > 0 {
- entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(library.post_install_cmds, "&& "))
+ if len(library.postInstallCmds) > 0 {
+ entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(library.postInstallCmds, "&& "))
}
})
} else if library.header() {
@@ -328,8 +328,8 @@
if len(binary.Properties.Overrides) > 0 {
entries.SetString("LOCAL_OVERRIDES_MODULES", strings.Join(makeOverrideModuleNames(ctx, binary.Properties.Overrides), " "))
}
- if len(binary.post_install_cmds) > 0 {
- entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(binary.post_install_cmds, "&& "))
+ if len(binary.postInstallCmds) > 0 {
+ entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(binary.postInstallCmds, "&& "))
}
})
}
diff --git a/cc/binary.go b/cc/binary.go
index fa3966f..71c865b 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -109,7 +109,7 @@
// Action command lines to run directly after the binary is installed. For example,
// may be used to symlink runtime dependencies (such as bionic) alongside installation.
- post_install_cmds []string
+ postInstallCmds []string
}
var _ linker = (*binaryDecorator)(nil)
@@ -481,11 +481,11 @@
target := "/" + filepath.Join("apex", "com.android.runtime", dir.Base(), file.Base())
ctx.InstallAbsoluteSymlink(dir, file.Base(), target)
- binary.post_install_cmds = append(binary.post_install_cmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
+ binary.postInstallCmds = append(binary.postInstallCmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
for _, symlink := range binary.symlinks {
ctx.InstallAbsoluteSymlink(dir, symlink, target)
- binary.post_install_cmds = append(binary.post_install_cmds, makeSymlinkCmd(dirOnDevice, symlink, target))
+ binary.postInstallCmds = append(binary.postInstallCmds, makeSymlinkCmd(dirOnDevice, symlink, target))
}
}
diff --git a/cc/check.go b/cc/check.go
index 0058b8c..a357a97 100644
--- a/cc/check.go
+++ b/cc/check.go
@@ -104,7 +104,7 @@
// Check for bad host_ldlibs
func CheckBadHostLdlibs(ctx ModuleContext, prop string, flags []string) {
- allowed_ldlibs := ctx.toolchain().AvailableLibraries()
+ allowedLdlibs := ctx.toolchain().AvailableLibraries()
if !ctx.Host() {
panic("Invalid call to CheckBadHostLdlibs")
@@ -116,7 +116,7 @@
// TODO: Probably should just redo this property to prefix -l in Soong
if !strings.HasPrefix(flag, "-l") && !strings.HasPrefix(flag, "-framework") {
ctx.PropertyErrorf(prop, "Invalid flag: `%s`, must start with `-l` or `-framework`", flag)
- } else if !inList(flag, allowed_ldlibs) {
+ } else if !inList(flag, allowedLdlibs) {
ctx.PropertyErrorf(prop, "Host library `%s` not available", flag)
}
}
diff --git a/cc/cmakelists.go b/cc/cmakelists.go
index f7d9081..d441c57 100644
--- a/cc/cmakelists.go
+++ b/cc/cmakelists.go
@@ -125,15 +125,15 @@
}
// Only write CMakeLists.txt for the first variant of each architecture of each module
- clionproject_location := getCMakeListsForModule(ccModule, ctx)
- if seenProjects[clionproject_location] {
+ clionprojectLocation := getCMakeListsForModule(ccModule, ctx)
+ if seenProjects[clionprojectLocation] {
return
}
- seenProjects[clionproject_location] = true
+ seenProjects[clionprojectLocation] = true
// Ensure the directory hosting the cmakelists.txt exists
- projectDir := path.Dir(clionproject_location)
+ projectDir := path.Dir(clionprojectLocation)
os.MkdirAll(projectDir, os.ModePerm)
// Create cmakelists.txt
diff --git a/cc/library.go b/cc/library.go
index 1d0c018..f4400a9 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -387,7 +387,7 @@
versionScriptPath android.OptionalPath
- post_install_cmds []string
+ postInstallCmds []string
// If useCoreVariant is true, the vendor variant of a VNDK library is
// not installed.
@@ -658,9 +658,9 @@
SourceAbiFlags = append(SourceAbiFlags, "-I"+reexportedInclude)
}
flags.SAbiFlags = SourceAbiFlags
- total_length := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) +
+ totalLength := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) +
len(library.SharedProperties.Shared.Srcs) + len(library.StaticProperties.Static.Srcs)
- if total_length > 0 {
+ if totalLength > 0 {
flags.SAbiDump = true
}
}
@@ -1377,7 +1377,7 @@
dirOnDevice := android.InstallPathToOnDevicePath(ctx, dir)
target := "/" + filepath.Join("apex", "com.android.runtime", dir.Base(), "bionic", file.Base())
ctx.InstallAbsoluteSymlink(dir, file.Base(), target)
- library.post_install_cmds = append(library.post_install_cmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
+ library.postInstallCmds = append(library.postInstallCmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
}
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
@@ -1682,11 +1682,11 @@
// LinkageMutator adds "static" or "shared" variants for modules depending
// on whether the module can be built as a static library or a shared library.
func LinkageMutator(mctx android.BottomUpMutatorContext) {
- cc_prebuilt := false
+ ccPrebuilt := false
if m, ok := mctx.Module().(*Module); ok && m.linker != nil {
- _, cc_prebuilt = m.linker.(prebuiltLibraryInterface)
+ _, ccPrebuilt = m.linker.(prebuiltLibraryInterface)
}
- if cc_prebuilt {
+ if ccPrebuilt {
library := mctx.Module().(*Module).linker.(prebuiltLibraryInterface)
// Differentiate between header only and building an actual static/shared library
diff --git a/cc/linker.go b/cc/linker.go
index 7bc4105..815cdab 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -469,14 +469,14 @@
flags.Local.LdFlags = append(flags.Local.LdFlags, proptools.NinjaAndShellEscapeList(linker.Properties.Ldflags)...)
if ctx.Host() && !ctx.Windows() {
- rpath_prefix := `\$$ORIGIN/`
+ rpathPrefix := `\$$ORIGIN/`
if ctx.Darwin() {
- rpath_prefix = "@loader_path/"
+ rpathPrefix = "@loader_path/"
}
if !ctx.static() {
for _, rpath := range linker.dynamicProperties.RunPaths {
- flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,-rpath,"+rpath_prefix+rpath)
+ flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,-rpath,"+rpathPrefix+rpath)
}
}
}
@@ -580,8 +580,8 @@
// Rule to generate .bss symbol ordering file.
var (
- _ = pctx.SourcePathVariable("genSortedBssSymbolsPath", "build/soong/scripts/gen_sorted_bss_symbols.sh")
- gen_sorted_bss_symbols = pctx.AndroidStaticRule("gen_sorted_bss_symbols",
+ _ = pctx.SourcePathVariable("genSortedBssSymbolsPath", "build/soong/scripts/gen_sorted_bss_symbols.sh")
+ genSortedBssSymbols = pctx.AndroidStaticRule("gen_sorted_bss_symbols",
blueprint.RuleParams{
Command: "CROSS_COMPILE=$crossCompile $genSortedBssSymbolsPath ${in} ${out}",
CommandDeps: []string{"$genSortedBssSymbolsPath", "${crossCompile}nm"},
@@ -592,7 +592,7 @@
func (linker *baseLinker) sortBssSymbolsBySize(ctx ModuleContext, in android.Path, symbolOrderingFile android.ModuleOutPath, flags builderFlags) string {
crossCompile := gccCmd(flags.toolchain, "")
ctx.Build(pctx, android.BuildParams{
- Rule: gen_sorted_bss_symbols,
+ Rule: genSortedBssSymbols,
Description: "generate bss symbol order " + symbolOrderingFile.Base(),
Output: symbolOrderingFile,
Input: in,
diff --git a/cc/pgo.go b/cc/pgo.go
index 3cf550a..ada694b 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -103,7 +103,7 @@
}
func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath {
- profile_file := *props.Pgo.Profile_file
+ profileFile := *props.Pgo.Profile_file
// Test if the profile_file is present in any of the PGO profile projects
for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) {
@@ -112,24 +112,24 @@
// <profile_file>.<arbitrary-version> when available. This
// works around an issue where ccache serves stale cache
// entries when the profile file has changed.
- globPattern := filepath.Join(profileProject, profile_file+".*")
- versioned_profiles, err := ctx.GlobWithDeps(globPattern, nil)
+ globPattern := filepath.Join(profileProject, profileFile+".*")
+ versionedProfiles, err := ctx.GlobWithDeps(globPattern, nil)
if err != nil {
ctx.ModuleErrorf("glob: %s", err.Error())
}
- path := android.ExistentPathForSource(ctx, profileProject, profile_file)
+ path := android.ExistentPathForSource(ctx, profileProject, profileFile)
if path.Valid() {
- if len(versioned_profiles) != 0 {
- ctx.PropertyErrorf("pgo.profile_file", "Profile_file has multiple versions: "+filepath.Join(profileProject, profile_file)+", "+strings.Join(versioned_profiles, ", "))
+ if len(versionedProfiles) != 0 {
+ ctx.PropertyErrorf("pgo.profile_file", "Profile_file has multiple versions: "+filepath.Join(profileProject, profileFile)+", "+strings.Join(versionedProfiles, ", "))
}
return path
}
- if len(versioned_profiles) > 1 {
- ctx.PropertyErrorf("pgo.profile_file", "Profile_file has multiple versions: "+strings.Join(versioned_profiles, ", "))
- } else if len(versioned_profiles) == 1 {
- return android.OptionalPathForPath(android.PathForSource(ctx, versioned_profiles[0]))
+ if len(versionedProfiles) > 1 {
+ ctx.PropertyErrorf("pgo.profile_file", "Profile_file has multiple versions: "+strings.Join(versionedProfiles, ", "))
+ } else if len(versionedProfiles) == 1 {
+ return android.OptionalPathForPath(android.PathForSource(ctx, versionedProfiles[0]))
}
}
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index 419b7cf..4c4e9b6 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -787,11 +787,11 @@
if !module.SocSpecific() {
// But we can't just check SocSpecific() since we already passed the image mutator.
// Check ramdisk and recovery to see if we are real "vendor: true" module.
- ramdisk_available := module.InRamdisk() && !module.OnlyInRamdisk()
- vendor_ramdisk_available := module.InVendorRamdisk() && !module.OnlyInVendorRamdisk()
- recovery_available := module.InRecovery() && !module.OnlyInRecovery()
+ ramdiskAvailable := module.InRamdisk() && !module.OnlyInRamdisk()
+ vendorRamdiskAvailable := module.InVendorRamdisk() && !module.OnlyInVendorRamdisk()
+ recoveryAvailable := module.InRecovery() && !module.OnlyInRecovery()
- if !ramdisk_available && !recovery_available && !vendor_ramdisk_available {
+ if !ramdiskAvailable && !recoveryAvailable && !vendorRamdiskAvailable {
vendorSnapshotsLock.Lock()
defer vendorSnapshotsLock.Unlock()
diff --git a/cc/test.go b/cc/test.go
index a9be6f9..4ff5bf6 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -211,15 +211,15 @@
// name or even their number.
testNames = append(testNames, "")
tests := mctx.CreateLocalVariations(testNames...)
- all_tests := tests[numTests]
- all_tests.(*Module).linker.(testPerSrc).unsetSrc()
+ allTests := tests[numTests]
+ allTests.(*Module).linker.(testPerSrc).unsetSrc()
// Prevent the "all tests" variation from being installable nor
// exporting to Make, as it won't create any output file.
- all_tests.(*Module).Properties.PreventInstall = true
- all_tests.(*Module).Properties.HideFromMake = true
+ allTests.(*Module).Properties.PreventInstall = true
+ allTests.(*Module).Properties.HideFromMake = true
for i, src := range test.srcs() {
tests[i].(*Module).linker.(testPerSrc).setSrc(testNames[i], src)
- mctx.AddInterVariantDependency(testPerSrcDepTag, all_tests, tests[i])
+ mctx.AddInterVariantDependency(testPerSrcDepTag, allTests, tests[i])
}
mctx.AliasVariation("")
}
@@ -369,9 +369,9 @@
}
})
- var api_level_prop string
+ var apiLevelProp string
var configs []tradefed.Config
- var min_level string
+ var minLevel string
for _, module := range test.Properties.Test_mainline_modules {
configs = append(configs, tradefed.Option{Name: "config-descriptor:metadata", Key: "mainline-param", Value: module})
}
@@ -398,16 +398,16 @@
if test.Properties.Test_min_api_level != nil && test.Properties.Test_min_sdk_version != nil {
ctx.PropertyErrorf("test_min_api_level", "'test_min_api_level' and 'test_min_sdk_version' should not be set at the same time.")
} else if test.Properties.Test_min_api_level != nil {
- api_level_prop = "ro.product.first_api_level"
- min_level = strconv.FormatInt(int64(*test.Properties.Test_min_api_level), 10)
+ apiLevelProp = "ro.product.first_api_level"
+ minLevel = strconv.FormatInt(int64(*test.Properties.Test_min_api_level), 10)
} else if test.Properties.Test_min_sdk_version != nil {
- api_level_prop = "ro.build.version.sdk"
- min_level = strconv.FormatInt(int64(*test.Properties.Test_min_sdk_version), 10)
+ apiLevelProp = "ro.build.version.sdk"
+ minLevel = strconv.FormatInt(int64(*test.Properties.Test_min_sdk_version), 10)
}
- if api_level_prop != "" {
+ if apiLevelProp != "" {
var options []tradefed.Option
- options = append(options, tradefed.Option{Name: "min-api-level", Value: min_level})
- options = append(options, tradefed.Option{Name: "api-level-prop", Value: api_level_prop})
+ options = append(options, tradefed.Option{Name: "min-api-level", Value: minLevel})
+ options = append(options, tradefed.Option{Name: "api-level-prop", Value: apiLevelProp})
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.MinApiLevelModuleController", options})
}
diff --git a/cc/vndk.go b/cc/vndk.go
index c1bce16..bfa6b59 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -417,19 +417,19 @@
}
}
- lib, is_lib := m.linker.(*libraryDecorator)
- prebuilt_lib, is_prebuilt_lib := m.linker.(*prebuiltLibraryLinker)
+ lib, isLib := m.linker.(*libraryDecorator)
+ prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker)
- if m.UseVndk() && is_lib && lib.hasLLNDKStubs() {
+ if m.UseVndk() && isLib && lib.hasLLNDKStubs() {
llndk := mctx.AddVariationDependencies(nil, llndkStubDepTag, String(lib.Properties.Llndk_stubs))
mergeLLNDKToLib(llndk[0].(*Module), &lib.Properties.Llndk, &lib.flagExporter)
}
- if m.UseVndk() && is_prebuilt_lib && prebuilt_lib.hasLLNDKStubs() {
- llndk := mctx.AddVariationDependencies(nil, llndkStubDepTag, String(prebuilt_lib.Properties.Llndk_stubs))
- mergeLLNDKToLib(llndk[0].(*Module), &prebuilt_lib.Properties.Llndk, &prebuilt_lib.flagExporter)
+ if m.UseVndk() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() {
+ llndk := mctx.AddVariationDependencies(nil, llndkStubDepTag, String(prebuiltLib.Properties.Llndk_stubs))
+ mergeLLNDKToLib(llndk[0].(*Module), &prebuiltLib.Properties.Llndk, &prebuiltLib.flagExporter)
}
- if (is_lib && lib.buildShared()) || (is_prebuilt_lib && prebuilt_lib.buildShared()) {
+ if (isLib && lib.buildShared()) || (isPrebuiltLib && prebuiltLib.buildShared()) {
if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
processVndkLibrary(mctx, m)
return