@@ -34,18 +34,22 @@ public class IL2CPU : ToolTask
34
34
35
35
public byte DebugCom { get ; set ; }
36
36
37
+ [ Required ]
38
+ public string TargetAssembly { get ; set ; }
39
+
37
40
[ Required ]
38
41
public ITaskItem [ ] References { get ; set ; }
39
42
43
+ [ Required ]
44
+ public ITaskItem [ ] PlugsReferences { get ; set ; }
45
+
40
46
[ Required ]
41
47
public string OutputFilename { get ; set ; }
42
48
43
49
public bool EnableLogging { get ; set ; }
44
50
45
51
public bool EmitDebugSymbols { get ; set ; }
46
52
47
- public string AssemblySearchDirs { get ; set ; }
48
-
49
53
#endregion
50
54
51
55
protected override string ToolName => "IL2CPU.exe" ;
@@ -55,40 +59,41 @@ public class IL2CPU : ToolTask
55
59
56
60
protected override string GenerateFullPathToTool ( ) => Path . Combine ( CosmosBuildDir , @"IL2CPU\IL2CPU.exe" ) ;
57
61
58
- protected override string GenerateCommandLineCommands ( )
62
+ protected override string GenerateResponseFileCommands ( )
59
63
{
60
- Dictionary < string , string > args = new Dictionary < string , string >
64
+ var args = new Dictionary < string , string >
65
+ {
66
+ [ "KernelPkg" ] = KernelPkg ,
67
+ [ "EnableDebug" ] = DebugEnabled . ToString ( ) ,
68
+ [ "EnableStackCorruptionDetection" ] = StackCorruptionDetectionEnabled . ToString ( ) ,
69
+ [ "StackCorruptionDetectionLevel" ] = StackCorruptionDetectionLevel ,
70
+ [ "DebugMode" ] = DebugMode ,
71
+ [ "TraceAssemblies" ] = TraceAssemblies ,
72
+ [ "DebugCom" ] = DebugCom . ToString ( ) ,
73
+ [ "TargetAssembly" ] = Path . GetFullPath ( TargetAssembly ) ,
74
+ [ "OutputFilename" ] = Path . GetFullPath ( OutputFilename ) ,
75
+ [ "EnableLogging" ] = EnableLogging . ToString ( ) ,
76
+ [ "EmitDebugSymbols" ] = EmitDebugSymbols . ToString ( ) ,
77
+ [ "IgnoreDebugStubAttribute" ] = IgnoreDebugStubAttribute . ToString ( ) ,
78
+ } . ToList ( ) ;
79
+
80
+ foreach ( var reference in References )
61
81
{
62
- { "KernelPkg" , KernelPkg } ,
63
- { "EnableDebug" , DebugEnabled . ToString ( ) } ,
64
- { "EnableStackCorruptionDetection" , StackCorruptionDetectionEnabled . ToString ( ) } ,
65
- { "StackCorruptionDetectionLevel" , StackCorruptionDetectionLevel } ,
66
- { "DebugMode" , DebugMode } ,
67
- { "TraceAssemblies" , TraceAssemblies } ,
68
- { "DebugCom" , DebugCom . ToString ( ) } ,
69
- { "OutputFilename" , Path . GetFullPath ( OutputFilename ) } ,
70
- { "EnableLogging" , EnableLogging . ToString ( ) } ,
71
- { "EmitDebugSymbols" , EmitDebugSymbols . ToString ( ) } ,
72
- { "IgnoreDebugStubAttribute" , IgnoreDebugStubAttribute . ToString ( ) }
73
- } ;
74
-
75
- List < string > refs =
76
- ( from reference in References
77
- where reference . MetadataNames . OfType < string > ( ) . Contains ( "FullPath" )
78
- select reference . GetMetadata ( "FullPath" )
79
- into xFile
80
- select Convert . ToString ( xFile ) ) . ToList ( ) ;
81
-
82
- string Arguments = args . Aggregate ( "" , ( current , arg ) => current + "\" " + arg . Key + ":" + arg . Value + "\" " ) ;
83
- Arguments = refs . Aggregate ( Arguments , ( current , Ref ) => current + "\" References:" + Ref + "\" " ) ;
84
- Arguments = AssemblySearchDirs . Split ( ';' ) . Aggregate ( Arguments , ( current , Dir ) => current + "\" AssemblySearchDirs:" + Dir + "\" " ) ;
85
-
86
- // replace \" by \\"
87
- Arguments = Arguments . Replace ( "\\ \" " , "\\ \\ \" " ) ;
88
-
89
- Log . LogMessage ( MessageImportance . High , $ "Invoking IL2CPU.exe { Arguments } ") ;
90
-
91
- return Arguments ;
82
+ args . Add ( new KeyValuePair < string , string > ( "References" , reference . ItemSpec ) ) ;
83
+ }
84
+
85
+ foreach ( var plugsReference in PlugsReferences )
86
+ {
87
+ args . Add ( new KeyValuePair < string , string > ( "PlugsReferences" , plugsReference . ItemSpec ) ) ;
88
+ }
89
+
90
+ return String . Join ( Environment . NewLine , args . Select ( a => $ "{ a . Key } :{ a . Value } ") ) ;
91
+ }
92
+
93
+ protected override string GetResponseFileSwitch ( string responseFilePath )
94
+ {
95
+ File . Copy ( responseFilePath , @"c:\users\jpedr\Desktop\response.rsp" , true ) ;
96
+ return $ "ResponseFile:{ responseFilePath } ";
92
97
}
93
98
}
94
99
}
0 commit comments