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
6 changes: 6 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Tasks/JavaCompileToolTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ public override bool Execute ()
return retval;
}

protected virtual void WriteOptionsToResponseFile (StreamWriter sw)
{
}

private void GenerateResponseFile ()
{
TemporarySourceListFile = Path.GetTempFileName ();

using (var sw = new StreamWriter (path:TemporarySourceListFile, append:false,
encoding:new UTF8Encoding (encoderShouldEmitUTF8Identifier:false))) {

WriteOptionsToResponseFile (sw);
// Include any user .java files
if (JavaSourceFiles != null)
foreach (var file in JavaSourceFiles.Where (p => Path.GetExtension (p.ItemSpec) == ".java"))
Expand Down
14 changes: 9 additions & 5 deletions src/Xamarin.Android.Build.Tasks/Tasks/Javac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Collections.Generic;
using Xamarin.Tools.Zip;
using Xamarin.Android.Tools;

namespace Xamarin.Android.Tasks
{
Expand Down Expand Up @@ -57,16 +58,19 @@ protected override string GenerateCommandLineCommands ()

cmd.AppendSwitchIfNotNull ("-J-Dfile.encoding=", "UTF8");

cmd.AppendSwitchIfNotNull ("-d ", ClassesOutputDirectory);

cmd.AppendSwitchIfNotNull ("-classpath ", Jars == null || !Jars.Any () ? null : string.Join (Path.PathSeparator.ToString (), Jars.Select (i => i.ItemSpec)));
cmd.AppendSwitchIfNotNull ("-bootclasspath ", JavaPlatformJarPath);
cmd.AppendSwitchIfNotNull ("-encoding ", "UTF-8");
cmd.AppendFileNameIfNotNull (string.Format ("@{0}", TemporarySourceListFile));
cmd.AppendSwitchIfNotNull ("-target ", JavacTargetVersion);
cmd.AppendSwitchIfNotNull ("-source ", JavacSourceVersion);

return cmd.ToString ();
}

protected override void WriteOptionsToResponseFile (StreamWriter sw)
{
sw.WriteLine ($"-d \"{ClassesOutputDirectory.Replace (@"\", @"\\")}\"");
sw.WriteLine ("-classpath \"{0}\"", Jars == null || !Jars.Any () ? null : string.Join (Path.PathSeparator.ToString (), Jars.Select (i => i.ItemSpec.Replace (@"\", @"\\"))));
sw.WriteLine ("-bootclasspath \"{0}\"", JavaPlatformJarPath.Replace (@"\", @"\\"));
sw.WriteLine ($"-encoding UTF8");
}
}
}