From 9b409bcd10cec5c64b12494a6ada05a7dd65a721 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 11 Oct 2019 14:59:13 +0900 Subject: Create scripts to update and freeze a module SDK `m ` generates two scripts each of which is use to update the current snapshot of the SDK and to freeze ToT as a new version, respectively. Executing the scripts will copy necessary files (stub libraries, AIDL files, etc.) along with Android.bp into the ./ directory under the directory where the sdk is defined. This change also introduces a new module type 'sdk_snapshot' that represents a snapshot of an SDK. It will be auto-generated by the above scripts, so developers are not expected to write this manually. The module type 'sdk' is now used to simply specify the list of modules that an SDK has. Finally, this change changes the version separator from '#' to '@' because '#' confuses Make. Bug: 138182343 Test: m Change-Id: Ifcbc3a39a2f6ad5b4f4b200ba55a1ce3281498cf --- sdk/sdk_test.go | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'sdk/sdk_test.go') diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index 9eca72fdc..942556a32 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -69,6 +69,7 @@ func testSdkContext(t *testing.T, bp string) (*android.TestContext, android.Conf // from this package ctx.RegisterModuleType("sdk", android.ModuleFactoryAdaptor(ModuleFactory)) + ctx.RegisterModuleType("sdk_snapshot", android.ModuleFactoryAdaptor(SnapshotModuleFactory)) ctx.PreDepsMutators(RegisterPreDepsMutators) ctx.PostDepsMutators(RegisterPostDepsMutators) @@ -155,12 +156,17 @@ func pathsToStrings(paths android.Paths) []string { func TestBasicSdkWithJava(t *testing.T) { ctx, _ := testSdk(t, ` sdk { - name: "mysdk#1", + name: "mysdk", + java_libs: ["sdkmember"], + } + + sdk_snapshot { + name: "mysdk@1", java_libs: ["sdkmember_mysdk_1"], } - sdk { - name: "mysdk#2", + sdk_snapshot { + name: "mysdk@2", java_libs: ["sdkmember_mysdk_2"], } @@ -195,7 +201,7 @@ func TestBasicSdkWithJava(t *testing.T) { apex { name: "myapex", java_libs: ["myjavalib"], - uses_sdks: ["mysdk#1"], + uses_sdks: ["mysdk@1"], key: "myapex.key", certificate: ":myapex.cert", } @@ -203,7 +209,7 @@ func TestBasicSdkWithJava(t *testing.T) { apex { name: "myapex2", java_libs: ["myjavalib"], - uses_sdks: ["mysdk#2"], + uses_sdks: ["mysdk@2"], key: "myapex.key", certificate: ":myapex.cert", } @@ -223,12 +229,17 @@ func TestBasicSdkWithJava(t *testing.T) { func TestBasicSdkWithCc(t *testing.T) { ctx, _ := testSdk(t, ` sdk { - name: "mysdk#1", + name: "mysdk", + native_shared_libs: ["sdkmember"], + } + + sdk_snapshot { + name: "mysdk@1", native_shared_libs: ["sdkmember_mysdk_1"], } - sdk { - name: "mysdk#2", + sdk_snapshot { + name: "mysdk@2", native_shared_libs: ["sdkmember_mysdk_2"], } @@ -267,7 +278,7 @@ func TestBasicSdkWithCc(t *testing.T) { apex { name: "myapex", native_shared_libs: ["mycpplib"], - uses_sdks: ["mysdk#1"], + uses_sdks: ["mysdk@1"], key: "myapex.key", certificate: ":myapex.cert", } @@ -275,7 +286,7 @@ func TestBasicSdkWithCc(t *testing.T) { apex { name: "myapex2", native_shared_libs: ["mycpplib"], - uses_sdks: ["mysdk#2"], + uses_sdks: ["mysdk@2"], key: "myapex.key", certificate: ":myapex.cert", } -- cgit v1.2.3-59-g8ed1b