diff options
author | 2017-12-12 11:18:02 -0800 | |
---|---|---|
committer | 2017-12-12 11:20:10 -0800 | |
commit | d7ad01b71564968002d1d30274764b636345c809 (patch) | |
tree | 6b7e4438a7aec01601d38b201fbe1c449ed2c4ee /src/main/java/com/google/devtools/build | |
parent | 23cf43da18202ebc7f056d87a22effeebcd8bf46 (diff) |
Add --checkHashMismatch flag to ZipFilterAction.
This flag is set to true by default. If `--checkHashMismatch IGNORE` is passed, ZipFilterEntryFilter will filter duplicate files based on filenames and not do the check for different content hashes.
This is used for Android instrumentation tests: classes already in the target APK are removed from the instrumentation APK to prevent runtime crashes in ART.
GITHUB: #903
RELNOTES: Added --checkHashMismatch flag to ZipFilterAction. Valid values are IGNORE, WARN and ERROR. --errorOnHashMismatch is deprecated, please use this flag instead.
PiperOrigin-RevId: 178787292
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ZipFilterBuilder.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ZipFilterBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ZipFilterBuilder.java index e3e83a3ffb..37e1af0b38 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ZipFilterBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ZipFilterBuilder.java @@ -44,6 +44,7 @@ public class ZipFilterBuilder { private final ImmutableSet.Builder<String> filterFileTypesBuilder; private final ImmutableSet.Builder<String> explicitFilterBuilder; private Compression outputMode = Compression.DONT_CHANGE; + private boolean checkHashMismatch = true; /** Creates a builder using the configuration of the rule as the action configuration. */ public ZipFilterBuilder(RuleContext ruleContext) { @@ -89,6 +90,12 @@ public class ZipFilterBuilder { return this; } + /** Enable checking of hash mismatches for files with the same name. */ + public ZipFilterBuilder setCheckHashMismatch(boolean enabled) { + this.checkHashMismatch = enabled; + return this; + } + /** Builds the action as configured. */ public void build() { ImmutableSet<Artifact> filterZips = filterZipsBuilder.build(); @@ -107,6 +114,9 @@ public class ZipFilterBuilder { if (!explicitFilters.isEmpty()) { args.addAll("--explicitFilters", VectorArg.join(",").each(explicitFilters)); } + if (!checkHashMismatch) { + args.add("--checkHashMismatch").add("IGNORE"); + } args.add("--outputMode"); switch (outputMode) { case COMPRESSED: |