forked from sbt/sbt-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
109 lines (90 loc) · 3.47 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
import scala.sys.process._
sbtPlugin := true
name := "sbt-site"
organization := "com.typesafe.sbt"
version := "1.3.2"
crossSbtVersions := List("0.13.17", "1.0.4")
licenses += ("BSD 3-Clause", url("https://opensource.org/licenses/BSD-3-Clause"))
//#scm-info
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt-site"), "[email protected]:sbt/sbt-site.git"))
//#scm-info
scalacOptions ++= Seq("-deprecation", "-unchecked")
resolvers += Resolver.sonatypeRepo("releases")
val unfilteredVersion = "0.9.1"
libraryDependencies ++= Seq(
"ws.unfiltered" %% "unfiltered-directives" % unfilteredVersion,
"ws.unfiltered" %% "unfiltered-filter" % unfilteredVersion,
"ws.unfiltered" %% "unfiltered-jetty" % unfilteredVersion,
"ws.unfiltered" %% "unfiltered-specs2" % unfilteredVersion % "test",
"org.foundweekends" %% "pamflet-library" % "0.7.1",
"org.yaml" % "snakeyaml" % "1.13",
"com.typesafe" % "config" % "1.2.1", // Last version to support Java 1.6
"org.asciidoctor" % "asciidoctorj" % "1.5.4"
)
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.3.2")
libraryDependencies ++= {
if ((sbtBinaryVersion in pluginCrossBuild).value == "0.13") {
Seq(
Defaults.sbtPluginExtra(
"org.planet42" % "laika-sbt" % "0.7.0",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
)
)
} else {
Seq(
Defaults.sbtPluginExtra(
"org.planet42" % "laika-sbt" % "0.7.5",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
)
)
}
}
enablePlugins(ParadoxSitePlugin, ParadoxMaterialThemePlugin)
sourceDirectory in Paradox := sourceDirectory.value / "main" / "paradox"
ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox)
paradoxMaterialTheme in Paradox ~= {
_.withFavicon("img/favicon.png")
.withLogo("img/sbt-logo.svg")
.withRepository(uri("https://github.com/sbt/sbt-site"))
}
version in Paradox := {
if (isSnapshot.value) "git tag -l".!!.split("\r?\n").last.substring(1)
else version.value
}
//#ghpages-publish
enablePlugins(GhpagesPlugin)
git.remoteRepo := scmInfo.value.get.connection
//#ghpages-publish
TaskKey[Unit]("runScriptedTest") := Def.taskDyn {
val sbtBinVersion = (sbtBinaryVersion in pluginCrossBuild).value
val base = sbtTestDirectory.value
def isCompatible(directory: File): Boolean = {
val buildProps = new java.util.Properties()
IO.load(buildProps, directory / "project" / "build.properties")
Option(buildProps.getProperty("sbt.version"))
.map { version =>
val requiredBinVersion = CrossVersion.binarySbtVersion(version)
val compatible = requiredBinVersion == sbtBinVersion
if (!compatible) {
val testName = directory.relativeTo(base).getOrElse(directory)
streams.value.log.warn(s"Skipping $testName since it requires sbt $requiredBinVersion")
}
compatible
}
.getOrElse(true)
}
val testDirectoryFinder = base * AllPassFilter * AllPassFilter filter { _.isDirectory }
val tests = for {
test <- testDirectoryFinder.get
if isCompatible(test)
path <- Path.relativeTo(base)(test)
} yield path.replace('\\', '/')
if (tests.nonEmpty)
Def.task(scripted.toTask(tests.mkString(" ", " ", "")).value)
else
Def.task(streams.value.log.warn("No tests can be run for this sbt version"))
}.value
scriptedLaunchOpts += "-Dproject.version="+version.value
// scriptedBufferLog := false