Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
diff --git a/apex/apex.go b/apex/apex.go
index 9e66254..9fb616d 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -298,12 +298,12 @@
// 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 @@
}
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 @@
}
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 @@
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 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
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index cb43e24..75b2779 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2679,12 +2679,12 @@
// 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 @@
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)
}
diff --git a/apex/builder.go b/apex/builder.go
index 9db8e59..0e4ba1d 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -577,8 +577,8 @@
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 @@
"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 @@
// 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)
diff --git a/apex/key.go b/apex/key.go
index d9e3c10..752888d 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -36,8 +36,8 @@
properties apexKeyProperties
- public_key_file android.Path
- private_key_file android.Path
+ publicKeyFile android.Path
+ privateKeyFile android.Path
keyName string
}
@@ -69,30 +69,30 @@
// 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
@@ -107,20 +107,20 @@
func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
s.output = android.PathForOutput(ctx, "apexkeys.txt")
type apexKeyEntry struct {
- name string
- presigned bool
- public_key string
- private_key string
- container_certificate string
- container_private_key string
- partition string
+ name string
+ presigned bool
+ publicKey string
+ privateKey string
+ containerCertificate string
+ containerPrivateKey string
+ partition string
}
toString := func(e apexKeyEntry) string {
format := "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q partition=%q\n"
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)
}
}
@@ -129,13 +129,13 @@
if m, ok := module.(*apexBundle); ok && m.Enabled() && m.installable() {
pem, key := m.getCertificateAndPrivateKey(ctx)
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(),
- partition: m.PartitionTag(ctx.DeviceConfig()),
+ name: m.Name() + ".apex",
+ presigned: false,
+ publicKey: m.publicKeyFile.String(),
+ privateKey: m.privateKeyFile.String(),
+ containerCertificate: pem.String(),
+ containerPrivateKey: key.String(),
+ partition: m.PartitionTag(ctx.DeviceConfig()),
}
}
})