Merge "Remove unnecessary snake case variables."

This commit is contained in:
Jaewoong Jung 2020-12-23 01:21:28 +00:00 committed by Gerrit Code Review
commit e794b1e302
33 changed files with 204 additions and 204 deletions

View file

@ -627,7 +627,7 @@ func translateAndroidMk(ctx SingletonContext, mkFile string, mods []blueprint.Mo
fmt.Fprintln(buf, "LOCAL_MODULE_MAKEFILE := $(lastword $(MAKEFILE_LIST))")
type_stats := make(map[string]int)
typeStats := make(map[string]int)
for _, mod := range mods {
err := translateAndroidMkModule(ctx, buf, mod)
if err != nil {
@ -636,19 +636,19 @@ func translateAndroidMk(ctx SingletonContext, mkFile string, mods []blueprint.Mo
}
if amod, ok := mod.(Module); ok && ctx.PrimaryModule(amod) == amod {
type_stats[ctx.ModuleType(amod)] += 1
typeStats[ctx.ModuleType(amod)] += 1
}
}
keys := []string{}
fmt.Fprintln(buf, "\nSTATS.SOONG_MODULE_TYPE :=")
for k := range type_stats {
for k := range typeStats {
keys = append(keys, k)
}
sort.Strings(keys)
for _, mod_type := range keys {
fmt.Fprintln(buf, "STATS.SOONG_MODULE_TYPE +=", mod_type)
fmt.Fprintf(buf, "STATS.SOONG_MODULE_TYPE.%s := %d\n", mod_type, type_stats[mod_type])
fmt.Fprintf(buf, "STATS.SOONG_MODULE_TYPE.%s := %d\n", mod_type, typeStats[mod_type])
}
// Don't write to the file if it hasn't changed

View file

@ -387,25 +387,25 @@ func (context *bazelContext) InvokeBazel() error {
if err != nil {
return err
}
cquery_file_relpath := filepath.Join(context.intermediatesDir(), "buildroot.cquery")
cqueryFileRelpath := filepath.Join(context.intermediatesDir(), "buildroot.cquery")
err = ioutil.WriteFile(
absolutePath(cquery_file_relpath),
absolutePath(cqueryFileRelpath),
context.cqueryStarlarkFileContents(), 0666)
if err != nil {
return err
}
workspace_file_relpath := filepath.Join(context.intermediatesDir(), "WORKSPACE.bazel")
workspaceFileRelpath := filepath.Join(context.intermediatesDir(), "WORKSPACE.bazel")
err = ioutil.WriteFile(
absolutePath(workspace_file_relpath),
absolutePath(workspaceFileRelpath),
context.workspaceFileContents(), 0666)
if err != nil {
return err
}
buildroot_label := "//:buildroot"
buildrootLabel := "//:buildroot"
cqueryOutput, err = context.issueBazelCommand(bazel.CqueryBuildRootRunName, "cquery",
[]string{fmt.Sprintf("deps(%s)", buildroot_label)},
[]string{fmt.Sprintf("deps(%s)", buildrootLabel)},
"--output=starlark",
"--starlark:file="+cquery_file_relpath)
"--starlark:file="+cqueryFileRelpath)
if err != nil {
return err
@ -432,7 +432,7 @@ func (context *bazelContext) InvokeBazel() error {
// TODO(cparsons): Use --target_pattern_file to avoid command line limits.
var aqueryOutput string
aqueryOutput, err = context.issueBazelCommand(bazel.AqueryBuildRootRunName, "aquery",
[]string{fmt.Sprintf("deps(%s)", buildroot_label),
[]string{fmt.Sprintf("deps(%s)", buildrootLabel),
// Use jsonproto instead of proto; actual proto parsing would require a dependency on Bazel's
// proto sources, which would add a number of unnecessary dependencies.
"--output=jsonproto"})

View file

@ -24,8 +24,8 @@ import (
)
const (
clear_vars = "__android_mk_clear_vars"
include_ignored = "__android_mk_include_ignored"
clearVarsPath = "__android_mk_clear_vars"
includeIgnoredPath = "__android_mk_include_ignored"
)
type bpVariable struct {
@ -913,7 +913,7 @@ func allSubdirJavaFiles(args []string) []string {
}
func includeIgnored(args []string) []string {
return []string{include_ignored}
return []string{includeIgnoredPath}
}
var moduleTypes = map[string]string{
@ -959,7 +959,7 @@ var includePathToModule = map[string]string{
}
func mapIncludePath(path string) (string, bool) {
if path == clear_vars || path == include_ignored {
if path == clearVarsPath || path == includeIgnoredPath {
return path, true
}
module, ok := includePathToModule[path]
@ -968,7 +968,7 @@ func mapIncludePath(path string) (string, bool) {
func androidScope() mkparser.Scope {
globalScope := mkparser.NewScope(nil)
globalScope.Set("CLEAR_VARS", clear_vars)
globalScope.Set("CLEAR_VARS", clearVarsPath)
globalScope.SetFunc("my-dir", mydir)
globalScope.SetFunc("all-java-files-under", allFilesUnder("*.java"))
globalScope.SetFunc("all-proto-files-under", allFilesUnder("*.proto"))

View file

@ -156,9 +156,9 @@ func ConvertFile(filename string, buffer *bytes.Buffer) (string, []error) {
continue
}
switch module {
case clear_vars:
case clearVarsPath:
resetModule(file)
case include_ignored:
case includeIgnoredPath:
// subdirs are already automatically included in Soong
continue
default:

View file

@ -298,12 +298,12 @@ type apexBundle struct {
// Inputs
// Keys for apex_paylaod.img
public_key_file android.Path
private_key_file android.Path
publicKeyFile android.Path
privateKeyFile android.Path
// Cert/priv-key for the zip container
container_certificate_file android.Path
container_private_key_file android.Path
containerCertificateFile android.Path
containerPrivateKeyFile android.Path
// Flags for special variants of APEX
testApex bool
@ -1684,16 +1684,16 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
case keyTag:
if key, ok := child.(*apexKey); ok {
a.private_key_file = key.private_key_file
a.public_key_file = key.public_key_file
a.privateKeyFile = key.privateKeyFile
a.publicKeyFile = key.publicKeyFile
} else {
ctx.PropertyErrorf("key", "%q is not an apex_key module", depName)
}
return false
case certificateTag:
if dep, ok := child.(*java.AndroidAppCertificate); ok {
a.container_certificate_file = dep.Certificate.Pem
a.container_private_key_file = dep.Certificate.Key
a.containerCertificateFile = dep.Certificate.Pem
a.containerPrivateKeyFile = dep.Certificate.Key
} else {
ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", depName)
}
@ -1810,7 +1810,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
return false
})
if a.private_key_file == nil {
if a.privateKeyFile == nil {
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
return
}
@ -1950,7 +1950,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
copiedPubkey := android.PathForModuleOut(ctx, "apex_pubkey")
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Input: a.public_key_file,
Input: a.publicKeyFile,
Output: copiedPubkey,
})
a.filesInfo = append(a.filesInfo, newApexFile(ctx, copiedPubkey, "apex_pubkey", ".", etc, nil))
@ -2839,14 +2839,14 @@ func init() {
func createApexPermittedPackagesRules(modules_packages map[string][]string) []android.Rule {
rules := make([]android.Rule, 0, len(modules_packages))
for module_name, module_packages := range modules_packages {
permitted_packages_rule := android.NeverAllow().
permittedPackagesRule := android.NeverAllow().
BootclasspathJar().
With("apex_available", module_name).
WithMatcher("permitted_packages", android.NotInList(module_packages)).
Because("jars that are part of the " + module_name +
" module may only allow these packages: " + strings.Join(module_packages, ",") +
". Please jarjar or move code around.")
rules = append(rules, permitted_packages_rule)
rules = append(rules, permittedPackagesRule)
}
return rules
}

View file

@ -2679,12 +2679,12 @@ func TestKeys(t *testing.T) {
// check the APEX keys
keys := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
if keys.public_key_file.String() != "vendor/foo/devkeys/testkey.avbpubkey" {
t.Errorf("public key %q is not %q", keys.public_key_file.String(),
if keys.publicKeyFile.String() != "vendor/foo/devkeys/testkey.avbpubkey" {
t.Errorf("public key %q is not %q", keys.publicKeyFile.String(),
"vendor/foo/devkeys/testkey.avbpubkey")
}
if keys.private_key_file.String() != "vendor/foo/devkeys/testkey.pem" {
t.Errorf("private key %q is not %q", keys.private_key_file.String(),
if keys.privateKeyFile.String() != "vendor/foo/devkeys/testkey.pem" {
t.Errorf("private key %q is not %q", keys.privateKeyFile.String(),
"vendor/foo/devkeys/testkey.pem")
}
@ -4143,12 +4143,12 @@ func TestApexKeyFromOtherModule(t *testing.T) {
apex_key := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
expected_pubkey := "testkey2.avbpubkey"
actual_pubkey := apex_key.public_key_file.String()
actual_pubkey := apex_key.publicKeyFile.String()
if actual_pubkey != expected_pubkey {
t.Errorf("wrong public key path. expected %q. actual %q", expected_pubkey, actual_pubkey)
}
expected_privkey := "testkey2.pem"
actual_privkey := apex_key.private_key_file.String()
actual_privkey := apex_key.privateKeyFile.String()
if actual_privkey != expected_privkey {
t.Errorf("wrong private key path. expected %q. actual %q", expected_privkey, actual_privkey)
}

View file

@ -577,8 +577,8 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
fileContexts := a.buildFileContexts(ctx)
implicitInputs = append(implicitInputs, fileContexts)
implicitInputs = append(implicitInputs, a.private_key_file, a.public_key_file)
optFlags = append(optFlags, "--pubkey "+a.public_key_file.String())
implicitInputs = append(implicitInputs, a.privateKeyFile, a.publicKeyFile)
optFlags = append(optFlags, "--pubkey "+a.publicKeyFile.String())
manifestPackageName := a.getOverrideManifestPackageName(ctx)
if manifestPackageName != "" {
@ -667,7 +667,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.private_key_file.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
@ -842,8 +842,8 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
// the zip container of this APEX. See the description of the 'certificate' property for how
// the cert and the private key are found.
func (a *apexBundle) getCertificateAndPrivateKey(ctx android.PathContext) (pem, key android.Path) {
if a.container_certificate_file != nil {
return a.container_certificate_file, a.container_private_key_file
if a.containerCertificateFile != nil {
return a.containerCertificateFile, a.containerPrivateKeyFile
}
cert := String(a.properties.Certificate)

View file

@ -36,8 +36,8 @@ type apexKey struct {
properties apexKeyProperties
public_key_file android.Path
private_key_file android.Path
publicKeyFile android.Path
privateKeyFile android.Path
keyName string
}
@ -69,30 +69,30 @@ func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Otherwise, try to locate the key files in the default cert dir or
// in the local module dir
if android.SrcIsModule(String(m.properties.Public_key)) != "" {
m.public_key_file = android.PathForModuleSrc(ctx, String(m.properties.Public_key))
m.publicKeyFile = android.PathForModuleSrc(ctx, String(m.properties.Public_key))
} else {
m.public_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Public_key))
m.publicKeyFile = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Public_key))
// If not found, fall back to the local key pairs
if !android.ExistentPathForSource(ctx, m.public_key_file.String()).Valid() {
m.public_key_file = android.PathForModuleSrc(ctx, String(m.properties.Public_key))
if !android.ExistentPathForSource(ctx, m.publicKeyFile.String()).Valid() {
m.publicKeyFile = android.PathForModuleSrc(ctx, String(m.properties.Public_key))
}
}
if android.SrcIsModule(String(m.properties.Private_key)) != "" {
m.private_key_file = android.PathForModuleSrc(ctx, String(m.properties.Private_key))
m.privateKeyFile = android.PathForModuleSrc(ctx, String(m.properties.Private_key))
} else {
m.private_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Private_key))
if !android.ExistentPathForSource(ctx, m.private_key_file.String()).Valid() {
m.private_key_file = android.PathForModuleSrc(ctx, String(m.properties.Private_key))
m.privateKeyFile = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Private_key))
if !android.ExistentPathForSource(ctx, m.privateKeyFile.String()).Valid() {
m.privateKeyFile = android.PathForModuleSrc(ctx, String(m.properties.Private_key))
}
}
pubKeyName := m.public_key_file.Base()[0 : len(m.public_key_file.Base())-len(m.public_key_file.Ext())]
privKeyName := m.private_key_file.Base()[0 : len(m.private_key_file.Base())-len(m.private_key_file.Ext())]
pubKeyName := m.publicKeyFile.Base()[0 : len(m.publicKeyFile.Base())-len(m.publicKeyFile.Ext())]
privKeyName := m.privateKeyFile.Base()[0 : len(m.privateKeyFile.Base())-len(m.privateKeyFile.Ext())]
if m.properties.Public_key != nil && m.properties.Private_key != nil && pubKeyName != privKeyName {
ctx.ModuleErrorf("public_key %q (keyname:%q) and private_key %q (keyname:%q) do not have same keyname",
m.public_key_file.String(), pubKeyName, m.private_key_file, privKeyName)
m.publicKeyFile.String(), pubKeyName, m.privateKeyFile, privKeyName)
return
}
m.keyName = pubKeyName
@ -109,10 +109,10 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
type apexKeyEntry struct {
name string
presigned bool
public_key string
private_key string
container_certificate string
container_private_key string
publicKey string
privateKey string
containerCertificate string
containerPrivateKey string
partition string
}
toString := func(e apexKeyEntry) string {
@ -120,7 +120,7 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
if e.presigned {
return fmt.Sprintf(format, e.name, "PRESIGNED", "PRESIGNED", "PRESIGNED", "PRESIGNED", e.partition)
} else {
return fmt.Sprintf(format, e.name, e.public_key, e.private_key, e.container_certificate, e.container_private_key, e.partition)
return fmt.Sprintf(format, e.name, e.publicKey, e.privateKey, e.containerCertificate, e.containerPrivateKey, e.partition)
}
}
@ -131,10 +131,10 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
apexKeyMap[m.Name()] = apexKeyEntry{
name: m.Name() + ".apex",
presigned: false,
public_key: m.public_key_file.String(),
private_key: m.private_key_file.String(),
container_certificate: pem.String(),
container_private_key: key.String(),
publicKey: m.publicKeyFile.String(),
privateKey: m.privateKeyFile.String(),
containerCertificate: pem.String(),
containerPrivateKey: key.String(),
partition: m.PartitionTag(ctx.DeviceConfig()),
}
}

View file

@ -784,9 +784,9 @@ func removeSoongConfigBoolVariable(f *Fixer) error {
return nil
}
bool_variables, ok := getLiteralListProperty(mod, "bool_variables")
boolVariables, ok := getLiteralListProperty(mod, "bool_variables")
if ok {
patchList.Add(bool_variables.RBracePos.Offset, bool_variables.RBracePos.Offset, ","+boolValues.String())
patchList.Add(boolVariables.RBracePos.Offset, boolVariables.RBracePos.Offset, ","+boolValues.String())
} else {
patchList.Add(variables.RBracePos.Offset+2, variables.RBracePos.Offset+2,
fmt.Sprintf(`bool_variables: [%s],`, boolValues.String()))

View file

@ -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, "&& "))
}
})
}

View file

@ -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))
}
}

View file

@ -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)
}
}

View file

@ -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

View file

@ -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

View file

@ -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)
}
}
}
@ -581,7 +581,7 @@ func (linker *baseLinker) injectVersionSymbol(ctx ModuleContext, in android.Path
var (
_ = pctx.SourcePathVariable("genSortedBssSymbolsPath", "build/soong/scripts/gen_sorted_bss_symbols.sh")
gen_sorted_bss_symbols = pctx.AndroidStaticRule("gen_sorted_bss_symbols",
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,

View file

@ -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]))
}
}

