Merge "Sort files in sdk snapshot zip to ensure consistent behavior"
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 57c171f..7ab5285 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -1339,9 +1339,9 @@
.intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_removed.txt -> sdk_library/module-lib/myjavalib-removed.txt
`),
checkMergeZips(
+ ".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip",
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip",
- ".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip",
),
)
}
diff --git a/sdk/update.go b/sdk/update.go
index 995da74..c555ddc 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -108,7 +108,7 @@
mergeZips = pctx.AndroidStaticRule("SnapshotMergeZips",
blueprint.RuleParams{
- Command: `${config.MergeZipsCmd} $out $in`,
+ Command: `${config.MergeZipsCmd} -s $out $in`,
CommandDeps: []string{
"${config.MergeZipsCmd}",
},
@@ -481,7 +481,7 @@
// Copy the build number file into the snapshot.
builder.CopyToSnapshot(ctx.Config().BuildNumberFile(ctx), BUILD_NUMBER_FILE)
- filesToZip := builder.filesToZip
+ filesToZip := android.SortedUniquePaths(builder.filesToZip)
// zip them all
zipPath := fmt.Sprintf("%s%s.zip", ctx.ModuleName(), snapshotFileSuffix)
@@ -517,7 +517,7 @@
Description: outputDesc,
Rule: mergeZips,
Input: zipFile,
- Inputs: builder.zipsToMerge,
+ Inputs: android.SortedUniquePaths(builder.zipsToMerge),
Output: outputZipFile,
})
}