summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apex/apex.go59
-rw-r--r--apex/key.go53
-rw-r--r--cc/test.go4
-rw-r--r--java/aar.go3
-rw-r--r--java/android_manifest.go6
-rw-r--r--java/app.go4
-rw-r--r--java/dex.go4
-rw-r--r--java/java.go2
-rw-r--r--python/test.go2
-rw-r--r--tradefed/autogen.go26
-rw-r--r--ui/build/paths/config.go68
11 files changed, 144 insertions, 87 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 3b06a9958..408415eb3 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -379,6 +379,13 @@ type apexBundle struct {
outputFiles map[apexPackaging]android.WritablePath
installDir android.OutputPath
+ public_key_file android.Path
+ private_key_file android.Path
+ bundle_public_key bool
+
+ container_certificate_file android.Path
+ container_private_key_file android.Path
+
// list of files to be included in this apex
filesInfo []apexFile
@@ -635,10 +642,6 @@ func getCopyManifestForPrebuiltEtc(prebuilt *android.PrebuiltEtc) (fileToCopy an
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filesInfo := []apexFile{}
- var keyFile android.Path
- var pubKeyFile android.Path
- var certificate java.Certificate
-
if a.properties.Payload_type == nil || *a.properties.Payload_type == "image" {
a.apexTypes = imageApex
} else if *a.properties.Payload_type == "zip" {
@@ -704,20 +707,20 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
case keyTag:
if key, ok := child.(*apexKey); ok {
- keyFile = key.private_key_file
- if !key.installable() && ctx.Config().Debuggable() {
- // If the key is not installed, bundled it with the APEX.
- // Note: this bundled key is valid only for non-production builds
- // (eng/userdebug).
- pubKeyFile = key.public_key_file
- }
+ a.private_key_file = key.private_key_file
+ a.public_key_file = key.public_key_file
+ // If the key is not installed, bundled it with the APEX.
+ // Note: this bundled key is valid only for non-production builds
+ // (eng/userdebug).
+ a.bundle_public_key = !key.installable() && ctx.Config().Debuggable()
return false
} else {
ctx.PropertyErrorf("key", "%q is not an apex_key module", depName)
}
case certificateTag:
if dep, ok := child.(*java.AndroidAppCertificate); ok {
- certificate = dep.Certificate
+ a.container_certificate_file = dep.Certificate.Pem
+ a.container_private_key_file = dep.Certificate.Key
return false
} else {
ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", depName)
@@ -741,7 +744,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
})
a.flattened = ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
- if keyFile == nil {
+ if a.private_key_file == nil {
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
return
}
@@ -775,30 +778,28 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.filesInfo = filesInfo
if a.apexTypes.zip() {
- a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, zipApex)
+ a.buildUnflattenedApex(ctx, zipApex)
}
if a.apexTypes.image() {
// Build rule for unflattened APEX is created even when ctx.Config().FlattenApex()
// is true. This is to support referencing APEX via ":<module_name" syntax
// in other modules. It is in AndroidMk where the selection of flattened
// or unflattened APEX is made.
- a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, imageApex)
+ a.buildUnflattenedApex(ctx, imageApex)
a.buildFlattenedApex(ctx)
}
}
-func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile android.Path,
- pubKeyFile android.Path, certificate java.Certificate, apexType apexPackaging) {
+func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType apexPackaging) {
cert := String(a.properties.Certificate)
if cert != "" && android.SrcIsModule(cert) == "" {
defaultDir := ctx.Config().DefaultAppCertificateDir(ctx)
- certificate = java.Certificate{
- defaultDir.Join(ctx, cert+".x509.pem"),
- defaultDir.Join(ctx, cert+".pk8"),
- }
+ a.container_certificate_file = defaultDir.Join(ctx, cert+".x509.pem")
+ a.container_private_key_file = defaultDir.Join(ctx, cert+".pk8")
} else if cert == "" {
pem, key := ctx.Config().DefaultAppCertificate(ctx)
- certificate = java.Certificate{pem, key}
+ a.container_certificate_file = pem
+ a.container_private_key_file = key
}
manifest := ctx.ExpandSource(proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"), "manifest")
@@ -886,10 +887,10 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
optFlags := []string{}
// Additional implicit inputs.
- implicitInputs = append(implicitInputs, cannedFsConfig, fileContexts, keyFile)
- if pubKeyFile != nil {
- implicitInputs = append(implicitInputs, pubKeyFile)
- optFlags = append(optFlags, "--pubkey "+pubKeyFile.String())
+ implicitInputs = append(implicitInputs, cannedFsConfig, fileContexts, a.private_key_file)
+ if a.bundle_public_key {
+ implicitInputs = append(implicitInputs, a.public_key_file)
+ optFlags = append(optFlags, "--pubkey "+a.public_key_file.String())
}
manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName())
@@ -915,7 +916,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
"manifest": manifest.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
- "key": keyFile.String(),
+ "key": a.private_key_file.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
@@ -962,14 +963,14 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
Output: a.outputFiles[apexType],
Input: unsignedOutputFile,
Args: map[string]string{
- "certificates": strings.Join([]string{certificate.Pem.String(), certificate.Key.String()}, " "),
+ "certificates": a.container_certificate_file.String() + " " + a.container_private_key_file.String(),
"flags": "-a 4096", //alignment
},
})
// Install to $OUT/soong/{target,host}/.../apex
if a.installable() && (!ctx.Config().FlattenApex() || apexType.zip()) {
- ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
+ ctx.InstallFile(a.installDir, ctx.ModuleName()+suffix, a.outputFiles[apexType])
}
}
diff --git a/apex/key.go b/apex/key.go
index 5282416c6..4c83861b2 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -17,6 +17,7 @@ package apex
import (
"fmt"
"io"
+ "strings"
"android/soong/android"
@@ -27,6 +28,8 @@ var String = proptools.String
func init() {
android.RegisterModuleType("apex_key", apexKeyFactory)
+ android.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
+ android.RegisterMakeVarsProvider(pctx, apexKeysFileProvider)
}
type apexKey struct {
@@ -102,3 +105,53 @@ func (m *apexKey) AndroidMk() android.AndroidMkData {
},
}
}
+
+////////////////////////////////////////////////////////////////////////
+// apex_keys_text
+type apexKeysText struct{}
+
+func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
+ output := android.PathForOutput(ctx, "apexkeys.txt")
+ *apexKeysFile(ctx.Config()) = output.String()
+ var filecontent strings.Builder
+ ctx.VisitAllModules(func(module android.Module) {
+ if m, ok := module.(android.Module); ok && !m.Enabled() {
+ return
+ }
+
+ if m, ok := module.(*apexBundle); ok {
+ fmt.Fprintf(&filecontent,
+ "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n",
+ m.Name()+".apex",
+ m.public_key_file.String(),
+ m.private_key_file.String(),
+ m.container_certificate_file.String(),
+ m.container_private_key_file.String())
+ }
+ })
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.WriteFile,
+ Description: "apex_keys.txt",
+ Output: output,
+ Args: map[string]string{
+ "content": filecontent.String(),
+ },
+ })
+}
+
+var apexKeysFileKey = android.NewOnceKey("apexKeysFile")
+
+func apexKeysFile(config android.Config) *string {
+ return config.Once(apexKeysFileKey, func() interface{} {
+ str := ""
+ return &str
+ }).(*string)
+}
+
+func apexKeysTextFactory() android.Singleton {
+ return &apexKeysText{}
+}
+
+func apexKeysFileProvider(ctx android.MakeVarsContext) {
+ ctx.Strict("SOONG_APEX_KEYS_FILE", *apexKeysFile(ctx.Config()))
+}
diff --git a/cc/test.go b/cc/test.go
index f7180b561..e9f0944ca 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -244,7 +244,7 @@ func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.data = ctx.ExpandSources(test.Properties.Data, nil)
test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
- test.Properties.Test_config_template)
+ test.Properties.Test_config_template, test.Properties.Test_suites)
test.binaryDecorator.baseInstaller.dir = "nativetest"
test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
@@ -368,7 +368,7 @@ func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
benchmark.data = ctx.ExpandSources(benchmark.Properties.Data, nil)
benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config,
- benchmark.Properties.Test_config_template)
+ benchmark.Properties.Test_config_template, benchmark.Properties.Test_suites)
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
diff --git a/java/aar.go b/java/aar.go
index 583a6fcc2..b8a5e35cd 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -77,6 +77,7 @@ type aapt struct {
isLibrary bool
uncompressedJNI bool
useEmbeddedDex bool
+ usesNonSdkApis bool
aaptProperties aaptProperties
}
@@ -184,7 +185,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
manifestSrcPath := android.PathForModuleSrc(ctx, manifestFile)
manifestPath := manifestMerger(ctx, manifestSrcPath, sdkContext, staticLibManifests, a.isLibrary,
- a.uncompressedJNI, a.useEmbeddedDex)
+ a.uncompressedJNI, a.useEmbeddedDex, a.usesNonSdkApis)
linkFlags, linkDeps, resDirs, overlayDirs, rroDirs := a.aapt2Flags(ctx, sdkContext, manifestPath)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index e63fb8049..3cca4f718 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -44,7 +44,7 @@ var manifestMergerRule = pctx.AndroidStaticRule("manifestMerger",
"libs")
func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext,
- staticLibManifests android.Paths, isLibrary bool, uncompressedJNI, useEmbeddedDex bool) android.Path {
+ staticLibManifests android.Paths, isLibrary, uncompressedJNI, useEmbeddedDex, usesNonSdkApis bool) android.Path {
var args []string
if isLibrary {
@@ -62,6 +62,10 @@ func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext
}
}
+ if usesNonSdkApis {
+ args = append(args, "--uses-non-sdk-api")
+ }
+
if useEmbeddedDex {
args = append(args, "--use-embedded-dex=true")
}
diff --git a/java/app.go b/java/app.go
index 3cb7e8e2f..c08aefd1f 100644
--- a/java/app.go
+++ b/java/app.go
@@ -186,6 +186,8 @@ func (a *AndroidApp) shouldUncompressDex(ctx android.ModuleContext) bool {
}
func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
+ a.aapt.usesNonSdkApis = Bool(a.Module.deviceProperties.Platform_apis)
+
aaptLinkFlags := []string{}
// Add TARGET_AAPT_CHARACTERISTICS values to AAPT link flags if they exist and --product flags were not provided.
@@ -441,7 +443,7 @@ type AndroidTest struct {
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.generateAndroidBuildActions(ctx)
- a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.testProperties.Test_config_template, a.manifestPath)
+ a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.testProperties.Test_config_template, a.manifestPath, a.testProperties.Test_suites)
a.data = ctx.ExpandSources(a.testProperties.Data, nil)
}
diff --git a/java/dex.go b/java/dex.go
index 913eee6ad..54b7bfcfb 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -177,9 +177,9 @@ func (j *Module) compileDex(ctx android.ModuleContext, flags javaBuilderFlags,
javalibJar := android.PathForModuleOut(ctx, "dex", jarName)
outDir := android.PathForModuleOut(ctx, "dex")
- zipFlags := ""
+ zipFlags := "--ignore_missing_files"
if j.deviceProperties.UncompressDex {
- zipFlags = "-L 0"
+ zipFlags += " -L 0"
}
if useR8 {
diff --git a/java/java.go b/java/java.go
index 880f9200e..350117467 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1527,7 +1527,7 @@ type Test struct {
}
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template)
+ j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template, j.testProperties.Test_suites)
j.data = ctx.ExpandSources(j.testProperties.Data, nil)
j.Library.GenerateAndroidBuildActions(ctx)
diff --git a/python/test.go b/python/test.go
index 43ee54c89..55b0ab53a 100644
--- a/python/test.go
+++ b/python/test.go
@@ -50,7 +50,7 @@ func (test *testDecorator) bootstrapperProps() []interface{} {
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
test.testConfig = tradefed.AutoGenPythonBinaryHostTestConfig(ctx, test.testProperties.Test_config,
- test.testProperties.Test_config_template)
+ test.testProperties.Test_config_template, test.binaryDecorator.binaryProperties.Test_suites)
test.binaryDecorator.pythonInstaller.dir = "nativetest"
test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index e6a1b48cc..cfa7164bb 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -15,8 +15,6 @@
package tradefed
import (
- "strings"
-
"github.com/google/blueprint"
"android/soong/android"
@@ -40,10 +38,10 @@ var autogenTestConfig = pctx.StaticRule("autogenTestConfig", blueprint.RuleParam
CommandDeps: []string{"$template"},
}, "name", "template")
-func testConfigPath(ctx android.ModuleContext, prop *string) (path android.Path, autogenPath android.WritablePath) {
+func testConfigPath(ctx android.ModuleContext, prop *string, testSuites []string) (path android.Path, autogenPath android.WritablePath) {
if p := getTestConfig(ctx, prop); p != nil {
return p, nil
- } else if !strings.HasPrefix(ctx.ModuleDir(), "cts/") {
+ } else if !android.InList("cts", testSuites) {
outputFile := android.PathForModuleOut(ctx, ctx.ModuleName()+".config")
return nil, outputFile
} else {
@@ -67,8 +65,8 @@ func autogenTemplate(ctx android.ModuleContext, output android.WritablePath, tem
}
func AutoGenNativeTestConfig(ctx android.ModuleContext, testConfigProp *string,
- testConfigTemplateProp *string) android.Path {
- path, autogenPath := testConfigPath(ctx, testConfigProp)
+ testConfigTemplateProp *string, testSuites []string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
@@ -86,8 +84,8 @@ func AutoGenNativeTestConfig(ctx android.ModuleContext, testConfigProp *string,
}
func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, testConfigProp *string,
- testConfigTemplateProp *string) android.Path {
- path, autogenPath := testConfigPath(ctx, testConfigProp)
+ testConfigTemplateProp *string, testSuites []string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
@@ -100,8 +98,8 @@ func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, testConfigProp
return path
}
-func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string) android.Path {
- path, autogenPath := testConfigPath(ctx, testConfigProp)
+func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string, testSuites []string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
@@ -119,9 +117,9 @@ func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, te
}
func AutoGenPythonBinaryHostTestConfig(ctx android.ModuleContext, testConfigProp *string,
- testConfigTemplateProp *string) android.Path {
+ testConfigTemplateProp *string, testSuites []string) android.Path {
- path, autogenPath := testConfigPath(ctx, testConfigProp)
+ path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
@@ -143,8 +141,8 @@ var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", b
},
}, "name", "template")
-func AutoGenInstrumentationTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string, manifest android.Path) android.Path {
- path, autogenPath := testConfigPath(ctx, testConfigProp)
+func AutoGenInstrumentationTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string, manifest android.Path, testSuites []string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites)
if autogenPath != nil {
template := "${InstrumentationTestConfigTemplate}"
moduleTemplate := getTestConfigTemplate(ctx, testConfigTemplateProp)
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index d4922f30b..fb30f850d 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -74,41 +74,39 @@ func GetConfig(name string) PathConfig {
}
var Configuration = map[string]PathConfig{
- "bash": Allowed,
- "bc": Allowed,
- "bzip2": Allowed,
- "date": Allowed,
- "dd": Allowed,
- "diff": Allowed,
- "egrep": Allowed,
- "find": Allowed,
- "fuser": Allowed,
- "getopt": Allowed,
- "git": Allowed,
- "grep": Allowed,
- "gzip": Allowed,
- "hexdump": Allowed,
- "jar": Allowed,
- "java": Allowed,
- "javap": Allowed,
- "lsof": Allowed,
- "m4": Allowed,
- "openssl": Allowed,
- "patch": Allowed,
- "pstree": Allowed,
- "python": Allowed,
- "python2.7": Allowed,
- "python3": Allowed,
- "realpath": Allowed,
- "rsync": Allowed,
- "sh": Allowed,
- "tar": Allowed,
- "timeout": Allowed,
- "tr": Allowed,
- "unzip": Allowed,
- "xz": Allowed,
- "zip": Allowed,
- "zipinfo": Allowed,
+ "bash": Allowed,
+ "bc": Allowed,
+ "bzip2": Allowed,
+ "date": Allowed,
+ "dd": Allowed,
+ "diff": Allowed,
+ "egrep": Allowed,
+ "find": Allowed,
+ "fuser": Allowed,
+ "getopt": Allowed,
+ "git": Allowed,
+ "grep": Allowed,
+ "gzip": Allowed,
+ "hexdump": Allowed,
+ "jar": Allowed,
+ "java": Allowed,
+ "javap": Allowed,
+ "lsof": Allowed,
+ "m4": Allowed,
+ "openssl": Allowed,
+ "patch": Allowed,
+ "pstree": Allowed,
+ "python3": Allowed,
+ "realpath": Allowed,
+ "rsync": Allowed,
+ "sh": Allowed,
+ "tar": Allowed,
+ "timeout": Allowed,
+ "tr": Allowed,
+ "unzip": Allowed,
+ "xz": Allowed,
+ "zip": Allowed,
+ "zipinfo": Allowed,
// Host toolchain is removed. In-tree toolchain should be used instead.
// GCC also can't find cc1 with this implementation.