-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
executable file
·103 lines (95 loc) · 4.04 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
94
95
96
97
98
99
100
101
102
103
ThisBuild / organization := "org.scala-exercises"
ThisBuild / githubOrganization := "47degrees"
ThisBuild / scalaVersion := V.scala212
publish / skip := true
ThisBuild / extraCollaborators += Collaborator.github("47erbot")
addCommandAlias(
"ci-test",
";scalafmtCheckAll; scalafmtSbtCheck; +test; +publishLocal; sbt-exercise/scripted"
)
addCommandAlias("ci-docs", ";github; mdoc; headerCreateAll")
addCommandAlias("ci-publish", ";github; ci-release")
lazy val V = new {
val cats: String = "2.9.0"
val collectioncompat: String = "2.9.0"
val github4s: String = "0.32.0"
val http4s: String = "0.23.14"
val runtime: String = "0.7.0"
val scala: String = "2.13.10"
val scala212: String = "2.12.16"
val scalacheck: String = "1.17.0"
val scalacheckShapeless: String = "1.3.0"
val scalamacros: String = "2.1.1"
val scalariform: String = "0.2.10"
val scalatest: String = "3.2.10"
}
lazy val definitions = (project in file("definitions"))
.settings(name := "definitions")
.settings(
crossScalaVersions := Seq(V.scala212, V.scala),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % V.cats,
"org.scalatest" %% "scalatest" % V.scalatest,
"org.scalacheck" %% "scalacheck" % V.scalacheck,
"com.github.alexarchambault" %% "scalacheck-shapeless_1.15" % V.scalacheckShapeless
)
)
lazy val compiler = (project in file("compiler"))
.settings(name := "exercise-compiler")
.settings(
exportJars := true,
crossScalaVersions := Seq(V.scala212, V.scala),
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"org.scala-exercises" %% "runtime" % V.runtime exclude ("org.scala-lang.modules", "scala-collection-compat"),
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-collection-compat" % V.collectioncompat,
"org.typelevel" %% "cats-core" % V.cats % Compile,
"org.http4s" %% "http4s-blaze-client" % V.http4s,
"org.http4s" %% "http4s-circe" % V.http4s,
"com.47deg" %% "github4s" % V.github4s,
"org.scalariform" %% "scalariform" % V.scalariform,
"org.typelevel" %% "cats-laws" % V.cats % Test,
"org.scalatest" %% "scalatest" % V.scalatest % Test
)
)
.dependsOn(definitions)
lazy val compilerClasspath = TaskKey[Classpath]("compiler-classpath")
lazy val `sbt-exercise` = (project in file("sbt-exercise"))
.settings(name := "sbt-exercise")
.settings(
scalacOptions -= "-Xfatal-warnings",
scalacOptions += "-Ypartial-unification",
libraryDependencies += "org.typelevel" %% "cats-core" % V.cats % Compile,
addCompilerPlugin("org.scalamacros" % "paradise" % V.scalamacros cross CrossVersion.full),
// Leverage build info to populate compiler classpath--
compilerClasspath := { (compiler / Compile / fullClasspath) }.value,
buildInfoObject := "Meta",
buildInfoPackage := "org.scalaexercises.plugin.sbtexercise",
buildInfoKeys := Seq(
version,
BuildInfoKey.map(compilerClasspath) { case (_, classFiles) ⇒
("compilerClasspath", classFiles.map(_.data))
}
)
)
.settings(
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
scriptedBufferLog := false,
// Publish definitions before running scripted
scriptedDependencies := {
val x = (Test / compile).value
val y = (definitions / publishLocal).value
val z = (compiler / publishLocal).value
()
}
)
.enablePlugins(SbtPlugin)
.enablePlugins(BuildInfoPlugin)
lazy val documentation = project
.settings(mdocOut := file("."))
.settings(publish / skip := true)
.enablePlugins(MdocPlugin)