4
4
using System . IO ;
5
5
using Xamarin . Android . Tools ;
6
6
using Microsoft . Android . Build . Tasks ;
7
+ using System . Text ;
7
8
8
9
namespace Xamarin . Android . Tasks
9
10
{
@@ -43,10 +44,27 @@ public class D8 : JavaToolTask
43
44
public string ExtraArguments { get ; set ; }
44
45
45
46
protected override string GenerateCommandLineCommands ( )
47
+ {
48
+ var cmd = new CommandLineBuilder ( ) ;
49
+
50
+ if ( ! string . IsNullOrEmpty ( JavaOptions ) ) {
51
+ cmd . AppendSwitch ( JavaOptions ) ;
52
+ }
53
+
54
+ cmd . AppendSwitchIfNotNull ( "-Xmx" , JavaMaximumHeapSize ) ;
55
+ cmd . AppendSwitchIfNotNull ( "-classpath " , JarPath ) ;
56
+ cmd . AppendSwitch ( MainClass ) ;
57
+
58
+ return cmd . ToString ( ) ;
59
+ }
60
+
61
+ protected override string GenerateResponseFileCommands ( )
46
62
{
47
63
return GetCommandLineBuilder ( ) . ToString ( ) ;
48
64
}
49
65
66
+ protected override Encoding ResponseFileEncoding => Encoding . UTF8 ;
67
+
50
68
protected virtual string MainClass => "com.android.tools.r8.D8" ;
51
69
52
70
protected int MinSdkVersion { get ; set ; }
@@ -55,13 +73,6 @@ protected virtual CommandLineBuilder GetCommandLineBuilder ()
55
73
{
56
74
var cmd = new CommandLineBuilder ( ) ;
57
75
58
- if ( ! string . IsNullOrEmpty ( JavaOptions ) ) {
59
- cmd . AppendSwitch ( JavaOptions ) ;
60
- }
61
- cmd . AppendSwitchIfNotNull ( "-Xmx" , JavaMaximumHeapSize ) ;
62
- cmd . AppendSwitchIfNotNull ( "-classpath " , JarPath ) ;
63
- cmd . AppendSwitch ( MainClass ) ;
64
-
65
76
if ( ! string . IsNullOrEmpty ( ExtraArguments ) )
66
77
cmd . AppendSwitch ( ExtraArguments ) ; // it should contain "--dex".
67
78
if ( Debug )
0 commit comments