2014-05-01 18:50:07 +02:00
|
|
|
import sbt._
|
|
|
|
|
import Keys._
|
2015-02-15 04:29:24 +01:00
|
|
|
import StatusPlugin.autoImport._
|
2014-08-07 18:54:00 +02:00
|
|
|
import com.typesafe.sbt.{ SbtGhPages, SbtGit, SbtSite, site => sbtsite }
|
|
|
|
|
import SbtSite.{ site, SiteKeys }
|
|
|
|
|
import SbtGhPages.{ ghpages, GhPagesKeys => ghkeys }
|
|
|
|
|
import SbtGit.{ git, GitKeys }
|
2014-05-01 18:50:07 +02:00
|
|
|
import sbtsite.SphinxSupport
|
2014-08-07 18:54:00 +02:00
|
|
|
import SiteKeys.{ makeSite, siteMappings }
|
2014-05-01 18:50:07 +02:00
|
|
|
import Sxr.sxr
|
|
|
|
|
import SiteMap.Entry
|
|
|
|
|
|
|
|
|
|
object Docs {
|
|
|
|
|
val siteExcludes = Set(".buildinfo", "objects.inv")
|
|
|
|
|
def siteInclude(f: File) = !siteExcludes.contains(f.getName)
|
|
|
|
|
|
|
|
|
|
def settings: Seq[Setting[_]] =
|
|
|
|
|
site.settings ++
|
2014-08-07 18:54:00 +02:00
|
|
|
site.includeScaladoc("api") ++
|
|
|
|
|
siteIncludeSxr("sxr") ++
|
|
|
|
|
ghPagesSettings
|
2014-05-01 18:50:07 +02:00
|
|
|
|
|
|
|
|
def ghPagesSettings = ghpages.settings ++ Seq(
|
|
|
|
|
git.remoteRepo := "git@github.com:sbt/sbt.github.com.git",
|
|
|
|
|
localRepoDirectory,
|
|
|
|
|
ghkeys.synchLocal <<= synchLocalImpl,
|
|
|
|
|
GitKeys.gitBranch in ghkeys.updatedRepository := Some("master")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def localRepoDirectory = ghkeys.repository := {
|
|
|
|
|
// distinguish between building to update the site or not so that CI jobs
|
|
|
|
|
// that don't commit+publish don't leave uncommitted changes in the working directory
|
2014-08-07 18:54:00 +02:00
|
|
|
val status = if (isSnapshot.value) "snapshot" else "public"
|
2014-05-01 18:50:07 +02:00
|
|
|
Path.userHome / ".sbt" / "ghpages" / status / organization.value / name.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def siteIncludeSxr(prefix: String) = Seq(
|
|
|
|
|
mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq),
|
|
|
|
|
site.addMappingsToSiteDir(mappings in sxr, prefix)
|
|
|
|
|
)
|
|
|
|
|
|
2014-08-04 16:14:03 +02:00
|
|
|
def synchLocalImpl = (ghkeys.privateMappings, ghkeys.updatedRepository, version, streams) map {
|
|
|
|
|
(mappings, repo, v, s) =>
|
2014-08-07 18:54:00 +02:00
|
|
|
val versioned = repo / v
|
|
|
|
|
IO.delete(versioned / "sxr")
|
|
|
|
|
IO.delete(versioned / "api")
|
|
|
|
|
val toCopy = for ((file, target) <- mappings if siteInclude(file)) yield (file, versioned / target)
|
|
|
|
|
IO.copy(toCopy)
|
|
|
|
|
repo
|
2014-05-01 18:50:07 +02:00
|
|
|
}
|
2012-10-16 21:01:58 +02:00
|
|
|
}
|