From c812403e0a47af77adde83100f7f43a5430820c5 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 29 Jun 2016 16:11:18 +0100 Subject: [PATCH] Fix an issue where all the assemblies are added with the name assembies. In the commit f3d62b6 which switches over to using libzip there was an oversight. The new API needs the filename in the archive not just the directory (like IonicZip did). As a result the code was making ALL the assemblies have the same name. This commit fixes that issue by appending the filename to the "assemblies" path. It also fixes an issue with the typemap files not being added to the root of the apk. --- src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs index 3a9a2311718..4a1b2dcd60e 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs @@ -127,7 +127,7 @@ void ExecuteWithAbi (string supportedAbis, string apkInputPath, string apkOutput AddNativeLibrariesFromAssemblies (apk, supportedAbis); foreach (ITaskItem typemap in TypeMappings) { - apk.AddFile (typemap.ItemSpec, compressionMethod: CompressionMethod.Store); + apk.AddFile (typemap.ItemSpec, Path.GetFileName(typemap.ItemSpec), compressionMethod: CompressionMethod.Store); } foreach (var file in files) { @@ -249,7 +249,7 @@ private void AddAssemblies (ZipArchive apk) foreach (ITaskItem assembly in ResolvedUserAssemblies) { // Add assembly - apk.AddFile (assembly.ItemSpec, GetTargetDirectory (assembly.ItemSpec), compressionMethod: CompressionMethod.Store); + apk.AddFile (assembly.ItemSpec, GetTargetDirectory (assembly.ItemSpec) + "/" + Path.GetFileName (assembly.ItemSpec), compressionMethod: CompressionMethod.Store); // Try to add config if exists var config = Path.ChangeExtension (assembly.ItemSpec, "dll.config"); @@ -260,7 +260,7 @@ private void AddAssemblies (ZipArchive apk) var symbols = Path.ChangeExtension (assembly.ItemSpec, "dll.mdb"); if (File.Exists (symbols)) - apk.AddFile (symbols, "assemblies", compressionMethod: CompressionMethod.Store); + apk.AddFile (symbols, "assemblies/" + Path.GetFileName (symbols), compressionMethod: CompressionMethod.Store); } } @@ -269,7 +269,7 @@ private void AddAssemblies (ZipArchive apk) // Add framework assemblies foreach (ITaskItem assembly in ResolvedFrameworkAssemblies) { - apk.AddFile (assembly.ItemSpec, "assemblies", compressionMethod: CompressionMethod.Store); + apk.AddFile (assembly.ItemSpec, "assemblies/" + Path.GetFileName (assembly.ItemSpec), compressionMethod: CompressionMethod.Store); var config = Path.ChangeExtension (assembly.ItemSpec, "dll.config"); AddAssemblyConfigEntry (apk, config); // Try to add symbols if Debug @@ -277,7 +277,7 @@ private void AddAssemblies (ZipArchive apk) var symbols = Path.ChangeExtension (assembly.ItemSpec, "dll.mdb"); if (File.Exists (symbols)) - apk.AddFile (symbols, "assemblies", compressionMethod: CompressionMethod.Store); + apk.AddFile (symbols, "assemblies/" + Path.GetFileName (symbols), compressionMethod: CompressionMethod.Store); } } }