Repository navigation
sbt-js creating recursive directory structure #32
Description
Activity
Thanks for this - I'll check it out.
It may take a while - I have lots going on at the moment. Happy to accept a
PR if you get the itch to tinker with the code.Dave
On 13 July 2013 20:39, Guillaume Massé notifications@github.com wrote:
with this setting
(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in
Compile)(_ / "webapp"),running js command will created nested directories
js
[info] Compiling sbt-js source
/Users/guillaumemasse/Project/ScalaKata/src/main/webapp/js/kata.js
[success] Total time: 1 s, completed Jul 13, 2013 3:37:56 PM
js
[info] Compiling sbt-js source
/Users/guillaumemasse/Project/ScalaKata/src/main/webapp/webapp/js/kata.js
[success] Total time: 0 s, completed Jul 13, 2013 3:37:59 PM
js
[info] Compiling sbt-js source
/Users/guillaumemasse/Project/ScalaKata/src/main/webapp/webapp/webapp/js/kata.js
[success] Total time: 0 s, completed Jul 13, 2013 3:38:45 PMsbt-version
[info] 0.12.3—
Reply to this email directly or view it on GitHubhttps://github.com//issues/32
.Apologies for dropping the ball on this issue. I checked out ScalaKata on Github and managed to recreate the issue.
The issue occurs when the target directory for sbtjs (resourceManaged) occurs inside the source directory. The defaults for sbtjs may need a bit of tweaking to prevent this happening so often. The default source directory is:
(sourceDirectory in (Compile, JsKeys.hs) <<= (sourceDirectory in Compile)
which evaluates to
src/main. You were setting the target directory to:(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)(_ / "webapp")
which evaluates to
src/main/webapp. Every time you ran sbtjs it picked up a new source file and recompiled it relative to the webapp directory. The workaround is, of course, to manually specify a source directory outside ofsrc/main/webapp.From a plugin design standpoint, I'm expecting people to override
sourceDirectoryandresourceManged, which is why I've not noticed this before. It would be better to havesrc/main/jsas a default source directory and something liketarget/scala_x.y/jsas a default target directory, which would avoid such errors.I'll pencil this in for 0.7-M2.
with this setting
(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)(_ / "webapp"),running js command will created nested directories