Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ void Extract (
outfs.Write (data, 0, data.Length);
updated = true;
}
jars.Add (outjarFile);
}

// embedded AndroidResourceLibrary archive
Expand All @@ -264,6 +265,8 @@ void Extract (
using (var zip = MonoAndroidHelper.ReadZipFile (finfo.FullName)) {
updated |= Files.ExtractAll (zip, importsDir, modifyCallback: (entryFullName) => {
return entryFullName.Replace ("library_project_imports/", "");
}, deleteCallback: (fileToDelete) => {
return !jars.Contains (fileToDelete);
}, forceUpdate: false);
}

Expand Down Expand Up @@ -292,10 +295,12 @@ void Extract (
stamp.Create ().Close ();
}
}

foreach (var f in outdir.GetFiles ("*.jar")
.Select (fi => fi.FullName))
foreach (var f in outdir.GetFiles ("*.jar", SearchOption.AllDirectories)
.Select (fi => fi.FullName)) {
if (jars.Contains (f))
continue;
jars.Add (f);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Xamarin.ProjectTools;
using NUnit.Framework;
using System.IO;
Expand Down Expand Up @@ -274,6 +274,9 @@ public void BindingCheckHiddenFiles ([Values (true, false)] bool useShortFileNam
binding.Jars.Add (new AndroidItem.LibraryProjectZip ("Jars\\mylibrary.aar") {
WebContent = "https://www.dropbox.com/s/astiqp8jo97x91h/mylibrary.aar?dl=1"
});
binding.Jars.Add (new AndroidItem.EmbeddedJar ("Jars\\svg-android.jar") {
WebContent = "https://www.dropbox.com/s/5ovudccigydohys/javaBindingIssue.jar?dl=1"
});
binding.SetProperty (binding.ActiveConfigurationProperties, "UseShortFileNames", useShortFileNames);
using (var bindingBuilder = CreateDllBuilder (Path.Combine ("temp", "BindingCheckHiddenFiles", "Binding"))) {
bindingBuilder.Verbosity = Microsoft.Build.Framework.LoggerVerbosity.Diagnostic;
Expand Down Expand Up @@ -304,6 +307,8 @@ public void BindingCheckHiddenFiles ([Values (true, false)] bool useShortFileNam
Path.Combine (dsStorePath, ".DS_Store"));
var _macOSStorePath = Path.Combine (dsStorePath, "_MACOSX");
Assert.IsFalse (Directory.Exists (_macOSStorePath), "{0} should NOT exist.", _macOSStorePath);
var svgJar = Path.Combine (dsStorePath, "svg-android.jar");
Assert.IsTrue (File.Exists (svgJar), $"{svgJar} should exist.");
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Utilities/Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public static ZipArchive ReadZipFile (string filename, bool strictConsistencyChe
return ZipArchive.Open (filename, FileMode.Open, strictConsistencyChecks: strictConsistencyChecks);
}

public static bool ExtractAll(ZipArchive zip, string destination, Action<int, int> progressCallback = null, Func<string, string> modifyCallback = null, bool forceUpdate = true)
public static bool ExtractAll(ZipArchive zip, string destination, Action<int, int> progressCallback = null, Func<string, string> modifyCallback = null,
Func<string, bool> deleteCallback = null, bool forceUpdate = true)
{
int i = 0;
int total = (int)zip.EntryCount;
Expand Down Expand Up @@ -235,7 +236,7 @@ public static bool ExtractAll(ZipArchive zip, string destination, Action<int, in
outfile.EndsWith ("/__MACOSX", StringComparison.OrdinalIgnoreCase) ||
outfile.EndsWith ("/.DS_Store", StringComparison.OrdinalIgnoreCase))
continue;
if (!files.Contains (outfile)) {
if (!files.Contains (outfile) && !(deleteCallback?.Invoke (outfile) ?? true)) {
File.Delete (outfile);
updated = true;
}
Expand Down