diff options
author | 2021-05-05 22:00:51 +0100 | |
---|---|---|
committer | 2021-05-12 22:14:32 +0100 | |
commit | 43f7bf0efddb6609c249b87cb9b6d26f62d76e02 (patch) | |
tree | b7fa9af6c853b2540a7003f783f81d688f34e521 /sdk/sdk_test.go | |
parent | c8aeb00a9cb273acc4b4f92beddf592642cc3e5e (diff) |
Add SOONG_SDK_SNAPSHOT_VERSION support
SOONG_SDK_SNAPSHOT_VERSION=current will generate unversioned and
versioned prebuilts and a versioned snapshot module. This is the
default behavior. The zip file containing the generated snapshot will
be <sdk name>-current.zip.
SOONG_SDK_SNAPSHOT_VERSION=unversioned will generate unversioned
prebuilts only and the zip file containing the generated snapshot will
be <sdk name>.zip.
SOONG_SDK_SNAPSHOT_VERSION=<number> will generate versioned prebuilts
and a versioned snapshot module only. The zip file containing the
generated snapshot will be <sdk name>-<number>.zip.
Bug: 157884619
Test: m nothing
m SOONG_SDK_SNAPSHOT_VERSION=current art-module-sdk
- check that the generated Android.bp file has not changed
from the default.
m SOONG_SDK_SNAPSHOT_VERSION=none art-module-sdk
- check that the generated Android.bp file does not contain
versioned modules.
m SOONG_SDK_SNAPSHOT_VERSION=2 art-module-sdk
- check that the generated Android.bp file only contains
version 2 of each module.
Change-Id: I087e9d7d3ad110508a3d6a39bca50cbb46b3ce82
Diffstat (limited to 'sdk/sdk_test.go')
-rw-r--r-- | sdk/sdk_test.go | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index 12545d666..a13b0d7d0 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -564,4 +564,101 @@ sdk_snapshot { `), ) }) + + t.Run("SOONG_SDK_SNAPSHOT_VERSION=unversioned", func(t *testing.T) { + result := android.GroupFixturePreparers( + preparer, + android.FixtureMergeEnv(map[string]string{ + "SOONG_SDK_SNAPSHOT_VERSION": "unversioned", + }), + ).RunTest(t) + + checkZipFile(t, result, "out/soong/.intermediates/mysdk/common_os/mysdk.zip") + + CheckSnapshot(t, result, "mysdk", "", + checkAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +java_import { + name: "myjavalib", + prefer: false, + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java/myjavalib.jar"], +} + `), + ) + }) + + t.Run("SOONG_SDK_SNAPSHOT_VERSION=current", func(t *testing.T) { + result := android.GroupFixturePreparers( + preparer, + android.FixtureMergeEnv(map[string]string{ + "SOONG_SDK_SNAPSHOT_VERSION": "current", + }), + ).RunTest(t) + + checkZipFile(t, result, "out/soong/.intermediates/mysdk/common_os/mysdk-current.zip") + + CheckSnapshot(t, result, "mysdk", "", + checkAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +java_import { + name: "mysdk_myjavalib@current", + sdk_member_name: "myjavalib", + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java/myjavalib.jar"], +} + +java_import { + name: "myjavalib", + prefer: false, + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java/myjavalib.jar"], +} + +sdk_snapshot { + name: "mysdk@current", + visibility: ["//visibility:public"], + java_header_libs: ["mysdk_myjavalib@current"], +} + `), + ) + }) + + t.Run("SOONG_SDK_SNAPSHOT_VERSION=2", func(t *testing.T) { + result := android.GroupFixturePreparers( + preparer, + android.FixtureMergeEnv(map[string]string{ + "SOONG_SDK_SNAPSHOT_VERSION": "2", + }), + ).RunTest(t) + + checkZipFile(t, result, "out/soong/.intermediates/mysdk/common_os/mysdk-2.zip") + + CheckSnapshot(t, result, "mysdk", "", + checkAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +java_import { + name: "mysdk_myjavalib@2", + sdk_member_name: "myjavalib", + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java/myjavalib.jar"], +} + +sdk_snapshot { + name: "mysdk@2", + visibility: ["//visibility:public"], + java_header_libs: ["mysdk_myjavalib@2"], +} + `), + // A versioned snapshot cannot be used on its own so add the source back in. + snapshotTestPreparer(checkSnapshotWithoutSource, android.FixtureWithRootAndroidBp(bp)), + ) + }) } |