From e634e108cf7d8634f9c0757e23c0ee22298f956e Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Fri, 1 Apr 2016 00:39:30 +0200 Subject: [PATCH] Add basic scripted test --- build.sbt | 19 ++++++++++++++++--- .../sbt-test/sbt-coursier/simple/build.sbt | 1 + .../sbt-coursier/simple/project/plugins.sbt | 11 +++++++++++ .../simple/src/main/scala/Main.scala | 6 ++++++ plugin/src/sbt-test/sbt-coursier/simple/test | 3 +++ project/plugins.sbt | 1 + 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 plugin/src/sbt-test/sbt-coursier/simple/build.sbt create mode 100644 plugin/src/sbt-test/sbt-coursier/simple/project/plugins.sbt create mode 100644 plugin/src/sbt-test/sbt-coursier/simple/src/main/scala/Main.scala create mode 100644 plugin/src/sbt-test/sbt-coursier/simple/test diff --git a/build.sbt b/build.sbt index 309d42081..e22661eb4 100644 --- a/build.sbt +++ b/build.sbt @@ -400,9 +400,22 @@ lazy val plugin = project sbtPlugin := { scalaVersion.value.startsWith("2.10.") }, - // added so that 2.10 artifacts of the other modules can be found by - // the too-naive-for-now inter-project resolver of the coursier SBT plugin - resolvers += Resolver.sonatypeRepo("snapshots") + resolvers ++= Seq( + // added so that 2.10 artifacts of the other modules can be found by + // the too-naive-for-now inter-project resolver of the coursier SBT plugin + Resolver.sonatypeRepo("snapshots"), + // added for sbt-scripted to be fine even with ++2.11.x + Resolver.typesafeIvyRepo("releases") + ) + ) + .settings(ScriptedPlugin.scriptedSettings) + .settings( + scriptedLaunchOpts ++= Seq( + "-Xmx1024M", + "-XX:MaxPermSize=256M", + "-Dplugin.version=" + version.value + ), + scriptedBufferLog := false ) lazy val `coursier` = project.in(file(".")) diff --git a/plugin/src/sbt-test/sbt-coursier/simple/build.sbt b/plugin/src/sbt-test/sbt-coursier/simple/build.sbt new file mode 100644 index 000000000..c03b2c8be --- /dev/null +++ b/plugin/src/sbt-test/sbt-coursier/simple/build.sbt @@ -0,0 +1 @@ +scalaVersion := "2.11.8" diff --git a/plugin/src/sbt-test/sbt-coursier/simple/project/plugins.sbt b/plugin/src/sbt-test/sbt-coursier/simple/project/plugins.sbt new file mode 100644 index 000000000..152225a9e --- /dev/null +++ b/plugin/src/sbt-test/sbt-coursier/simple/project/plugins.sbt @@ -0,0 +1,11 @@ +{ + val pluginVersion = sys.props.getOrElse( + "plugin.version", + throw new RuntimeException( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) + ) + + addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion) +} diff --git a/plugin/src/sbt-test/sbt-coursier/simple/src/main/scala/Main.scala b/plugin/src/sbt-test/sbt-coursier/simple/src/main/scala/Main.scala new file mode 100644 index 000000000..61295349d --- /dev/null +++ b/plugin/src/sbt-test/sbt-coursier/simple/src/main/scala/Main.scala @@ -0,0 +1,6 @@ +import java.io.File +import java.nio.file.Files + +object Main extends App { + Files.write(new File("output").toPath, "OK".getBytes("UTF-8")) +} diff --git a/plugin/src/sbt-test/sbt-coursier/simple/test b/plugin/src/sbt-test/sbt-coursier/simple/test new file mode 100644 index 000000000..2182f57b0 --- /dev/null +++ b/plugin/src/sbt-test/sbt-coursier/simple/test @@ -0,0 +1,3 @@ +$ delete output +> run +$ exists output diff --git a/project/plugins.sbt b/project/plugins.sbt index a0cfaba4e..a8d35b748 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,3 +6,4 @@ addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.0") addSbtPlugin("com.github.alexarchambault" % "coursier-sbt-plugin" % "1.0.0-M8") addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.8") +libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value