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
This commit is contained in:
@@ -131,6 +131,7 @@ func getSdkSnapshotBuildInfo(t *testing.T, result *android.TestResult, sdk *sdk)
|
||||
info := &snapshotBuildInfo{
|
||||
t: t,
|
||||
r: result,
|
||||
version: sdk.builderForTests.version,
|
||||
androidBpContents: sdk.GetAndroidBpContentsForTests(),
|
||||
androidUnversionedBpContents: sdk.GetUnversionedAndroidBpContentsForTests(),
|
||||
androidVersionedBpContents: sdk.GetVersionedAndroidBpContentsForTests(),
|
||||
@@ -236,8 +237,13 @@ func CheckSnapshot(t *testing.T, result *android.TestResult, name string, dir st
|
||||
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 @@ type snapshotBuildInfo struct {
|
||||
// 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
|
||||
|
||||
|
Reference in New Issue
Block a user