diff options
Diffstat (limited to 'java')
| -rwxr-xr-x | java/app.go | 39 | ||||
| -rw-r--r-- | java/app_import.go | 6 | ||||
| -rw-r--r-- | java/app_import_test.go | 20 | ||||
| -rw-r--r-- | java/bootclasspath_fragment.go | 19 | ||||
| -rw-r--r-- | java/bootclasspath_fragment_test.go | 22 | ||||
| -rw-r--r-- | java/config/config.go | 2 | ||||
| -rw-r--r-- | java/droiddoc.go | 2 | ||||
| -rw-r--r-- | java/rro.go | 3 |
8 files changed, 46 insertions, 67 deletions
diff --git a/java/app.go b/java/app.go index bccd37fa0..7f37ff35d 100755 --- a/java/app.go +++ b/java/app.go @@ -526,7 +526,8 @@ func (a *AndroidApp) JNISymbolsInstalls(installPath string) android.RuleBuilderI // Reads and prepends a main cert from the default cert dir if it hasn't been set already, i.e. it // isn't a cert module reference. Also checks and enforces system cert restriction if applicable. -func processMainCert(m android.ModuleBase, certPropValue string, certificates []Certificate, ctx android.ModuleContext) []Certificate { +func processMainCert(m android.ModuleBase, certPropValue string, certificates []Certificate, + ctx android.ModuleContext) (mainCertificate Certificate, allCertificates []Certificate) { if android.SrcIsModule(certPropValue) == "" { var mainCert Certificate if certPropValue != "" { @@ -558,7 +559,22 @@ func processMainCert(m android.ModuleBase, certPropValue string, certificates [] } } - return certificates + if len(certificates) > 0 { + mainCertificate = certificates[0] + } else { + // This can be reached with an empty certificate list if AllowMissingDependencies is set + // and the certificate property for this module is a module reference to a missing module. + if !ctx.Config().AllowMissingDependencies() && len(ctx.GetMissingDependencies()) > 0 { + panic("Should only get here if AllowMissingDependencies set and there are missing dependencies") + } + // Set a certificate to avoid panics later when accessing it. + mainCertificate = Certificate{ + Key: android.PathForModuleOut(ctx, "missing.pk8"), + Pem: android.PathForModuleOut(ctx, "missing.pem"), + } + } + + return mainCertificate, certificates } func (a *AndroidApp) InstallApkName() string { @@ -632,29 +648,14 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { dexJarFile := a.dexBuildActions(ctx) - jniLibs, prebuiltJniPackages, certificateDeps := collectAppDeps(ctx, a, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis)) + jniLibs, prebuiltJniPackages, certificates := collectAppDeps(ctx, a, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis)) jniJarFile := a.jniBuildActions(jniLibs, prebuiltJniPackages, ctx) if ctx.Failed() { return } - certificates := processMainCert(a.ModuleBase, a.getCertString(ctx), certificateDeps, ctx) - - // This can be reached with an empty certificate list if AllowMissingDependencies is set - // and the certificate property for this module is a module reference to a missing module. - if len(certificates) > 0 { - a.certificate = certificates[0] - } else { - if !ctx.Config().AllowMissingDependencies() && len(ctx.GetMissingDependencies()) > 0 { - panic("Should only get here if AllowMissingDependencies set and there are missing dependencies") - } - // Set a certificate to avoid panics later when accessing it. - a.certificate = Certificate{ - Key: android.PathForModuleOut(ctx, "missing.pk8"), - Pem: android.PathForModuleOut(ctx, "missing.pem"), - } - } + a.certificate, certificates = processMainCert(a.ModuleBase, a.getCertString(ctx), certificates, ctx) // Build a final signed app package. packageFile := android.PathForModuleOut(ctx, a.installApkName+".apk") diff --git a/java/app_import.go b/java/app_import.go index d6dca3836..6e603c912 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -318,19 +318,17 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext if a.isPrebuiltFrameworkRes() { a.outputFile = srcApk - certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx) + a.certificate, certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx) if len(certificates) != 1 { ctx.ModuleErrorf("Unexpected number of certificates were extracted: %q", certificates) } - a.certificate = certificates[0] } else if a.preprocessed { a.outputFile = srcApk a.certificate = PresignedCertificate } else if !Bool(a.properties.Presigned) { // If the certificate property is empty at this point, default_dev_cert must be set to true. // Which makes processMainCert's behavior for the empty cert string WAI. - certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx) - a.certificate = certificates[0] + a.certificate, certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx) signed := android.PathForModuleOut(ctx, "signed", apkFilename) var lineageFile android.Path if lineage := String(a.properties.Lineage); lineage != "" { diff --git a/java/app_import_test.go b/java/app_import_test.go index 41be092e2..ad27e3ae7 100644 --- a/java/app_import_test.go +++ b/java/app_import_test.go @@ -807,3 +807,23 @@ func TestAndroidTestImport_UncompressDex(t *testing.T) { } } } + +func TestAppImportMissingCertificateAllowMissingDependencies(t *testing.T) { + result := android.GroupFixturePreparers( + PrepareForTestWithJavaDefaultModules, + android.PrepareForTestWithAllowMissingDependencies, + android.PrepareForTestWithAndroidMk, + ).RunTestWithBp(t, ` + android_app_import { + name: "foo", + apk: "a.apk", + certificate: ":missing_certificate", + }`) + + foo := result.ModuleForTests("foo", "android_common") + fooApk := foo.Output("signed/foo.apk") + if fooApk.Rule != android.ErrorRule { + t.Fatalf("expected ErrorRule for foo.apk, got %s", fooApk.Rule.String()) + } + android.AssertStringDoesContain(t, "expected error rule message", fooApk.Args["error"], "missing dependencies: missing_certificate\n") +} diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index c884621a7..347e36b60 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -716,8 +716,6 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) // This is an exception to support end-to-end test for SdkExtensions, until such support exists. if android.InList("test_framework-sdkextensions", possibleUpdatableModules) { jars = jars.Append("com.android.sdkext", "test_framework-sdkextensions") - } else if android.InList("AddNewActivity", possibleUpdatableModules) { - jars = jars.Append("test_com.android.cts.frameworkresapkplits", "AddNewActivity") } else if android.InList("test_framework-apexd", possibleUpdatableModules) { jars = jars.Append("com.android.apex.test_package", "test_framework-apexd") } else if global.ApexBootJars.Len() != 0 && !android.IsModuleInVersionedSdk(ctx.Module()) { @@ -840,22 +838,7 @@ func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.Modul // isTestFragment returns true if the current module is a test bootclasspath_fragment. func (b *BootclasspathFragmentModule) isTestFragment() bool { - if b.testFragment { - return true - } - - // TODO(b/194063708): Once test fragments all use bootclasspath_fragment_test - // Some temporary exceptions until all test fragments use the - // bootclasspath_fragment_test module type. - name := b.BaseModuleName() - if strings.HasPrefix(name, "test_") { - return true - } - if name == "apex.apexd_test_bootclasspath-fragment" { - return true - } - - return false + return b.testFragment } // generateHiddenApiFlagRules generates rules to generate hidden API flags and compute the signature diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index c63df599a..2541f14ff 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -408,22 +408,6 @@ func TestBootclasspathFragment_Test(t *testing.T) { }, } - bootclasspath_fragment { - name: "test_fragment", - contents: ["mysdklibrary"], - hidden_api: { - split_packages: [], - }, - } - - bootclasspath_fragment { - name: "apex.apexd_test_bootclasspath-fragment", - contents: ["mysdklibrary"], - hidden_api: { - split_packages: [], - }, - } - bootclasspath_fragment_test { name: "a_test_fragment", contents: ["mysdklibrary"], @@ -445,12 +429,6 @@ func TestBootclasspathFragment_Test(t *testing.T) { fragment := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule) android.AssertBoolEquals(t, "not a test fragment", false, fragment.isTestFragment()) - fragment = result.Module("test_fragment", "android_common").(*BootclasspathFragmentModule) - android.AssertBoolEquals(t, "is a test fragment by prefix", true, fragment.isTestFragment()) - fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule) android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment()) - - fragment = result.Module("apex.apexd_test_bootclasspath-fragment", "android_common").(*BootclasspathFragmentModule) - android.AssertBoolEquals(t, "is a test fragment by name", true, fragment.isTestFragment()) } diff --git a/java/config/config.go b/java/config/config.go index b026d73cf..03288fe6a 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -78,7 +78,7 @@ var ( func init() { pctx.Import("github.com/google/blueprint/bootstrap") - exportedVars.ExportStringStaticVariable("JavacHeapSize", "2048M") + exportedVars.ExportStringStaticVariable("JavacHeapSize", "4096M") exportedVars.ExportStringStaticVariable("JavacHeapFlags", "-J-Xmx${JavacHeapSize}") // ErrorProne can use significantly more memory than javac alone, give it a higher heap diff --git a/java/droiddoc.go b/java/droiddoc.go index fc95184f1..15585f16a 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -684,7 +684,7 @@ func javadocCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs andro outDir, srcJarDir, srcJarList android.Path, sourcepaths android.Paths) *android.RuleBuilderCommand { cmd := rule.Command(). - BuiltTool("soong_javac_wrapper").Tool(config.JavadocCmd(ctx)). + BuiltTool("soong_javac_wrapper").Tool(android.PathForSource(ctx, "prebuilts/jdk/jdk11/linux-x86/bin/javadoc")). Flag(config.JavacVmFlags). FlagWithArg("-encoding ", "UTF-8"). FlagWithRspFileInputList("@", android.PathForModuleOut(ctx, "javadoc.rsp"), srcs). diff --git a/java/rro.go b/java/rro.go index c12e748c6..3a92b0cf2 100644 --- a/java/rro.go +++ b/java/rro.go @@ -146,7 +146,7 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC // Sign the built package _, _, certificates := collectAppDeps(ctx, r, false, false) - certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx) + r.certificate, certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx) signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk") var lineageFile android.Path if lineage := String(r.properties.Lineage); lineage != "" { @@ -156,7 +156,6 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC rotationMinSdkVersion := String(r.properties.RotationMinSdkVersion) SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile, rotationMinSdkVersion) - r.certificate = certificates[0] r.outputFile = signed partition := rroPartition(ctx) |