Skip to content

Commit

Permalink
Add source links to scala 3 documentation. (#1108)
Browse files Browse the repository at this point in the history
* Add source links to scala 3 documentation.

* format

Co-authored-by: Julien Truffaut <julien@fp-tower.com>
  • Loading branch information
romanowski and julien-truffaut committed Mar 1, 2021
1 parent 6474680 commit fb42b6e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ lazy val buildSettings = Seq(
scmInfo := Some(
ScmInfo(url("https://github.com/optics-dev/Monocle"), "scm:git:git@github.com:optics-dev/Monocle.git")
),
testFrameworks += new TestFramework("munit.Framework")
testFrameworks += new TestFramework("munit.Framework"),
Compile / doc / scalacOptions ++= {
if (!isDotty.value) Nil
else Seq("-source-links:github://optics-dev/Monocle", "-revision", revisionToUse.value)
}
)

lazy val catsVersion = "2.4.2"
Expand All @@ -104,15 +108,19 @@ def mimaSettings(module: String): Seq[Setting[_]] = Seq(

lazy val gitRev = sys.process.Process("git rev-parse HEAD").lineStream_!.head

def revisionToUse = Def.task {
val tag = (ThisBuild / version).value
if (isSnapshot.value) gitRev else tag
}

lazy val scalajsSettings = Seq(
scalacOptions ++= {
if (isDotty.value)
Seq.empty
else {
val tag = (ThisBuild / version).value
val s = if (isSnapshot.value) gitRev else tag
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/optics-dev/Monocle"
val s = revisionToUse.value
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/optics-dev/Monocle"
Seq(s"-P:scalajs:mapSourceURI:$a->$g/$s/")
}
},
Expand Down

0 comments on commit fb42b6e

Please sign in to comment.