diff --git a/build.sbt b/build.sbt index fb24dfe..639580d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,33 +1,7 @@ -sbtPlugin := true - organization := "com.typesafe.sbt" - name := "sbt-coffeescript" - -version := "1.0.1-SNAPSHOT" - -scalaVersion := "2.10.4" - -scalacOptions += "-feature" - libraryDependencies ++= Seq( - "org.webjars" % "coffee-script-node" % "1.7.1", - "org.webjars" % "mkdirp" % "0.3.5" + "org.webjars" % "coffee-script-node" % "1.11.0", + "org.webjars" % "mkdirp" % "0.5.0" ) - -resolvers ++= Seq( - "Typesafe Releases Repository" at "http://repo.typesafe.com/typesafe/releases/" -) - -addSbtPlugin("com.typesafe.sbt" % "sbt-js-engine" % "1.2.0") - -publishMavenStyle := false - -publishTo := { - if (isSnapshot.value) Some(Classpaths.sbtPluginSnapshots) - else Some(Classpaths.sbtPluginReleases) -} - -scriptedSettings - -scriptedLaunchOpts <+= version apply { v => s"-Dproject.version=$v" } +addSbtJsEngine("1.2.1") diff --git a/project/build.properties b/project/build.properties index 27e88aa..64317fd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 diff --git a/project/plugins.sbt b/project/plugins.sbt index c3b4f97..662cca1 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1 @@ -libraryDependencies <+= (sbtVersion) { sv => - "org.scala-sbt" % "scripted-plugin" % sv -} \ No newline at end of file +addSbtPlugin("com.typesafe.sbt" % "sbt-web-build-base" % "1.0.0") diff --git a/sbt-coffeescript-plugin-tester/project/build.properties b/sbt-coffeescript-plugin-tester/project/build.properties index 27e88aa..64317fd 100755 --- a/sbt-coffeescript-plugin-tester/project/build.properties +++ b/sbt-coffeescript-plugin-tester/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 diff --git a/src/main/scala/com/typesafe/sbt/coffeescript/SbtCoffeeScript.scala b/src/main/scala/com/typesafe/sbt/coffeescript/SbtCoffeeScript.scala index 8cb7014..7287d99 100644 --- a/src/main/scala/com/typesafe/sbt/coffeescript/SbtCoffeeScript.scala +++ b/src/main/scala/com/typesafe/sbt/coffeescript/SbtCoffeeScript.scala @@ -40,18 +40,23 @@ object SbtCoffeeScript extends AutoPlugin { ).toString() ) + override def buildSettings = inTask(coffeescript)( + SbtJsTask.jsTaskSpecificUnscopedBuildSettings ++ Seq( + moduleName := "coffeescript", + shellFile := getClass.getClassLoader.getResource("coffee.js") + + ) + ) + override def projectSettings = Seq( bare := false, sourceMap := true ) ++ inTask(coffeescript)( - SbtJsTask.jsTaskSpecificUnscopedSettings ++ + SbtJsTask.jsTaskSpecificUnscopedProjectSettings ++ inConfig(Assets)(coffeeScriptUnscopedSettings) ++ inConfig(TestAssets)(coffeeScriptUnscopedSettings) ++ Seq( - moduleName := "coffeescript", - shellFile := getClass.getClassLoader.getResource("coffee.js"), - taskMessage in Assets := "CoffeeScript compiling", taskMessage in TestAssets := "CoffeeScript test compiling" ) diff --git a/src/sbt-test/sbt-coffeescript-plugin/coffee/build.sbt b/src/sbt-test/sbt-coffeescript-plugin/coffee/build.sbt index 938e181..510fc92 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/coffee/build.sbt +++ b/src/sbt-test/sbt-coffeescript-plugin/coffee/build.sbt @@ -12,7 +12,7 @@ checkMapFileContents := { | "a.coffee" | ], | "names": [], - | "mappings": "AAAA;AAAA,MAAA,gBAAA;;AAAA,EAAA,MAAA,GAAW,EAAX,CAAA;;AAAA,EACA,QAAA,GAAW,IADX,CAAA;AAAA" + | "mappings": "AAAA;AAAA,MAAA;;EAAA,MAAA,GAAW;;EACX,QAAA,GAAW;AADX" |}""".stripMargin) { sys.error(s"Unexpected contents: $contents") } diff --git a/src/sbt-test/sbt-coffeescript-plugin/coffee/project/build.properties b/src/sbt-test/sbt-coffeescript-plugin/coffee/project/build.properties index 27e88aa..64317fd 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/coffee/project/build.properties +++ b/src/sbt-test/sbt-coffeescript-plugin/coffee/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 diff --git a/src/sbt-test/sbt-coffeescript-plugin/coffee/project/plugins.sbt b/src/sbt-test/sbt-coffeescript-plugin/coffee/project/plugins.sbt index 5407e68..f2520da 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/coffee/project/plugins.sbt +++ b/src/sbt-test/sbt-coffeescript-plugin/coffee/project/plugins.sbt @@ -1,8 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % sys.props("project.version")) - -resolvers ++= Seq( - Resolver.mavenLocal, - Resolver.url("sbt snapshot plugins", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns), - Resolver.sonatypeRepo("snapshots"), - "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/" -) +addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % sys.props("project.version")) \ No newline at end of file diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/build.sbt b/src/sbt-test/sbt-coffeescript-plugin/error-output/build.sbt new file mode 100644 index 0000000..5f230a1 --- /dev/null +++ b/src/sbt-test/sbt-coffeescript-plugin/error-output/build.sbt @@ -0,0 +1,29 @@ +lazy val root = (project in file(".")).enablePlugins(SbtWeb) + +WebKeys.reporter := { + val logFile = target.value / "test-errors.log" + new LoggerReporter(-1, new Logger { + + def trace(t: => Throwable): Unit = {} + + def success(message: => String): Unit = {} + + def log(level: Level.Value, message: => String): Unit = { + if (level == Level.Error) { + IO.append(logFile, message + "\n") + } + } + }) +} + +val checkTestErrorLogContents = taskKey[Unit]("check that test log contents are correct") +checkTestErrorLogContents := { + val contents = IO.read(target.value / "test-errors.log") + if (!contents.endsWith("""/src/main/assets/a.coffee:0: unexpected % + |% + |^ + |one error found + |""".stripMargin)) { + sys.error(s"Unexpected contents: $contents") + } +} \ No newline at end of file diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/TestBuild.scala b/src/sbt-test/sbt-coffeescript-plugin/error-output/project/TestBuild.scala deleted file mode 100644 index 39652c6..0000000 --- a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/TestBuild.scala +++ /dev/null @@ -1,36 +0,0 @@ -import java.util.concurrent.atomic.AtomicInteger -import sbt._ -import sbt.Keys._ - -import com.typesafe.sbt.web.SbtWeb -import com.typesafe.sbt.web.SbtWeb.autoImport._ - -object TestBuild extends Build { - - class TestLogger(target: File) extends Logger { - val unrecognisedInputCount = new AtomicInteger(0) - - def trace(t: => Throwable): Unit = {} - - def success(message: => String): Unit = {} - - def log(level: Level.Value, message: => String): Unit = { - if (level == Level.Error) { - if (message.contains("missing )")) { - if (unrecognisedInputCount.addAndGet(1) == 1) { - IO.touch(target / "unrecognised-input-error") - } - } - } - } - } - - class TestReporter(target: File) extends LoggerReporter(-1, new TestLogger(target)) - - lazy val root = Project( - id = "test-build", - base = file("."), - settings = Seq(WebKeys.reporter := new TestReporter(target.value)) - ).enablePlugins(SbtWeb) - -} \ No newline at end of file diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/build.properties b/src/sbt-test/sbt-coffeescript-plugin/error-output/project/build.properties index 27e88aa..64317fd 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/build.properties +++ b/src/sbt-test/sbt-coffeescript-plugin/error-output/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/plugins.sbt b/src/sbt-test/sbt-coffeescript-plugin/error-output/project/plugins.sbt index 5407e68..f2520da 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/error-output/project/plugins.sbt +++ b/src/sbt-test/sbt-coffeescript-plugin/error-output/project/plugins.sbt @@ -1,8 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % sys.props("project.version")) - -resolvers ++= Seq( - Resolver.mavenLocal, - Resolver.url("sbt snapshot plugins", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns), - Resolver.sonatypeRepo("snapshots"), - "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/" -) +addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % sys.props("project.version")) \ No newline at end of file diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/src/main/assets/a.coffee b/src/sbt-test/sbt-coffeescript-plugin/error-output/src/main/assets/a.coffee index f73cddb..02691e3 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/error-output/src/main/assets/a.coffee +++ b/src/sbt-test/sbt-coffeescript-plugin/error-output/src/main/assets/a.coffee @@ -1 +1 @@ -*(U$@QNJH#R) \ No newline at end of file +% \ No newline at end of file diff --git a/src/sbt-test/sbt-coffeescript-plugin/error-output/test b/src/sbt-test/sbt-coffeescript-plugin/error-output/test index b856061..0aeabd7 100644 --- a/src/sbt-test/sbt-coffeescript-plugin/error-output/test +++ b/src/sbt-test/sbt-coffeescript-plugin/error-output/test @@ -1,3 +1,3 @@ # Compile an less file and see that errors are reported. -> assets -$ exists target/unrecognised-input-error +> checkTestErrorLogContents \ No newline at end of file diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..dc11afe --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +version in ThisBuild := "1.0.1-SNAPSHOT"