Merge "Remove unnecessary snake case variables."
This commit is contained in:
@@ -232,8 +232,8 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
|
||||
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 @@ func (binary *binaryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *a
|
||||
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, "&& "))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ type binaryDecorator struct {
|
||||
|
||||
// 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 @@ func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, fi
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ func CheckBadLinkerFlags(ctx BaseModuleContext, prop string, flags []string) {
|
||||
|
||||
// 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 @@ func CheckBadHostLdlibs(ctx ModuleContext, prop string, flags []string) {
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
@@ -125,15 +125,15 @@ func generateCLionProject(compiledModule CompiledInterface, ctx android.Singleto
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@@ -387,7 +387,7 @@ type libraryDecorator struct {
|
||||
|
||||
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 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
||||
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 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext,
|
||||
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 @@ func reuseStaticLibrary(mctx android.BottomUpMutatorContext, static, shared *Mod
|
||||
// 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
|
||||
|
12
cc/linker.go
12
cc/linker.go
@@ -469,14 +469,14 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
||||
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 @@ func (linker *baseLinker) injectVersionSymbol(ctx ModuleContext, in android.Path
|
||||
// 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 @@ var (
|
||||
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,
|
||||
|
20
cc/pgo.go
20
cc/pgo.go
@@ -103,7 +103,7 @@ func (props *PgoProperties) addSamplingProfileGatherFlags(ctx ModuleContext, fla
|
||||
}
|
||||
|
||||
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 @@ func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.Opt
|
||||
// <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]))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -787,11 +787,11 @@ func VendorSnapshotSourceMutator(ctx android.BottomUpMutatorContext) {
|
||||
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()
|
||||
|
||||
|
28
cc/test.go
28
cc/test.go
@@ -211,15 +211,15 @@ func TestPerSrcMutator(mctx android.BottomUpMutatorContext) {
|
||||
// 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 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
||||
}
|
||||
})
|
||||
|
||||
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 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
||||
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})
|
||||
}
|
||||
|
||||
|
14
cc/vndk.go
14
cc/vndk.go
@@ -417,19 +417,19 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user