private void createSourceMapFile ( File output , SourceMap sourceMap ) throws WatchingException { if ( googleClosureMap ) { PrintWriter mapWriter = null ; File mapFile = new File ( output . getPath ( ) + ".map" ) ; FileUtils . deleteQuietly ( mapFile ) ; try { mapWriter = new PrintWriter ( mapFile , Charset . defaultCharset ( ) . name ( ) ) ; sourceMap . appendTo ( mapWriter , output . getName ( ) ) ; FileUtils . write ( output , "\n//# sourceMappingURL=" + mapFile . getName ( ) , true ) ; } catch ( IOException e ) { throw new WatchingException ( "Cannot create source map file for JavaScript file '" + output . getAbsolutePath ( ) + "'" , e ) ; } finally { IOUtils . closeQuietly ( mapWriter ) ; } } }
Create a source map file corresponding to the given compiled js file .