Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt-js creating recursive directory structure #32

Open
MasseGuillaume opened this issue Jul 13, 2013 · 2 comments
Open

sbt-js creating recursive directory structure #32

MasseGuillaume opened this issue Jul 13, 2013 · 2 comments
Milestone

Comments

@MasseGuillaume
Copy link

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 PM

sbt-version
[info] 0.12.3

@davegurnell
Copy link
Member

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é [email protected] 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 PM

sbt-version
[info] 0.12.3


Reply to this email directly or view it on GitHubhttps://github.com//issues/32
.

@davegurnell
Copy link
Member

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 of src/main/webapp.

From a plugin design standpoint, I'm expecting people to override sourceDirectory and resourceManged, which is why I've not noticed this before. It would be better to have src/main/js as a default source directory and something like target/scala_x.y/js as a default target directory, which would avoid such errors.

I'll pencil this in for 0.7-M2.

@davegurnell davegurnell modified the milestones: 0.8, 0.7 Mar 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants