Skip to content

sbt-js creating recursive directory structure #32

Description

@MasseGuillaume

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

Activity

  1. davegurnell commented on Jul 16, 2013

    @davegurnell
    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é 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 PM

    sbt-version
    [info] 0.12.3

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

  2. davegurnell commented on Oct 20, 2013

    @davegurnell
    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.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions