untyped / sbt-plugins

SBT plugins for Javascript, Coffeescript, LESS, SASS, and Mustache compilation
73 stars 23 forks source link

compile and js command dependency conflicts with Other plugins #28

Closed chesterxgchen closed 11 years ago

chesterxgchen commented 11 years ago

Dave,

based on the documentation (readme) (compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile) will cause the js task to run automatically when you run compile.

But when there are plugins (sbt-dustjs), this seems have conflicts.

in plugin.sbt, I have this:

addSbtPlugin("eu.getintheloop" %% "sbt-dustjs" % "0.0.4-SNAPSHOT")

addSbtPlugin("com.untyped" % "sbt-js" % "0.5")

in build.sbt, I use the the followings:

seq(dustSettings: _*)

seq(jsSettings : _*)

(resourceManaged in (Compile, DustKeys.dust)) <<= (sourceDirectory in Compile) ( _ / "resources" / "web" / "js"/"dust")

(compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile)

when type sbt compile

sbt compile

build.sbt:49: error: reference to compile is ambiguous;

it is imported twice in the same scope by import root.dustjs.DustJsPlugin. and import Keys. (compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile) ^ [error] Type error in expression

you can find more details in https://github.com/chesterxgchen/backbone-cellar/blob/master/spraydust

davegurnell commented 11 years ago

It looks like this is a problem with the DustJs plugin. @timperrett can probably pitch in here.

I believe the problem is that the Dust plugin defines a method called "compile". SBT imports all methods of all plugins into the namespace of your .sbt files. There are a couple of workarounds:

  1. Use prefixes to disambiguate the two. In this case you want Keys.compile instead of compile.
  2. Use a .scala build definition rather than a .sbt one. These are a little more work to write, but you don't have all of this implicit import stuff going on.

I suspect Time uses .scala build files most of the time, which is why he hasn't run into this problem.

Cheers,

Dave

On 15 May 2013 15:58, Chester Chen notifications@github.com wrote:

Dave,

based on the documentation (readme) (compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile) will cause the js task to run automatically when you run compile.

But when there are plugins (sbt-dustjs), this seems have conflicts.

in plugin.sbt, I have this:

addSbtPlugin("eu.getintheloop" %% "sbt-dustjs" % "0.0.4-SNAPSHOT")

addSbtPlugin("com.untyped" % "sbt-js" % "0.5")

in build.sbt, I use the the followings:

seq(dustSettings: _*)

seq(jsSettings : _*)

(resourceManaged in (Compile, DustKeys.dust)) <<= (sourceDirectory in Compile) ( _ / "resources" / "web" / "js"/"dust")

(compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile)

when type sbt compile

sbt compile

build.sbt:49: error: reference to compile is ambiguous;

it is imported twice in the same scope by import root.dustjs.DustJsPlugin. and import Keys. (compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile) ^ [error] Type error in expression

you can find more details in https://github.com/chesterxgchen/backbone-cellar/blob/master/spraydust

— Reply to this email directly or view it on GitHubhttps://github.com/untyped/sbt-plugins/issues/28 .