@@ -48,13 +48,15 @@ public void Parse(string fileName)
48
48
}
49
49
}
50
50
51
- public void Compile ( string fileName )
51
+ public void Compile (
52
+ string fileName ,
53
+ bool isCoreLibrary )
52
54
{
53
55
try
54
56
{
55
57
if ( Verbose ) System . Console . WriteLine ( "Compiling assembly..." ) ;
56
58
57
- _assemblyBuilder = new nanoAssemblyBuilder ( _assemblyDefinition , _classNamesToExclude , Minimize , Verbose ) ;
59
+ _assemblyBuilder = new nanoAssemblyBuilder ( _assemblyDefinition , _classNamesToExclude , Minimize , Verbose , isCoreLibrary ) ;
58
60
59
61
using ( var stream = File . Open ( fileName , FileMode . Create , FileAccess . ReadWrite ) )
60
62
using ( var writer = new BinaryWriter ( stream ) )
@@ -180,7 +182,7 @@ public static void Main(string[] args)
180
182
{
181
183
System . Console . WriteLine ( "" ) ;
182
184
System . Console . WriteLine ( "-parse <path-to-assembly-file> Analyses .NET assembly." ) ;
183
- System . Console . WriteLine ( "-compile <path-to-PE-file> Compiles an assembly into nanoCLR format." ) ;
185
+ System . Console . WriteLine ( "-compile <path-to-PE-file> Compiles an assembly into nanoCLR format. Optionally flags if this it's a core library. " ) ;
184
186
System . Console . WriteLine ( "-loadHints <assembly-name> <path-to-assembly-file> Loads one (or more) assembly file(s) as a dependency(ies)." ) ;
185
187
System . Console . WriteLine ( "-excludeClassByName <class-name> Removes the class from an assembly." ) ;
186
188
System . Console . WriteLine ( "-generateskeleton Generate skeleton files with stubs to add native code for an assembly." ) ;
@@ -193,9 +195,18 @@ public static void Main(string[] args)
193
195
{
194
196
md . Parse ( args [ ++ i ] ) ;
195
197
}
196
- else if ( arg == "-compile" && i + 1 < args . Length )
198
+ else if ( arg == "-compile" && i + 2 < args . Length )
197
199
{
198
- md . Compile ( args [ ++ i ] ) ;
200
+ bool isCoreLibrary = false ;
201
+
202
+ if ( ! bool . TryParse ( args [ i + 2 ] , out isCoreLibrary ) )
203
+ {
204
+ System . Console . Error . WriteLine ( "Bad parameter for compile. IsCoreLib options has to be 'true' or 'false'." ) ;
205
+
206
+ Environment . Exit ( 1 ) ;
207
+ }
208
+
209
+ md . Compile ( args [ i + 1 ] , isCoreLibrary ) ;
199
210
}
200
211
else if ( arg == "-excludeclassbyname" && i + 1 < args . Length )
201
212
{
0 commit comments