public void save ( ) throws IOException { if ( ! needsSaving ) return ; try ( FileWriter out = new FileWriter ( javacStateFilename ) ) { StringBuilder b = new StringBuilder ( ) ; long millisNow = System . currentTimeMillis ( ) ; Date d = new Date ( millisNow ) ; SimpleDateFormat df = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss SSS" ) ; b . append ( "# javac_state ver 0.3 generated " + millisNow + " " + df . format ( d ) + "\n" ) ; b . append ( "# This format might change at any time. Please do not depend on it.\n" ) ; b . append ( "# M module\n" ) ; b . append ( "# P package\n" ) ; b . append ( "# S C source_tobe_compiled timestamp\n" ) ; b . append ( "# S L link_only_source timestamp\n" ) ; b . append ( "# G C generated_source timestamp\n" ) ; b . append ( "# A artifact timestamp\n" ) ; b . append ( "# D dependency\n" ) ; b . append ( "# I pubapi\n" ) ; b . append ( "# R arguments\n" ) ; b . append ( "R " ) . append ( theArgs ) . append ( "\n" ) ; // Copy over the javac_state for the packages that did not need recompilation. now . copyPackagesExcept ( prev , recompiledPackages , new HashSet < String > ( ) ) ; // Save the packages, ie package names, dependencies, pubapis and artifacts! // I.e. the lot. Module . saveModules ( now . modules ( ) , b ) ; String s = b . toString ( ) ; out . write ( s , 0 , s . length ( ) ) ; } }
Save the javac_state file .