29
29
import java .nio .file .Paths ;
30
30
import java .util .ArrayList ;
31
31
import java .util .Arrays ;
32
+ import java .util .HashMap ;
32
33
import java .util .HashSet ;
33
34
import java .util .Iterator ;
34
35
import java .util .List ;
@@ -140,6 +141,7 @@ private Map<String, String> getCompilerArguments(CompilerConfiguration config) {
140
141
}
141
142
142
143
compilerArguments = config .getCustomCompilerArgumentsAsMap ();
144
+ Map <String , String > ca2 = new HashMap <String , String >();
143
145
144
146
Iterator <String > i = compilerArguments .keySet ().iterator ();
145
147
@@ -151,12 +153,15 @@ private Map<String, String> getCompilerArguments(CompilerConfiguration config) {
151
153
i .remove ();
152
154
String k = arr [0 ];
153
155
v = arr [1 ];
154
- compilerArguments .put (k , v );
156
+ // compilerArguments.put(k, v);
157
+ ca2 .put (k , v );
155
158
if (config .isDebug ()) {
156
- System .out .println ("transforming argument from " + orig + " to " + k + " = [" + v + "]" );
159
+ System .out .println (
160
+ "internal splitting of argument '" + orig + "' to key '" + k + "', value '" + v + "'" );
157
161
}
158
162
}
159
163
}
164
+ compilerArguments .putAll (ca2 );
160
165
161
166
config .setCustomCompilerArgumentsAsMap (compilerArguments );
162
167
@@ -389,11 +394,12 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
389
394
throws CompilerException {
390
395
List <String > args = new ArrayList <>();
391
396
392
- if (config .isDebug ()) {
393
- args .add ("/debug+" );
394
- } else {
395
- args .add ("/debug-" );
396
- }
397
+ // plugin parameter is no the same as the compiler option! so replaced
398
+ // if (config.isDebug()) {
399
+ // args.add("/debug+");
400
+ // } else {
401
+ // args.add("/debug-");
402
+ // }
397
403
398
404
// config.isShowWarnings()
399
405
// config.getSourceVersion()
@@ -433,12 +439,14 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
433
439
}
434
440
}
435
441
442
+ // TODO: include all user compiler arguments and not only some!
443
+
444
+ Map <String , String > compilerArguments = getCompilerArguments (config );
445
+
436
446
// ----------------------------------------------------------------------
437
447
// Main class
438
448
// ----------------------------------------------------------------------
439
449
440
- Map <String , String > compilerArguments = getCompilerArguments (config );
441
-
442
450
String mainClass = compilerArguments .get ("-main" );
443
451
444
452
if (!StringUtils .isEmpty (mainClass )) {
@@ -457,7 +465,17 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
457
465
}
458
466
459
467
// ----------------------------------------------------------------------
460
- // Nowarn option
468
+ // Debug option (full, pdbonly...)
469
+ // ----------------------------------------------------------------------
470
+
471
+ String debug = compilerArguments .get ("-debug" );
472
+
473
+ if (!StringUtils .isEmpty (debug )) {
474
+ args .add ("/debug:" + debug );
475
+ }
476
+
477
+ // ----------------------------------------------------------------------
478
+ // Nowarn option (w#1,w#2...)
461
479
// ----------------------------------------------------------------------
462
480
463
481
String nowarn = compilerArguments .get ("-nowarn" );
@@ -489,7 +507,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
489
507
}
490
508
491
509
// ----------------------------------------------------------------------
492
- // Target - type of assembly to produce, lib ,exe,winexe etc ...
510
+ // Target - type of assembly to produce: library ,exe,winexe...
493
511
// ----------------------------------------------------------------------
494
512
495
513
String target = compilerArguments .get ("-target" );
@@ -505,7 +523,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
505
523
// ----------------------------------------------------------------------
506
524
String nologo = compilerArguments .get ("-nologo" );
507
525
508
- if (!StringUtils .isEmpty (nologo )) {
526
+ if (!StringUtils .isEmpty (nologo ) && ! "false" . equals ( nologo . toLowerCase ()) ) {
509
527
args .add ("/nologo" );
510
528
}
511
529
@@ -514,7 +532,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
514
532
// ----------------------------------------------------------------------
515
533
String unsafe = compilerArguments .get ("-unsafe" );
516
534
517
- if (!StringUtils .isEmpty (unsafe ) && unsafe . equals ( "true" )) {
535
+ if (!StringUtils .isEmpty (unsafe ) && "true" . equals ( unsafe . toLowerCase () )) {
518
536
args .add ("/unsafe" );
519
537
}
520
538
@@ -532,8 +550,8 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
532
550
// ----------------------------------------------------------------------
533
551
String utf8output = compilerArguments .get ("-utf8output" );
534
552
535
- if (!StringUtils .isEmpty (utf8output )) {
536
- args .add ("/utf8output: " );
553
+ if (!StringUtils .isEmpty (utf8output ) && ! "false" . equals ( utf8output ) ) {
554
+ args .add ("/utf8output" );
537
555
}
538
556
539
557
// ----------------------------------------------------------------------
@@ -548,6 +566,10 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
548
566
args .add (sourceFile );
549
567
}
550
568
569
+ if (config .isDebug ()) {
570
+ System .out .println ("built compiler arguments:" + args );
571
+ }
572
+
551
573
return args .toArray (new String [args .size ()]);
552
574
}
553
575
0 commit comments