forked from scalameta/mdoc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
178 lines (170 loc) · 5.41 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
inThisBuild(
List(
scalaVersion := "2.12.8",
organization := "org.scalameta",
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
homepage := Some(url("https://github.com/scalameta/mdoc")),
developers := List(
Developer(
"jvican",
"Jorge Vicente Cantero",
url("https://jvican.github.io/")
),
Developer(
"olafurpg",
"Ólafur Páll Geirsson",
url("https://geirsson.com")
)
),
// faster publishLocal:
publishArtifact.in(packageDoc) := sys.env.contains("CI"),
publishArtifact.in(packageSrc) := sys.env.contains("CI")
)
)
name := "mdocRoot"
skip in publish := true
val V = new {
val scalameta = "4.1.0"
}
lazy val runtime = project
.settings(
moduleName := "mdoc-runtime",
libraryDependencies ++= List(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"com.lihaoyi" %% "pprint" % "0.5.2"
)
)
lazy val mdoc = project
.settings(
moduleName := "mdoc",
mainClass in assembly := Some("mdoc.Main"),
assemblyJarName in assembly := "mdoc.jar",
test in assembly := {},
assemblyMergeStrategy.in(assembly) ~= { old =>
{
case PathList("META-INF", "CHANGES") => MergeStrategy.discard
case x => old(x)
}
},
fork in run := true,
buildInfoPackage := "mdoc.internal",
buildInfoKeys := Seq[BuildInfoKey](
version,
scalaVersion,
scalaBinaryVersion
),
libraryDependencies ++= List(
"com.googlecode.java-diff-utils" % "diffutils" % "1.3.0",
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scalameta" %% "scalameta" % V.scalameta,
"com.geirsson" %% "metaconfig-typesafe-config" % "0.9.1",
"com.vladsch.flexmark" % "flexmark-all" % "0.34.44",
"com.lihaoyi" %% "fansi" % "0.2.5",
"io.methvin" % "directory-watcher" % "0.8.0",
"me.xdrop" % "fuzzywuzzy" % "1.1.10", // for link hygiene "did you mean?"
// live reload
"io.undertow" % "undertow-core" % "2.0.13.Final",
"org.jboss.xnio" % "xnio-nio" % "3.6.5.Final",
"org.slf4j" % "slf4j-nop" % "1.8.0-beta2"
)
)
.dependsOn(runtime)
.enablePlugins(BuildInfoPlugin)
lazy val testsInput = project
.in(file("tests/input"))
.settings(
skip in publish := true
)
lazy val unit = project
.in(file("tests/unit"))
.settings(
skip in publish := true,
scalacOptions ++= List(
"-deprecation"
),
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.8"),
resourceGenerators.in(Test) += Def.task {
val out = managedResourceDirectories.in(Test).value.head / "mdoc.properties"
val props = new java.util.Properties()
props.put("scalacOptions", scalacOptions.in(Compile).value.mkString(" "))
IO.write(props, "mdoc properties", out)
List(out)
},
resolvers += Resolver.bintrayRepo("cibotech", "public"),
libraryDependencies ++= List(
"com.cibo" %% "evilplot" % "0.6.0",
"co.fs2" %% "fs2-core" % "0.10.4",
"org.scalacheck" %% "scalacheck" % "1.13.5" % Test,
"org.scalacheck" %% "scalacheck" % "1.13.5" % Test,
"org.scalatest" %% "scalatest" % "3.2.0-SNAP10" % Test,
"org.scalameta" %% "testkit" % V.scalameta % Test
),
// forking causes https://github.com/scalatest/scalatest/issues/556
// fork := true,
buildInfoPackage := "tests",
buildInfoKeys := Seq[BuildInfoKey](
"testsInputClassDirectory" -> classDirectory.in(testsInput, Compile).value
)
)
.dependsOn(mdoc, testsInput)
.enablePlugins(BuildInfoPlugin)
lazy val plugin = project
.in(file("mdoc-sbt"))
.settings(
sbtPlugin := true,
moduleName := "sbt-mdoc",
libraryDependencies ++= List(
"org.jsoup" % "jsoup" % "1.11.3",
"org.scalacheck" %% "scalacheck" % "1.13.5" % Test,
"org.scalameta" %% "testkit" % "4.0.0-M11" % Test
),
resourceGenerators.in(Compile) += Def.task {
val out =
managedResourceDirectories.in(Compile).value.head / "sbt-mdoc.properties"
val props = new java.util.Properties()
props.put("version", version.value)
IO.write(props, "sbt-mdoc properties", out)
List(out)
}
)
lazy val lsp = project
.in(file("mdoc-lsp"))
.settings(
moduleName := "mdoc-lsp",
libraryDependencies ++= List(
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.5.0",
"com.outr" %% "scribe" % "2.6.0",
"com.outr" %% "scribe-slf4j" % "2.6.0"
)
)
.dependsOn(mdoc)
lazy val docs = project
.in(file("mdoc-docs"))
.settings(
moduleName := "mdoc-docs",
skip in publish := version.in(ThisBuild).value.endsWith("-SNAPSHOT"),
mdocAutoDependency := false,
resolvers += Resolver.bintrayRepo("cibotech", "public"),
libraryDependencies ++= List(
"org.scala-sbt" % "sbt" % sbtVersion.value,
"com.cibo" %% "evilplot" % "0.6.0"
),
watchSources += baseDirectory.in(ThisBuild).value / "docs",
cancelable in Global := true,
MdocPlugin.autoImport.mdoc := run.in(Compile).evaluated,
mdocVariables := {
val stableVersion: String =
version.value.replaceFirst("\\+.*", "")
Map(
"VERSION" -> stableVersion,
"SCALA_BINARY_VERSION" -> scalaBinaryVersion.value,
"SCALA_VERSION" -> scalaVersion.value
)
}
)
.dependsOn(mdoc, plugin)
.enablePlugins(DocusaurusPlugin)