diff --git a/Util/Xamarin.Build.Download/source/Xamarin.Build.Download/XamarinBuildAndroidAarProguardConfigs.cs b/Util/Xamarin.Build.Download/source/Xamarin.Build.Download/XamarinBuildAndroidAarProguardConfigs.cs index 64e7def3fe..3cb845d3b0 100644 --- a/Util/Xamarin.Build.Download/source/Xamarin.Build.Download/XamarinBuildAndroidAarProguardConfigs.cs +++ b/Util/Xamarin.Build.Download/source/Xamarin.Build.Download/XamarinBuildAndroidAarProguardConfigs.cs @@ -32,7 +32,7 @@ public override bool Execute () if (!Directory.Exists (proguardIntermediateOutputPath)) Directory.CreateDirectory (proguardIntermediateOutputPath); - var additionalFileWrites = new List (); + var additionalFileWrites = new List (); // Make sure our XbdMerge directory exists var outputDir = MergeOutputDir; @@ -62,8 +62,21 @@ public override bool Execute () // We keep a stamp file around to avoid reprocessing, so skip if it exists var stampPath = Path.Combine (outputDir, saveNameHash + ".proguard.stamp"); - if (File.Exists (stampPath)) + // If we have a stamp file, it should contain any proguard config files that + // were previously processed. These need to be emitted still as FileWrites + if (File.Exists (stampPath)) { + // Each line should be a filename + var stampLines = File.ReadAllLines (stampPath); + if (stampLines != null && stampLines.Any ()) { + foreach (var line in stampLines) { + if (File.Exists (line)) // make sure we only add files that exist + additionalFileWrites.Add (line); + } + } + // the stamp file itself is a filewrites file + additionalFileWrites.Add (stampPath); continue; + } // Get all the mapped .aar files var resourceItems = asm.Value; @@ -93,7 +106,7 @@ public override bool Execute () var proguardSaveFilename = Path.Combine (proguardIntermediateOutputPath, saveNameHash + entryCount + ".txt"); // Add this to our file writes - additionalFileWrites.Add (new TaskItem (proguardSaveFilename)); + additionalFileWrites.Add (proguardSaveFilename); // Save out the proguard file using (var entryStream = entry.Open ()) @@ -109,12 +122,11 @@ public override bool Execute () } // *.proguard.stamp files are additional file writes - File.WriteAllText (stampPath, string.Empty); - additionalFileWrites.Add (new TaskItem (stampPath)); - + File.WriteAllText (stampPath, string.Join (Environment.NewLine, additionalFileWrites)); + additionalFileWrites.Add (stampPath); } - AdditionalFileWrites = additionalFileWrites.ToArray (); + AdditionalFileWrites = additionalFileWrites.Select (a => new TaskItem (a)).ToArray (); return true; }