-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
81 lines (73 loc) · 2.71 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
import _root_.io.github.nafg.mergify.dsl._
val Scala212 = "2.12.20"
val Scala213 = "2.13.16"
ThisBuild / scalacOptions += "-feature"
ThisBuild / scalacOptions += "-Xsource:3"
ThisBuild / organization := "io.github.nafg.mergify"
mergifyExtraConditions := Seq(
(Attr.Author :== "scala-steward") ||
(Attr.Author :== "nafg-scala-steward[bot]")
)
name := "mergify-yaml"
publish / skip := true
val generateModels = taskKey[File]("Generate the models by scraping the documentation")
lazy val `generated-models` =
projectMatrix
.jvmPlatform(List(Scala212, Scala213))
.settings(
libraryDependencies += "io.circe" %% "circe-core" % "0.14.10",
generateModels := {
val dir = (Compile / scalaSource).value / "io/github/nafg/mergify/models/generated"
val file = dir / "Action.scala"
IO.write(
file,
ScrapeActions
.run()
.map(_.linesWithSeparators.map(" " + _).mkString + " extends Action")
.mkString(
start = """// GENERATED CODE: DO NOT EDIT THIS FILE MANUALLY.
|// TO UPDATE, RUN `sbt generateModels`
|// SEE `project/ScrapeActions.scala`
|
|package io.github.nafg.mergify.models.generated
|
|import io.github.nafg.mergify.ToJson
|
|
|sealed trait Action
|object Action {
|""".stripMargin,
sep = "\n\n\n",
end = "}\n"
)
)
file
}
)
lazy val writer =
projectMatrix
.jvmPlatform(List(Scala212, Scala213))
.dependsOn(`generated-models`)
.settings(
name := "mergify-writer",
libraryDependencies ++= Seq(
"io.circe" %% "circe-yaml" % "1.15.0",
"io.circe" %% "circe-generic-extras" % "0.14.4",
"com.softwaremill.magnolia1_2" %% "magnolia" % "1.1.10",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"com.lihaoyi" %% "requests" % "0.9.0" % Test,
"org.scalameta" %% "munit" % "1.1.0" % Test
)
)
//noinspection SpellCheckingInspection
lazy val plugin =
projectMatrix
.jvmPlatform(List(Scala212))
.dependsOn(writer)
.settings(
name := "sbt-mergify-github-actions",
sbtPlugin := true,
crossScalaVersions := List(Scala212),
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0"),
libraryDependencies += "org.scalameta" %% "munit" % "1.1.0" % Test
)