Add basic scripted test

This commit is contained in:
Alexandre Archambault 2016-04-01 00:39:30 +02:00
parent caf69da816
commit e634e108cf
6 changed files with 38 additions and 3 deletions

View File

@ -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("."))

View File

@ -0,0 +1 @@
scalaVersion := "2.11.8"

View File

@ -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)
}

View File

@ -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"))
}

View File

@ -0,0 +1,3 @@
$ delete output
> run
$ exists output

View File

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