@@ -48,13 +48,15 @@ public void Parse(string fileName)
4848 }
4949 }
5050
51- public void Compile ( string fileName )
51+ public void Compile (
52+ string fileName ,
53+ bool isCoreLibrary )
5254 {
5355 try
5456 {
5557 if ( Verbose ) System . Console . WriteLine ( "Compiling assembly..." ) ;
5658
57- _assemblyBuilder = new nanoAssemblyBuilder ( _assemblyDefinition , _classNamesToExclude , Minimize , Verbose ) ;
59+ _assemblyBuilder = new nanoAssemblyBuilder ( _assemblyDefinition , _classNamesToExclude , Minimize , Verbose , isCoreLibrary ) ;
5860
5961 using ( var stream = File . Open ( fileName , FileMode . Create , FileAccess . ReadWrite ) )
6062 using ( var writer = new BinaryWriter ( stream ) )
@@ -180,7 +182,7 @@ public static void Main(string[] args)
180182 {
181183 System . Console . WriteLine ( "" ) ;
182184 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. " ) ;
184186 System . Console . WriteLine ( "-loadHints <assembly-name> <path-to-assembly-file> Loads one (or more) assembly file(s) as a dependency(ies)." ) ;
185187 System . Console . WriteLine ( "-excludeClassByName <class-name> Removes the class from an assembly." ) ;
186188 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)
193195 {
194196 md . Parse ( args [ ++ i ] ) ;
195197 }
196- else if ( arg == "-compile" && i + 1 < args . Length )
198+ else if ( arg == "-compile" && i + 2 < args . Length )
197199 {
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 ) ;
199210 }
200211 else if ( arg == "-excludeclassbyname" && i + 1 < args . Length )
201212 {
0 commit comments