Skip to content

Commit

Permalink
[XABT] Use a response file for D8 task.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst committed Nov 22, 2024
1 parent 78f8863 commit ba9a1aa
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/Xamarin.Android.Build.Tasks/Tasks/D8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using Xamarin.Android.Tools;
using Microsoft.Android.Build.Tasks;
using System.Text;

namespace Xamarin.Android.Tasks
{
Expand Down Expand Up @@ -43,10 +44,27 @@ public class D8 : JavaToolTask
public string ExtraArguments { get; set; }

protected override string GenerateCommandLineCommands ()
{
var cmd = new CommandLineBuilder ();

if (!string.IsNullOrEmpty (JavaOptions)) {
cmd.AppendSwitch (JavaOptions);
}

cmd.AppendSwitchIfNotNull ("-Xmx", JavaMaximumHeapSize);
cmd.AppendSwitchIfNotNull ("-classpath ", JarPath);
cmd.AppendSwitch (MainClass);

return cmd.ToString ();
}

protected override string GenerateResponseFileCommands ()
{
return GetCommandLineBuilder ().ToString ();
}

protected override Encoding ResponseFileEncoding => Encoding.UTF8;

protected virtual string MainClass => "com.android.tools.r8.D8";

protected int MinSdkVersion { get; set; }
Expand All @@ -55,13 +73,6 @@ protected virtual CommandLineBuilder GetCommandLineBuilder ()
{
var cmd = new CommandLineBuilder ();

if (!string.IsNullOrEmpty (JavaOptions)) {
cmd.AppendSwitch (JavaOptions);
}
cmd.AppendSwitchIfNotNull ("-Xmx", JavaMaximumHeapSize);
cmd.AppendSwitchIfNotNull ("-classpath ", JarPath);
cmd.AppendSwitch (MainClass);

if (!string.IsNullOrEmpty (ExtraArguments))
cmd.AppendSwitch (ExtraArguments); // it should contain "--dex".
if (Debug)
Expand Down

0 comments on commit ba9a1aa

Please sign in to comment.