forked from sbt/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
91 lines (87 loc) · 3.3 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
import com.typesafe.sbt.site.util.SiteHelpers
import Docs._
lazy val tutorialSubDirName = settingKey[String]("subdir name for old tutorial")
lazy val fileEncoding = settingKey[String]("check the file encoding")
ThisBuild / organization := "org.scala-sbt"
ThisBuild / scalafmtOnCompile := true
lazy val root = (project in file("."))
.enablePlugins(
(if (!isBetaBranch) Seq(ParadoxSitePlugin) else Seq()) ++
Seq(LowTechSnippetPamfletPlugin, ScriptedPlugin): _*
)
.settings(
name := "website",
siteEmail := "eed3si9n" + "@gmail.com",
// Landing
Compile / paradox / sourceDirectory := baseDirectory.value / "src" / "landing",
Compile / paradoxTheme / sourceDirectory := (Compile / paradox / sourceDirectory).value / "_template",
paradoxProperties ++= Map(
"sbtVersion" -> Docs.targetSbtFullVersion,
"windowsBuild" -> Docs.sbtWindowsBuild,
"sbtVersionForScalaDoc" -> Docs.sbtVersionForScalaDoc,
),
Compile / paradoxRoots := List(
"404.html",
"community.html",
"cookie.html",
"documentation.html",
"download.html",
"index.html",
"learn.html",
"support.html",
"thank-you.html",
),
// Reference
Pamflet / sourceDirectory := baseDirectory.value / "src" / "reference",
Pamflet / siteSubdirName := s"""$targetSbtBinaryVersion/docs""",
tutorialSubDirName := s"""$targetSbtBinaryVersion/tutorial""",
// Redirects
redirectSettings,
SiteHelpers.addMappingsToSiteDir(Redirect / mappings, Pamflet / siteSubdirName),
redirectTutorialSettings,
SiteHelpers.addMappingsToSiteDir(RedirectTutorial / mappings, tutorialSubDirName),
// GitHub Pages. See project/Docs.scala
customGhPagesSettings,
Pamflet / mappings := {
val xs = (Pamflet / mappings).value
Pdf.cleanupCombinedPages(xs) ++ xs
},
if (scala.sys.BooleanProp.keyExists("sbt.website.generate_pdf"))
Def settings (
// NOTE - PDF settings must be done externally like this because pdf generation generically looks
// through `mappings in Config` for Combined+Pages.md to generate PDF from, and therefore we
// can't create a circular dependency by adding it back into the original mappings.
Pdf.settings,
Pdf.settingsFor(Pamflet, "sbt-reference"),
SiteHelpers.addMappingsToSiteDir(
Pamflet / Pdf.generatePdf / mappings,
Pamflet / siteSubdirName,
)
)
else if (scala.sys.BooleanProp.keyExists("sbt.website.detect_pdf"))
Def.settings(
// assume PDF files were created in another Docker container
Pamflet / Pdf.detectPdf := ((Pamflet / target).value ** "*.pdf").get,
Pamflet / Pdf.detectPdf / mappings := {
(Pamflet / Pdf.detectPdf).value pair Path.relativeTo((Pamflet / target).value)
},
SiteHelpers.addMappingsToSiteDir(
Pamflet / Pdf.detectPdf / mappings,
Pamflet / siteSubdirName,
)
)
else Nil,
fileEncoding := {
sys.props("file.encoding") match {
case "UTF-8" => "UTF-8"
case x => sys.error(s"Unexpected encoding $x")
}
},
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
scriptedBufferLog := false,
isGenerateSiteMap := true
)
//