Skip to content

Exception when trying to build the advanced example project in Windows #129

Closed
dethstryke opened this Issue Aug 28, 2012 · 8 comments

2 participants

@dethstryke

When trying to run cljsbuild once in the advanced example project I get the following exception:

c:\lein-cljsbuild\example-projects\advanced>lein2 cljsbuild once
Compiling ClojureScript.
Exception in thread "main" java.io.FileNotFoundException: Could not locate C:/le
in-cljsbuild/example-projects/advanced/src-clj/example/crossover/macros__init.cl
ass or C:/lein-cljsbuild/example-projects/advanced/src-clj/example/crossover/mac
ros.clj on classpath:
        at clojure.lang.RT.load(RT.java:432)
        at clojure.lang.RT.load(RT.java:400)
        at clojure.core$load$fn__4890.invoke(core.clj:5415)
        at clojure.core$load.doInvoke(core.clj:5414)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at cljsbuild.compiler$reload_clojure.invoke(compiler.clj:89)
        at cljsbuild.compiler$run_compiler.invoke(compiler.clj:109)
        at user$eval1871$iter__1874__1878$fn__1879.invoke(NO_SOURCE_FILE:1)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:60)
        at clojure.lang.RT.seq(RT.java:473)
        at clojure.core$seq.invoke(core.clj:133)
        at clojure.core$dorun.invoke(core.clj:2725)
        at clojure.core$doall.invoke(core.clj:2741)
        at user$eval1871.invoke(NO_SOURCE_FILE:1)
        at clojure.lang.Compiler.eval(Compiler.java:6511)
        at clojure.lang.Compiler.eval(Compiler.java:6501)
        at clojure.lang.Compiler.eval(Compiler.java:6500)
        at clojure.lang.Compiler.eval(Compiler.java:6501)
        at clojure.lang.Compiler.eval(Compiler.java:6477)
        at clojure.core$eval.invoke(core.clj:2797)
        at clojure.main$eval_opt.invoke(main.clj:297)
        at clojure.main$initialize.invoke(main.clj:316)
        at clojure.main$null_opt.invoke(main.clj:349)
        at clojure.main$main.doInvoke(main.clj:427)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:419)
        at clojure.lang.AFn.applyToHelper(AFn.java:163)
        at clojure.lang.Var.applyTo(Var.java:532)
        at clojure.main.main(main.java:37)
Subprocess failed

I can compile the simple project just fine, so it's something with the crossover part. I've verified that the file does exist in the place it's looking. The only thing that immediately comes to mind, is that the path separators are the wrong kind.

I know from previous issues you don't have an easily available windows machine to test with, so if there is anything you want me to try, let me know.

@emezeske
Owner

The crossover macro reloading feature tries to build a list of clj files to watch, and then when they change calls load on them. In this case, it looks like load is being called on the full path, including the C:/, which is bad because load will look for the file on the classpath, not on the filesystem.

It looks like the cljsbuild package (the project in the support/ subdirectory) is doing something weird, most likely in cljsbuild.crossover/crossover-macro-paths. It seems that the :classpath component of one of the maps it builds is ending up with the full C:/ qualification, when it should just start with / and be relative to the classpath. I think that the call to string/replace-first is not doing what it's supposed to: removing the parent part of the path.

@emezeske
Owner

To debug this, I think you'd need to build custom lein-cljsbuild and cljsbuild JARs, and add some println calls to cljsbuild.crossover/crossover-macro-paths, to see what file-path and parent are set to, which should indicate why it's not working as expected.

@emezeske
Owner

Or, maybe this can be debugged by playing around in a REPL with some combination of resource, .getPath, and .getProtocol.

@dethstryke

I threw a println in crossover-macro-paths as you suggested the output shows why it's not working

Compiling ClojureScript.
Filepath:  C:/lein-cljsbuild/example-projects/advanced/src-clj/example/crossover/macros.clj   Classpath:  C:/lein-ljsbuild/example-projects/advanced/src-clj/example/crossover/macros.clj Parent:  /C:/lein-cljsbuild/example-projects/advanced/src-clj/

On windows it's sticking a "/" in front of the drive name. If I remove that, it compiles correctly and runs. I'm not 100% sure where to make the fix to the parent path string, it looks like it's coming from resource.

@emezeske
Owner
emezeske commented Sep 5, 2012

Thanks a bunch for getting this information. I think that I'll be able to make a proper fix based on that.

@emezeske emezeske added a commit that referenced this issue Oct 2, 2012
@emezeske Handle Windows crossover paths correctly.
Hopefully this helps with Issue #129.
d831961
@emezeske
Owner
emezeske commented Oct 2, 2012

Hey, sorry it took so long, but I implemented a tentative fix for this.

Could you try checking out the 0.2.8 branch, and installing that version of the plugin, to see if my changes fix things for you? If you confirm that things work, I'll cut a release. Thanks!

@dethstryke

Just tested it again with the 0.2.8 and it works like a charm! I was able to run the unit tests and everything.

Thank you!

@dethstryke dethstryke closed this Oct 3, 2012
@emezeske
Owner
emezeske commented Oct 3, 2012

Thanks for testing it! I'll get the release out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.