Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18aefc19 authored by Jaewoong Jung's avatar Jaewoong Jung
Browse files

Remove unnecessary snake case variables.

Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
parent 1f8c2729
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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"})
+5 −5
Original line number Diff line number Diff line
@@ -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"))
+2 −2
Original line number Diff line number Diff line
@@ -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:
+12 −12
Original line number Diff line number Diff line
@@ -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
}
Loading