diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs b/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs index e2e5b9349b1..8fe2579fac3 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/D8.cs @@ -4,6 +4,7 @@ using System.IO; using Xamarin.Android.Tools; using Microsoft.Android.Build.Tasks; +using System.Text; namespace Xamarin.Android.Tasks { @@ -47,6 +48,44 @@ protected override string GenerateCommandLineCommands () return GetCommandLineBuilder ().ToString (); } + protected override string GenerateResponseFileCommands () + { + var cmd = new CommandLineBuilder (); + + var injars = new List (); + var libjars = new List (); + if (AlternativeJarLibrariesToEmbed?.Length > 0) { + Log.LogDebugMessage (" processing AlternativeJarLibrariesToEmbed..."); + foreach (var jar in AlternativeJarLibrariesToEmbed) { + injars.Add (jar.ItemSpec); + } + } else if (JavaLibrariesToEmbed != null) { + Log.LogDebugMessage (" processing ClassesZip, JavaLibrariesToEmbed..."); + if (!string.IsNullOrEmpty (ClassesZip) && File.Exists (ClassesZip)) { + injars.Add (ClassesZip); + } + foreach (var jar in JavaLibrariesToEmbed) { + injars.Add (jar.ItemSpec); + } + } + libjars.Add (JavaPlatformJarPath); + if (JavaLibrariesToReference != null) { + foreach (var jar in JavaLibrariesToReference) { + libjars.Add (jar.ItemSpec); + } + } + + //foreach (var jar in libjars) + // cmd.AppendSwitchIfNotNull ("--lib ", jar); + + foreach (var jar in injars) + cmd.AppendFileNameIfNotNull (jar); + + return cmd.ToString (); + } + + protected override Encoding ResponseFileEncoding => Encoding.UTF8; + protected virtual string MainClass => "com.android.tools.r8.D8"; protected int MinSdkVersion { get; set; } @@ -81,6 +120,8 @@ protected virtual CommandLineBuilder GetCommandLineBuilder () if (!EnableDesugar) cmd.AppendSwitch ("--no-desugaring"); + cmd.AppendSwitchIfNotNull ("--output ", OutputDirectory); + var injars = new List (); var libjars = new List (); if (AlternativeJarLibrariesToEmbed?.Length > 0) { @@ -104,11 +145,12 @@ protected virtual CommandLineBuilder GetCommandLineBuilder () } } - cmd.AppendSwitchIfNotNull ("--output ", OutputDirectory); foreach (var jar in libjars) cmd.AppendSwitchIfNotNull ("--lib ", jar); - foreach (var jar in injars) - cmd.AppendFileNameIfNotNull (jar); + + //foreach (var jar in injars) + // cmd.AppendFileNameIfNotNull (jar); + if (MapDiagnostics != null) { foreach (var diagnostic in MapDiagnostics) {