create_source_map don't work

162 views
Skip to first unread message

Sergiy

unread,
Nov 26, 2009, 1:46:41 PM11/26/09
to Closure Compiler Discuss
Hello,

I'm trying to compile custom .js file against closure library and
generate source map for it. Seems that advanced compilation breaks
something in my code and in order to debug compiled file I decided to
try source map.
However, when I run following command, I keep receiving weird
exception from compiler.

Closure-Library\closure\bin\calcdeps.py -i my.src.js -p Closure-
Library -o compiled -c c:\temp\Google\closure-compiler\build
\compiler.jar -f --create_source_map=./my.map -f --
compilation_level=ADVANCED_OPTIMIZATIONS -f --js_output_file=my.js

I have latest closure library (r9) and compiled from sources closure-
compiler (had same error for pre-built ones)

The exception I get is following:
java.io.FileNotFoundException: null\.\reed.spellchecker.map (The
system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at
com.google.javascript.jscomp.AbstractCompilerRunner.openSourceMapStream
(Unknown Source)
at
com.google.javascript.jscomp.AbstractCompilerRunner.outputSourceMap
(Unknown Source)
at com.google.javascript.jscomp.AbstractCompilerRunner.doRun
(Unknown Source)
at com.google.javascript.jscomp.AbstractCompilerRunner.run
(Unknown Source)
at com.google.javascript.jscomp.CompilerRunner.main(Unknown
Source)
calcdeps.py: JavaScript compilation failed.


If I remove "-f --create_source_map=./my.map" compilation succeeds

Joseph Schorr (יוסף שור)

unread,
Nov 26, 2009, 4:26:43 PM11/26/09
to closure-comp...@googlegroups.com
I'll look into this on Monday.

Thanks,
Joseph Schorr

Sergiy

unread,
Nov 27, 2009, 4:32:58 AM11/27/09
to Closure Compiler Discuss
I've found out what was the matter: in AbstractCompilerRunner:

Line 743:
if (sourceMapPath.contains(File.separator)) {
mapPath = sourceMapPath;
} else {
File outputFile = new File(path);
mapPath = outputFile.getParent() + File.separatorChar +
sourceMapPath;
}

Therefore, if sourceMapPath does not contain File.separator which is '\
\' for windows and does not have a module definition we'd have
mentioned exception.

So in my case changing "-f --create_source_map=./my.map" to "-f --
create_source_map=.\\my.map" fixed the problem. IMHO this should be
mentioned in tutorial because provided example command line won't work
in Windows.

Best Regards,
Sergiy


On Nov 26, 9:26 pm, Joseph Schorr (יוסף שור) <jsch...@google.com>
wrote:

Joseph Schorr (יוסף שור)

unread,
Nov 27, 2009, 11:42:58 AM11/27/09
to closure-comp...@googlegroups.com
Yep, I figured that was the problem. Thanks for confirming for me :-)

I'll submit a change on Monday, as I said.

Thanks,
Joseph Schorr
Reply all
Reply to author
Forward
0 new messages