use tag when available

This commit is contained in:
Eugene Yokota 2019-03-22 02:28:14 -04:00
parent db4f3484a2
commit b98b5dffa6
1 changed files with 5 additions and 2 deletions

View File

@ -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, "-w", "1"),
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), 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( Seq(
"-sourcepath", "-sourcepath",
(baseDirectory in LocalRootProject).value.getAbsolutePath, (baseDirectory in LocalRootProject).value.getAbsolutePath,
"-doc-source-url", "-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), crossScalaVersions := Seq(baseScalaVersion),