-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.sbt
74 lines (59 loc) · 2.27 KB
/
site.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
// See: https://github.com/sbt/sbt-site
enablePlugins(PreprocessPlugin)
enablePlugins(SiteScaladocPlugin)
enablePlugins(GhpagesPlugin)
preprocessVars in Preprocess := Map(
"REPO" -> "gov.nasa.jpl.imce",
"ORG" -> "JPL-IMCE",
"SUBJECT" -> "jpl-imce",
"ORG_NAME" -> organizationName.value,
"DESC" -> description.value,
"PKG" -> moduleName.value,
"CONTRIBUTORS" -> {
val commit = Process("git rev-parse HEAD").lines.head
val p1 = Process(s"git shortlog -sne --no-merges $commit")
val p2 = Process(
Seq("sed",
"-e",
"""s|^\s*\([0-9][0-9]*\)\s*\(\w.*\w\)\s*<\([a-zA-Z].*\)>.*$|<tr><td align='right'>\1</td><td>\2</td><td>\3</td></tr>|"""))
val whoswho = p1 #| p2
whoswho.lines.mkString("\n")
},
"VERSION" -> {
git.gitCurrentTags.value match {
case Seq(tag) =>
s"""<a href="https://github.com/JPL-IMCE/${moduleName.value}/tree/$tag">$tag</a>"""
case _ =>
val v = version.value
git.gitHeadCommit.value.fold[String](v) { sha =>
if (git.gitUncommittedChanges.value)
v
else
s"""<a href="https://github.com/JPL-IMCE/${moduleName.value}/tree/$sha">$v</a>"""
}
}
}
)
target in preprocess := (target in makeSite).value
dependencyDotFile := baseDirectory.value / "target" / "dependencies.dot"
lazy val dependencySvgFile = settingKey[File]("Location of the dependency graph in SVG format")
dependencySvgFile := baseDirectory.value / "target" / "dependencies.svg"
lazy val filter: ScopeFilter = ScopeFilter(inProjects(ThisProject), inConfigurations(Compile))
dumpLicenseReport := {
val dotFile = dependencyDot.all(filter).value
val ok = Process(command="dot", arguments=Seq[String]("-Tsvg", dotFile.head.getAbsolutePath, "-o"+dependencySvgFile.value.getAbsolutePath)).!
require(0 == ok, "dot2svg failed: $ok")
dumpLicenseReport.value
}
makeSite := {
val _ = dumpLicenseReport.value
makeSite.value
}
siteMappings := {
val _ = dumpLicenseReport.value
siteMappings.value
}
siteMappings += (licenseReportDir.value / "LicenseReportOfAggregatedSBTPluginsAndLibraries.html") -> "LicenseReportOfAggregatedSBTPluginsAndLibraries.html"
siteMappings += dependencySvgFile.value -> "dependencies.svg"
previewFixedPort := Some(4004)
previewLaunchBrowser := false