diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-02-02 15:46:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 15:46:39 +0100 |
commit | 3e65cff0caf4c671d3cf98da347792c85a4ac2de (patch) | |
tree | 415cfd9ac0601ceef6856e8873dcb384bb00abc3 /project/Build.scala | |
parent | fc031140ec00f2bfdc79456e1de9e15ae7df8d9a (diff) | |
parent | 6a2d1e0eb1005aa2e3567f256c6e259ede2f6ea7 (diff) | |
download | dotty-3e65cff0caf4c671d3cf98da347792c85a4ac2de.tar.gz dotty-3e65cff0caf4c671d3cf98da347792c85a4ac2de.tar.bz2 dotty-3e65cff0caf4c671d3cf98da347792c85a4ac2de.zip |
Merge pull request #1874 from dotty-staging/topic/dottydoc-markdown
[doctool] Add markdown support && Static site generation
Diffstat (limited to 'project/Build.scala')
-rw-r--r-- | project/Build.scala | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/project/Build.scala b/project/Build.scala index 778492624..a6505a12c 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -52,6 +52,15 @@ object DottyBuild extends Build { lazy val dotr = inputKey[Unit]("run compiled binary using the correct classpath, or the user supplied classpath") + // Compiles the documentation and static site + lazy val genDocs = inputKey[Unit]("run dottydoc to generate static documentation site") + + /** Dottydoc deps */ + lazy val dottydocDeps = SettingKey[Seq[ModuleID]]( + "dottydocDeps", + "dottydoc dependencies, should be moved to a dottydoc sbt subproject eventually" + ) + override def settings: Seq[Setting[_]] = { super.settings ++ Seq( scalaVersion in Global := scalacVersion, @@ -177,16 +186,28 @@ object DottyBuild extends Build { //http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728 com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys.withSource := true, + dottydocDeps := Seq( + "com.vladsch.flexmark" % "flexmark" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-gfm-tasklist" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-gfm-tables" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-autolink" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-anchorlink" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-emoji" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % "0.11.1", + "com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % "0.11.1", + "com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.8.6", + "nl.big-o" % "liqp" % "0.6.7" + ), + // get libraries onboard partestDeps := Seq(scalaCompiler, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-library" % scalacVersion % "test"), libraryDependencies ++= partestDeps.value, + libraryDependencies ++= dottydocDeps.value, libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1", "org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test", - dottyOrganization % "dottydoc-client" % "0.1.0", "com.novocode" % "junit-interface" % "0.11" % "test", - "com.github.spullara.mustache.java" % "compiler" % "0.9.3", "com.typesafe.sbt" % "sbt-interface" % sbtVersion.value), // enable improved incremental compilation algorithm incOptions := incOptions.value.withNameHashing(true), @@ -204,6 +225,21 @@ object DottyBuild extends Build { ) }.evaluated, + genDocs := Def.inputTaskDyn { + val dottyLib = packageAll.value("dotty-library") + val dottyInterfaces = packageAll.value("dotty-interfaces") + val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":") + val sources = (managedSources in (Compile, compile)).value ++ (unmanagedSources in (Compile, compile)).value + val args: Seq[String] = Seq( + "-siteroot", "docs", + "-project", "Dotty", + "-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps" + ) + (runMain in Compile).toTask( + s""" dotty.tools.dottydoc.Main ${args.mkString(" ")} ${sources.mkString(" ")}""" + ) + }.evaluated, + // Override run to be able to run compiled classfiles dotr := { val args: Seq[String] = spaceDelimited("<arg>").parsed @@ -369,6 +405,8 @@ object DottyBuild extends Build { // project, for sbt integration // FIXME: note part of dottyCompilerSettings because the doc-tool does not // compile with dotty + unmanagedResourceDirectories in Compile := Seq((resourceDirectory in Compile).value), + unmanagedResourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "resources", unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value), unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src", unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value), |