From db4f3484a2277343ccbe7116345c2c662da25bad Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Thu, 22 Feb 2018 10:33:45 +0900 Subject: [PATCH 1/2] add scalacOptions for scaladoc --- build.sbt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.sbt b/build.sbt index 7f73684c3..847e67f07 100644 --- a/build.sbt +++ b/build.sbt @@ -61,6 +61,14 @@ def commonSettings: Seq[Setting[_]] = Def.settings( testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), + scalacOptions in (Compile, doc) ++= { + Seq( + "-sourcepath", + (baseDirectory in LocalRootProject).value.getAbsolutePath, + "-doc-source-url", + s"""https://github.com/sbt/sbt/tree/${sys.process.Process("git rev-parse HEAD").lineStream_!.head}€{FILE_PATH}.scala""" + ) + }, crossScalaVersions := Seq(baseScalaVersion), bintrayPackage := (bintrayPackage in ThisBuild).value, bintrayRepository := (bintrayRepository in ThisBuild).value, From b98b5dffa61ffa019a45f6032d857a47cfd9f10c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 22 Mar 2019 02:28:14 -0400 Subject: [PATCH 2/2] use tag when available --- build.sbt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 847e67f07..1f13669c9 100644 --- a/build.sbt +++ b/build.sbt @@ -61,12 +61,15 @@ def commonSettings: Seq[Setting[_]] = Def.settings( testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), - scalacOptions in (Compile, doc) ++= { + Compile / doc / scalacOptions ++= { + import scala.sys.process._ + val devnull = ProcessLogger(_ => ()) + val tagOrSha = ("git describe --exact-match" #|| "git rev-parse HEAD").lineStream(devnull).head Seq( "-sourcepath", (baseDirectory in LocalRootProject).value.getAbsolutePath, "-doc-source-url", - s"""https://github.com/sbt/sbt/tree/${sys.process.Process("git rev-parse HEAD").lineStream_!.head}€{FILE_PATH}.scala""" + s"https://github.com/sbt/sbt/tree/$tagOrSha€{FILE_PATH}.scala" ) }, crossScalaVersions := Seq(baseScalaVersion),