View file

@ -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()

View file

@ -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})
}

View file

@ -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

View file

@ -58,7 +58,7 @@ func main() {
os.Exit(4)
}
start_addr, err := parseElf(r, linker)
startAddr, err := parseElf(r, linker)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(5)
@ -71,7 +71,7 @@ func main() {
}
defer w.Close()
err = symbol_inject.InjectUint64Symbol(file, w, "__dlwrap_original_start", start_addr)
err = symbol_inject.InjectUint64Symbol(file, w, "__dlwrap_original_start", startAddr)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(7)
@ -128,7 +128,7 @@ func findSymbol(symbols []elf.Symbol, name string) (elf.Symbol, error) {
// Check that all of the PT_LOAD segments have been embedded properly
func checkLinker(file, linker *elf.File, fileSyms []elf.Symbol) error {
dlwrap_linker_offset, err := findSymbol(fileSyms, "__dlwrap_linker_offset")
dlwrapLinkerOffset, err := findSymbol(fileSyms, "__dlwrap_linker_offset")
if err != nil {
return err
}
@ -138,7 +138,7 @@ func checkLinker(file, linker *elf.File, fileSyms []elf.Symbol) error {
continue
}
laddr := lprog.Vaddr + dlwrap_linker_offset.Value
laddr := lprog.Vaddr + dlwrapLinkerOffset.Value
found := false
for _, prog := range file.Progs {
@ -163,7 +163,7 @@ func checkLinker(file, linker *elf.File, fileSyms []elf.Symbol) error {
}
if !found {
return fmt.Errorf("Linker prog %d (0x%x) not found at offset 0x%x",
i, lprog.Vaddr, dlwrap_linker_offset.Value)
i, lprog.Vaddr, dlwrapLinkerOffset.Value)
}
}

View file

@ -305,17 +305,17 @@ func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersio
}
func ignoreMissingModules(ctx android.BottomUpMutatorContext, apiToCheck *ApiToCheck) {
api_file := String(apiToCheck.Api_file)
removed_api_file := String(apiToCheck.Removed_api_file)
apiFile := String(apiToCheck.Api_file)
removedApiFile := String(apiToCheck.Removed_api_file)
api_module := android.SrcIsModule(api_file)
removed_api_module := android.SrcIsModule(removed_api_file)
apiModule := android.SrcIsModule(apiFile)
removedApiModule := android.SrcIsModule(removedApiFile)
if api_module == "" || removed_api_module == "" {
if apiModule == "" || removedApiModule == "" {
return
}
if ctx.OtherModuleExists(api_module) || ctx.OtherModuleExists(removed_api_module) {
if ctx.OtherModuleExists(apiModule) || ctx.OtherModuleExists(removedApiModule) {
return
}

View file

@ -1505,11 +1505,11 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.compiledJavaSrcs = uniqueSrcFiles
j.compiledSrcJars = srcJars
enable_sharding := false
enableSharding := false
var headerJarFileWithoutJarjar android.Path
if ctx.Device() && !ctx.Config().IsEnvFalse("TURBINE_ENABLED") && !deps.disableTurbine {
if j.properties.Javac_shard_size != nil && *(j.properties.Javac_shard_size) > 0 {
enable_sharding = true
enableSharding = true
// Formerly, there was a check here that prevented annotation processors
// from being used when sharding was enabled, as some annotation processors
// do not function correctly in sharded environments. It was removed to
@ -1535,7 +1535,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
extraJarDeps = append(extraJarDeps, errorprone)
}
if enable_sharding {
if enableSharding {
flags.classpath = append(flags.classpath, headerJarFileWithoutJarjar)
shardSize := int(*(j.properties.Javac_shard_size))
var shardSrcs []android.Paths

View file

@ -371,8 +371,8 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
jar := filepath.Join(dir, "android.jar")
// There's no aidl for other SDKs yet.
// TODO(77525052): Add aidl files for other SDKs too.
public_dir := filepath.Join("prebuilts", "sdk", sdkVersion.version.String(), "public")
aidl := filepath.Join(public_dir, "framework.aidl")
publicDir := filepath.Join("prebuilts", "sdk", sdkVersion.version.String(), "public")
aidl := filepath.Join(publicDir, "framework.aidl")
jarPath := android.ExistentPathForSource(ctx, jar)
aidlPath := android.ExistentPathForSource(ctx, aidl)
lambdaStubsPath := android.PathForSource(ctx, config.SdkLambdaStubsPath)

View file

@ -1534,7 +1534,7 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
hasSystemAndTestApis := sdkDep.hasStandardLibs()
module.sdkLibraryProperties.Generate_system_and_test_apis = hasSystemAndTestApis
missing_current_api := false
missingCurrentApi := false
generatedScopes := module.getGeneratedApiScopes(mctx)
@ -1545,12 +1545,12 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
p := android.ExistentPathForSource(mctx, path)
if !p.Valid() {
mctx.ModuleErrorf("Current api file %#v doesn't exist", path)
missing_current_api = true
missingCurrentApi = true
}
}
}
if missing_current_api {
if missingCurrentApi {
script := "build/soong/scripts/gen-java-current-api-files.sh"
p := android.ExistentPathForSource(mctx, script)

View file

@ -137,13 +137,13 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
var implicitOutputs android.WritablePaths
output.outputFile = outputFile
crate_name := ctx.RustModule().CrateName()
crateName := ctx.RustModule().CrateName()
targetTriple := ctx.toolchain().RustTriple()
// libstd requires a specific environment variable to be set. This is
// not officially documented and may be removed in the future. See
// https://github.com/rust-lang/rust/blob/master/library/std/src/env.rs#L866.
if crate_name == "std" {
if crateName == "std" {
envVars = append(envVars, "STD_ENV_ARCH="+config.StdEnvArch[ctx.RustModule().Arch().ArchType])
}
@ -153,8 +153,8 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
rustcFlags = append(rustcFlags, flags.GlobalRustFlags...)
rustcFlags = append(rustcFlags, flags.RustFlags...)
rustcFlags = append(rustcFlags, "--crate-type="+crate_type)
if crate_name != "" {
rustcFlags = append(rustcFlags, "--crate-name="+crate_name)
if crateName != "" {
rustcFlags = append(rustcFlags, "--crate-name="+crateName)
}
if targetTriple != "" {
rustcFlags = append(rustcFlags, "--target="+targetTriple)

View file

@ -214,9 +214,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, ctx.toolchain().ToolchainLinkFlags())
if ctx.Host() && !ctx.Windows() {
rpath_prefix := `\$$ORIGIN/`
rpathPrefix := `\$$ORIGIN/`
if ctx.Darwin() {
rpath_prefix = "@loader_path/"
rpathPrefix = "@loader_path/"
}
var rpath string
@ -225,8 +225,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
} else {
rpath = "lib"
}
flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpath_prefix+rpath)
flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpath_prefix+"../"+rpath)
flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpathPrefix+rpath)
flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpathPrefix+"../"+rpath)
}
return flags

View file

@ -700,13 +700,13 @@ type dependencyTag struct {
blueprint.BaseDependencyTag
name string
library bool
proc_macro bool
procMacro bool
}
// InstallDepNeeded returns true for rlibs, dylibs, and proc macros so that they or their transitive
// dependencies (especially C/C++ shared libs) are installed as dependencies of a rust binary.
func (d dependencyTag) InstallDepNeeded() bool {
return d.library || d.proc_macro
return d.library || d.procMacro
}
var _ android.InstallNeededDependencyTag = dependencyTag{}
@ -715,7 +715,7 @@ var (
customBindgenDepTag = dependencyTag{name: "customBindgenTag"}
rlibDepTag = dependencyTag{name: "rlibTag", library: true}
dylibDepTag = dependencyTag{name: "dylib", library: true}
procMacroDepTag = dependencyTag{name: "procMacro", proc_macro: true}
procMacroDepTag = dependencyTag{name: "procMacro", procMacro: true}
testPerSrcDepTag = dependencyTag{name: "rust_unit_tests"}
sourceDepTag = dependencyTag{name: "source"}
)

View file

@ -205,14 +205,14 @@ func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation st
func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
s.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(s.properties.Src))
filename := proptools.String(s.properties.Filename)
filename_from_src := proptools.Bool(s.properties.Filename_from_src)
filenameFromSrc := proptools.Bool(s.properties.Filename_from_src)
if filename == "" {
if filename_from_src {
if filenameFromSrc {
filename = s.sourceFilePath.Base()
} else {
filename = ctx.ModuleName()
}
} else if filename_from_src {
} else if filenameFromSrc {
ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
return
}

View file

@ -392,18 +392,18 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
}
missing_api := false
missingApi := false
for _, txt := range []string{"-current.txt", "-latest.txt"} {
path := path.Join(ctx.ModuleDir(), "api", m.BaseModuleName()+txt)
file := android.ExistentPathForSource(ctx, path)
if !file.Valid() {
ctx.ModuleErrorf("API file %#v doesn't exist", path)
missing_api = true
missingApi = true
}
}
if missing_api {
if missingApi {
script := "build/soong/scripts/gen-sysprop-api-files.sh"
p := android.ExistentPathForSource(ctx, script)

View file

@ -617,19 +617,19 @@ func (c *configImpl) configureLocale(ctx Context) {
// For LANG and LC_*, only preserve the evaluated version of
// LC_MESSAGES
user_lang := ""
userLang := ""
if lc_all, ok := c.environ.Get("LC_ALL"); ok {
user_lang = lc_all
userLang = lc_all
} else if lc_messages, ok := c.environ.Get("LC_MESSAGES"); ok {
user_lang = lc_messages
userLang = lc_messages
} else if lang, ok := c.environ.Get("LANG"); ok {
user_lang = lang
userLang = lang
}
c.environ.UnsetWithPrefix("LC_")
if user_lang != "" {
c.environ.Set("LC_MESSAGES", user_lang)
if userLang != "" {
c.environ.Set("LC_MESSAGES", userLang)
}
// The for LANG, use C.UTF-8 if it exists (Debian currently, proposed

View file

@ -254,7 +254,7 @@ func runMakeProductConfig(ctx Context, config Config) {
"BUILD_BROKEN_USES_BUILD_STATIC_LIBRARY",
}, exportEnvVars...), BannerVars...)
make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true, "")
makeVars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true, "")
if err != nil {
ctx.Fatalln("Error dumping make vars:", err)
}
@ -262,24 +262,24 @@ func runMakeProductConfig(ctx Context, config Config) {
env := config.Environment()
// Print the banner like make does
if !env.IsEnvTrue("ANDROID_QUIET_BUILD") {
fmt.Fprintln(ctx.Writer, Banner(make_vars))
fmt.Fprintln(ctx.Writer, Banner(makeVars))
}
// Populate the environment
for _, name := range exportEnvVars {
if make_vars[name] == "" {
if makeVars[name] == "" {
env.Unset(name)
} else {
env.Set(name, make_vars[name])
env.Set(name, makeVars[name])
}
}
config.SetKatiArgs(strings.Fields(make_vars["KATI_GOALS"]))
config.SetNinjaArgs(strings.Fields(make_vars["NINJA_GOALS"]))
config.SetTargetDevice(make_vars["TARGET_DEVICE"])
config.SetTargetDeviceDir(make_vars["TARGET_DEVICE_DIR"])
config.SetKatiArgs(strings.Fields(makeVars["KATI_GOALS"]))
config.SetNinjaArgs(strings.Fields(makeVars["NINJA_GOALS"]))
config.SetTargetDevice(makeVars["TARGET_DEVICE"])
config.SetTargetDeviceDir(makeVars["TARGET_DEVICE_DIR"])
config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenUsesNetwork(make_vars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(make_vars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
config.SetBuildBrokenDupRules(makeVars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
}

View file

@ -50,10 +50,10 @@ func testForDanglingRules(ctx Context, config Config) {
// Get a list of leaf nodes in the dependency graph from ninja
executable := config.PrebuiltBuildTool("ninja")
common_args := []string{}
common_args = append(common_args, config.NinjaArgs()...)
common_args = append(common_args, "-f", config.CombinedNinjaFile())
args := append(common_args, "-t", "targets", "rule")
commonArgs := []string{}
commonArgs = append(commonArgs, config.NinjaArgs()...)
commonArgs = append(commonArgs, "-f", config.CombinedNinjaFile())
args := append(commonArgs, "-t", "targets", "rule")
cmd := Command(ctx, config, "ninja", executable, args...)
stdout, err := cmd.StdoutPipe()
@ -114,28 +114,28 @@ func testForDanglingRules(ctx Context, config Config) {
title := "Dependencies in out found with no rule to create them:"
fmt.Fprintln(sb, title)
report_lines := 1
reportLines := 1
for i, dep := range danglingRulesList {
if report_lines > 20 {
if reportLines > 20 {
fmt.Fprintf(sb, " ... and %d more\n", len(danglingRulesList)-i)
break
}
// It's helpful to see the reverse dependencies. ninja -t query is the
// best tool we got for that. Its output starts with the dependency
// itself.
query_cmd := Command(ctx, config, "ninja", executable,
append(common_args, "-t", "query", dep)...)
query_stdout, err := query_cmd.StdoutPipe()
queryCmd := Command(ctx, config, "ninja", executable,
append(commonArgs, "-t", "query", dep)...)
queryStdout, err := queryCmd.StdoutPipe()
if err != nil {
ctx.Fatal(err)
}
query_cmd.StartOrFatal()
scanner := bufio.NewScanner(query_stdout)
queryCmd.StartOrFatal()
scanner := bufio.NewScanner(queryStdout)
for scanner.Scan() {
report_lines++
reportLines++
fmt.Fprintln(sb, " ", scanner.Text())
}
query_cmd.WaitOrFatal()
queryCmd.WaitOrFatal()
}
ts.FinishAction(status.ActionResult{

View file

@ -41,13 +41,13 @@ func isSmartTerminal(w io.Writer) bool {
func termSize(w io.Writer) (width int, height int, ok bool) {
if f, ok := w.(*os.File); ok {
var winsize struct {
ws_row, ws_column uint16
ws_xpixel, ws_ypixel uint16
wsRow, wsColumn uint16
wsXpixel, wsYpixel uint16
}
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, f.Fd(),
syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&winsize)),
0, 0, 0)
return int(winsize.ws_column), int(winsize.ws_row), err == 0
return int(winsize.wsColumn), int(winsize.wsRow), err == 0
} else if f, ok := w.(*fakeSmartTerminal); ok {
return f.termWidth, f.termHeight, true
}