Index: build/android/gyp/proguard.py |
diff --git a/build/android/gyp/proguard.py b/build/android/gyp/proguard.py |
index 071f32438439df45f57c169c8d6dec3993cf7d3f..8cfa27b7da61b71e3a70151fdb62972600ee1b9c 100755 |
--- a/build/android/gyp/proguard.py |
+++ b/build/android/gyp/proguard.py |
@@ -66,6 +66,18 @@ def main(args): |
args = build_utils.ExpandFileArgs(args) |
options = _ParseOptions(args) |
+ # Work around cases where we switch from a non-proguard setup |
+ # to proguard. The output jar might exist and might be a hardlink |
+ # to the input jar, so remove the output before doing anything |
+ # in that case to avoid an incremental build failure. |
+ try: |
+ out_inode = os.stat(options.output_path).st_ino |
+ except OSError: |
+ out_inode = None |
+ if (out_inode and |
+ out_inode in (os.stat(injar).st_ino for injar in options.input_paths)): |
+ os.unlink(options.output_path) |
+ |
proguard = proguard_util.ProguardCmdBuilder(options.proguard_path) |
proguard.injars(options.input_paths) |
proguard.configs(options.proguard_configs) |