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
diff --git a/sdk/testing.go b/sdk/testing.go
index f4e85c0..3254cf9 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -131,6 +131,7 @@
info := &snapshotBuildInfo{
t: t,
r: result,
+ version: sdk.builderForTests.version,
androidBpContents: sdk.GetAndroidBpContentsForTests(),
androidUnversionedBpContents: sdk.GetUnversionedAndroidBpContentsForTests(),
androidVersionedBpContents: sdk.GetVersionedAndroidBpContentsForTests(),
@@ -236,8 +237,13 @@
if dir != "" {
dir = filepath.Clean(dir) + "/"
}
- android.AssertStringEquals(t, "Snapshot zip file in wrong place",
- fmt.Sprintf(".intermediates/%s%s/%s/%s-current.zip", dir, name, variant, name), actual)
+ suffix := ""
+ if snapshotBuildInfo.version != soongSdkSnapshotVersionUnversioned {
+ suffix = "-" + snapshotBuildInfo.version
+ }
+
+ expectedZipPath := fmt.Sprintf(".intermediates/%s%s/%s/%s%s.zip", dir, name, variant, name, suffix)
+ android.AssertStringEquals(t, "Snapshot zip file in wrong place", expectedZipPath, actual)
// Populate a mock filesystem with the files that would have been copied by
// the rules.
@@ -432,6 +438,11 @@
// The result from RunTest()
r *android.TestResult
+ // The version of the generated snapshot.
+ //
+ // See snapshotBuilder.version for more information about this field.
+ version string
+
// The contents of the generated Android.bp file
androidBpContents string