From 8d6c51ebcc5d2703b5c3b4d7c6164c2790b3ed84 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 12 Jun 2020 17:26:31 +0900 Subject: apex_sets is added to apexkeys.txt apex_sets is a new module type that can be used to deliver pre-signed APEXes, which previously could be done only via prebuilt_apex. Soon gnow understands apex_sets module types and emits the signing info of the modules to apexkeys.txt Bug: 158729168 Test: m Change-Id: I9507375342ec053309660d94c931a79bf4f21218 --- apex/apex_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'apex/apex_test.go') diff --git a/apex/apex_test.go b/apex/apex_test.go index 7bd037481..39ce13581 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -241,6 +241,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr java.RegisterSystemModulesBuildComponents(ctx) java.RegisterAppBuildComponents(ctx) ctx.RegisterModuleType("java_sdk_library", java.SdkLibraryFactory) + ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory) ctx.PreDepsMutators(RegisterPreDepsMutators) ctx.PostDepsMutators(RegisterPostDepsMutators) @@ -5196,6 +5197,46 @@ func TestNoStaticLinkingToStubsLib(t *testing.T) { `) } +func TestApexKeysTxt(t *testing.T) { + ctx, _ := testApex(t, ` + apex { + name: "myapex", + key: "myapex.key", + } + + apex_key { + name: "myapex.key", + public_key: "testkey.avbpubkey", + private_key: "testkey.pem", + } + + prebuilt_apex { + name: "myapex", + prefer: true, + arch: { + arm64: { + src: "myapex-arm64.apex", + }, + arm: { + src: "myapex-arm.apex", + }, + }, + } + + apex_set { + name: "myapex_set", + set: "myapex.apks", + filename: "myapex_set.apex", + overrides: ["myapex"], + } + `) + + apexKeysText := ctx.SingletonForTests("apex_keys_text") + content := apexKeysText.MaybeDescription("apexkeys.txt").BuildParams.Args["content"] + ensureContains(t, content, `name="myapex_set.apex" public_key="PRESIGNED" private_key="PRESIGNED" container_certificate="PRESIGNED" container_private_key="PRESIGNED" partition="system"`) + ensureNotContains(t, content, "myapex.apex") +} + func TestMain(m *testing.M) { run := func() int { setUp() -- cgit v1.2.3-59-g8ed1b