11
11
12
12
package ilg .gnuarmeclipse .managedbuild .cross ;
13
13
14
+ import org .eclipse .cdt .core .cdtvariables .CdtVariableException ;
14
15
import org .eclipse .cdt .managedbuilder .core .BuildException ;
15
16
import org .eclipse .cdt .managedbuilder .core .IOption ;
16
17
import org .eclipse .cdt .managedbuilder .core .IOptionCommandGenerator ;
17
18
import org .eclipse .cdt .managedbuilder .makegen .gnu .GnuMakefileGenerator ;
19
+ import org .eclipse .cdt .utils .cdtvariables .CdtVariableResolver ;
18
20
import org .eclipse .cdt .utils .cdtvariables .IVariableSubstitutor ;
19
21
20
22
public class LikerScriptCommandGenerator implements IOptionCommandGenerator {
@@ -23,17 +25,20 @@ public class LikerScriptCommandGenerator implements IOptionCommandGenerator {
23
25
public String generateCommand (IOption option ,
24
26
IVariableSubstitutor macroSubstitutor ) {
25
27
26
- String command = null ;
28
+ StringBuffer command = new StringBuffer () ;
27
29
try {
28
30
int valueType = option .getValueType ();
29
31
30
32
if (valueType == IOption .STRING ) {
31
33
// for compatibility with projects created with previous
32
34
// versions, keep accepting single strings
33
- command = "-T "
34
- + GnuMakefileGenerator
35
- .escapeWhitespaces (GnuMakefileGenerator
36
- .ensureUnquoted (option .getStringValue ()));
35
+
36
+ String value = option .getStringValue ();
37
+ value = CdtVariableResolver .resolveToString (value ,
38
+ macroSubstitutor );
39
+
40
+ command .append ("-T " );
41
+ command .append (Utils .escapeWhitespaces (value ));
37
42
} else if (valueType == IOption .STRING_LIST ) {
38
43
for (String value : option .getStringListValue ()) {
39
44
@@ -42,25 +47,24 @@ public String generateCommand(IOption option,
42
47
}
43
48
44
49
if (value .length () > 0 ) {
45
- if (command == null )
46
- command = "" ;
47
50
48
- command += "-T "
49
- + GnuMakefileGenerator
50
- .escapeWhitespaces (GnuMakefileGenerator
51
- .ensureUnquoted (value )) + " " ;
51
+ value = CdtVariableResolver .resolveToString (value ,
52
+ macroSubstitutor );
53
+ command .append ("-T " );
54
+ command .append (Utils .escapeWhitespaces (value ));
55
+ command .append (" " );
52
56
}
53
57
}
54
- }
58
+ }
55
59
} catch (BuildException e ) {
56
60
// TODO Auto-generated catch block
57
61
e .printStackTrace ();
62
+ } catch (CdtVariableException e ) {
63
+ // TODO Auto-generated catch block
64
+ e .printStackTrace ();
58
65
}
59
-
60
- if (command != null )
61
- command = command .trim ();
62
-
63
- return command ;
66
+
67
+ return command .toString ().trim ();
64
68
}
65
69
66
70
}
0 commit comments