-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
93 lines (80 loc) · 2.6 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
inThisBuild(List(
organization := "io.get-coursier",
homepage := Some(url("https://github.com/coursier/sbt-launcher")),
licenses := Seq("Apache 2.0" -> url("http://opensource.org/licenses/Apache-2.0")),
developers := List(
Developer(
"alexarchambault",
"Alexandre Archambault",
"",
url("https://github.com/alexarchambault")
)
)
))
def scala212 = "2.12.12"
def scala210 = "2.10.7"
lazy val `sbt-launcher-plugin` = project
.settings(
sbtPlugin := true,
scalaVersion := scala212,
crossScalaVersions := Seq(scala212, scala210),
sbtVersion.in(pluginCrossBuild) := {
scalaBinaryVersion.value match {
case "2.10" => "0.13.8"
case "2.12" => "1.0.1"
case _ => sbtVersion.in(pluginCrossBuild).value
}
}
)
lazy val `sbt-launcher-scripted-plugin` = project
.settings(
sbtPlugin := true,
scalaVersion := scala212,
crossScalaVersions := Seq(scala212),
sbtVersion.in(pluginCrossBuild) := {
scalaBinaryVersion.value match {
case "2.12" => "1.2.0"
case _ => sbtVersion.in(pluginCrossBuild).value
}
}
)
lazy val `sbt-launcher` = project
.enablePlugins(PackPlugin)
.settings(
scalaVersion := scala212,
crossScalaVersions := Seq(scala212),
scalacOptions ++= Seq("-feature", "-deprecation"),
libraryDependencies ++= Seq(
"io.get-coursier" %% "coursier" % "2.0.16",
"com.github.alexarchambault" %% "case-app" % "2.0.4",
"org.scala-sbt" % "launcher-interface" % "1.2.0",
"com.typesafe" % "config" % "1.4.1",
"com.lihaoyi" %% "utest" % "0.7.7" % "test"
),
mainClass.in(Compile) := Some("coursier.sbtlauncher.MainApp"),
test.in(Test) := test.in(Test).dependsOn(publishLocal).value,
testFrameworks += new TestFramework("utest.runner.Framework"),
resourceGenerators.in(Compile) += Def.task {
import sys.process._
val dir = classDirectory.in(Compile).value / "coursier" / "sbtlauncher"
val ver = version.value
val f = dir / "sbtlauncher.properties"
dir.mkdirs()
val p = new java.util.Properties
p.setProperty("version", ver)
p.setProperty("commit-hash", Seq("git", "rev-parse", "HEAD").!!.trim)
p.setProperty("sbt-coursier-default-version", sbtCoursierVersion)
val w = new java.io.FileOutputStream(f)
p.store(w, "coursier sbt-launcher properties")
w.close()
state.value.log.info(s"Wrote $f")
Seq(f)
}
)
lazy val `coursier-sbt-launcher` = project
.in(file("."))
.aggregate(
`sbt-launcher`,
`sbt-launcher-plugin`,
`sbt-launcher-scripted-plugin`
)