public static void run ( List < String > fileArgs , Options options ) { File preProcessorTempDir = null ; File strippedSourcesDir = null ; Parser parser = null ; try { List < ProcessingContext > inputs = Lists . newArrayList ( ) ; GenerationBatch batch = new GenerationBatch ( options ) ; batch . processFileArgs ( fileArgs ) ; inputs . addAll ( batch . getInputs ( ) ) ; if ( ErrorUtil . errorCount ( ) > 0 ) { return ; } parser = createParser ( options ) ; Parser . ProcessingResult processingResult = parser . processAnnotations ( fileArgs , inputs ) ; List < ProcessingContext > generatedInputs = processingResult . getGeneratedSources ( ) ; inputs . addAll ( generatedInputs ) ; // Ensure all generatedInputs are at end of input list. preProcessorTempDir = processingResult . getSourceOutputDirectory ( ) ; if ( ErrorUtil . errorCount ( ) > 0 ) { return ; } if ( preProcessorTempDir != null ) { parser . addSourcepathEntry ( preProcessorTempDir . getAbsolutePath ( ) ) ; } InputFilePreprocessor inputFilePreprocessor = new InputFilePreprocessor ( parser ) ; inputFilePreprocessor . processInputs ( inputs ) ; if ( ErrorUtil . errorCount ( ) > 0 ) { return ; } strippedSourcesDir = inputFilePreprocessor . getStrippedSourcesDir ( ) ; if ( strippedSourcesDir != null ) { parser . prependSourcepathEntry ( strippedSourcesDir . getPath ( ) ) ; } options . getHeaderMap ( ) . loadMappings ( ) ; TranslationProcessor translationProcessor = new TranslationProcessor ( parser , loadDeadCodeMap ( ) ) ; translationProcessor . processInputs ( inputs ) ; if ( ErrorUtil . errorCount ( ) > 0 ) { return ; } translationProcessor . postProcess ( ) ; options . getHeaderMap ( ) . printMappings ( ) ; } finally { if ( parser != null ) { try { parser . close ( ) ; } catch ( IOException e ) { ErrorUtil . error ( e . getMessage ( ) ) ; } } Set < String > tempDirs = options . fileUtil ( ) . getTempDirs ( ) ; for ( String dir : tempDirs ) { FileUtil . deleteTempDir ( new File ( dir ) ) ; } FileUtil . deleteTempDir ( preProcessorTempDir ) ; FileUtil . deleteTempDir ( strippedSourcesDir ) ; } }
Runs the entire J2ObjC pipeline .