summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorStefan Zeiger <szeiger@novocode.com>2015-11-11 14:55:02 +0100
committerStefan Zeiger <szeiger@novocode.com>2015-11-24 12:44:31 +0100
commit03607b219aa854c3d36ae572d2ac6fca8a1bd29e (patch)
tree8774280e9538bdabffff439bbee15a220ca03885 /build.sbt
parent7a75c0ff03f7d8fa36f886b4de61696c20828672 (diff)
downloadscala-03607b219aa854c3d36ae572d2ac6fca8a1bd29e.tar.gz
scala-03607b219aa854c3d36ae572d2ac6fca8a1bd29e.tar.bz2
scala-03607b219aa854c3d36ae572d2ac6fca8a1bd29e.zip
[nomerge] Build man pages and scala-dist.jar from sbt
- ManMaker is compiled in a new subproject “manual”. A simple command line runner complements the ant task so that it can be run from sbt. - Another new subproject “scala-dist” is responsible for building the scala-dist.jar artifact.
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt48
1 files changed, 47 insertions, 1 deletions
diff --git a/build.sbt b/build.sbt
index 6540d0b9c0..aaf79888d8 100644
--- a/build.sbt
+++ b/build.sbt
@@ -185,7 +185,7 @@ lazy val library = configureAsSubproject(project)
includeFilter in unmanagedResources in Compile := "*.tmpl" | "*.xml" | "*.js" | "*.css" | "rootdoc.txt",
// Include forkjoin classes in scala-library.jar
mappings in Compile in packageBin ++=
- (mappings in Compile in packageBin in LocalProject("forkjoin")).value
+ (mappings in Compile in packageBin in forkjoin).value
)
.settings(filterDocSources("*.scala" -- (regexFileFilter(".*/runtime/.*\\$\\.scala") ||
regexFileFilter(".*/runtime/ScalaRunTime\\.scala") ||
@@ -395,6 +395,52 @@ lazy val test = project.
)
)
+lazy val manual = configureAsSubproject(project)
+ .settings(
+ libraryDependencies ++= Seq(scalaXmlDep, antDep),
+ classDirectory in Compile := (target in Compile).value / "classes"
+ )
+ .settings(disableDocsAndPublishingTasks: _*)
+ .dependsOn(library)
+
+lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-dist-src-dummy")
+ .settings(commonSettings: _*)
+ .settings(
+ doc := file("!!! NO DOCS !!!"),
+ mappings in Compile in packageBin ++= {
+ val binBaseDir = buildDirectory.value / "pack"
+ val binMappings = (mkBin in dist).value.pair(relativeTo(binBaseDir), errorIfNone = false)
+ // With the way the resource files are spread out over the project sources we can't just add
+ // an unmanagedResourceDirectory, so we generate the mappings manually:
+ val docBaseDir = (baseDirectory in ThisBuild).value
+ val docMappings = (docBaseDir / "doc").*** pair relativeTo(docBaseDir)
+ val resBaseDir = (baseDirectory in ThisBuild).value / "src/manual/scala/tools/docutil/resources"
+ val resMappings = resBaseDir ** ("*.html" | "*.css" | "*.gif" | "*.png") pair (p => relativeTo(resBaseDir)(p).map("doc/tools/" + _))
+ docMappings ++ resMappings ++ binMappings
+ },
+ resourceGenerators in Compile += Def.task {
+ val command = "fsc, scala, scalac, scaladoc, scalap"
+ val htmlOut = (resourceManaged in Compile).value / "doc/tools"
+ val manOut = (resourceManaged in Compile).value / "genman"
+ val fixedManOut = (resourceManaged in Compile).value / "man"
+ IO.createDirectory(htmlOut)
+ IO.createDirectory(manOut / "man1")
+ toError(runner.value.run("scala.tools.docutil.ManMaker",
+ (fullClasspath in Compile in manual).value.files,
+ Seq(command, htmlOut.getAbsolutePath, manOut.getAbsolutePath),
+ streams.value.log))
+ (manOut ** "*.1" pair rebase(manOut, fixedManOut)).foreach { case (in, out) =>
+ // Generated manpages should always use LF only. There doesn't seem to be a good reason
+ // for generating them with the platform EOL first and then converting them but that's
+ // what the ant build does.
+ IO.write(out, IO.readBytes(in).filterNot(_ == '\r'))
+ }
+ (htmlOut ** "*.html").get ++ (fixedManOut ** "*.1").get
+ }.taskValue,
+ managedResourceDirectories in Compile := Seq((resourceManaged in Compile).value),
+ packageOptions in Compile in packageBin := Seq.empty
+ )
+
lazy val root = (project in file(".")).
aggregate(library, forkjoin, reflect, compiler, interactive, repl, replJline, replJlineEmbedded,
scaladoc, scalap, actors, partestExtras, junit).settings(