Skip to content

Commit

Permalink
Merge pull request #398 from armanbilge/issue/336
Browse files Browse the repository at this point in the history
Move GitHub-related settings to GitHub plugin
  • Loading branch information
armanbilge authored Oct 21, 2022
2 parents eb1c65c + 59ad691 commit cc38be3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@ object TypelevelGitHubPlugin extends AutoPlugin {
val tagOrHash =
GitHelper.getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value)
val userRepo = gitHubUserRepo.value
val infoOpt = scmInfo.value

if (tlIsScala3.value)
tagOrHash.toSeq flatMap { vh =>
userRepo.toSeq flatMap {
case (user, repo) => Seq(s"-source-links:github://${user}/${repo}", "-revision", vh)
}
}
else Nil // TODO move from settings plugin
else
tagOrHash.toSeq flatMap { vh =>
infoOpt.toSeq flatMap { info =>
val path = s"${info.browseUrl}/blob/${vh}€{FILE_PATH}.scala"
Seq("-doc-source-url", path)
}
}
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package org.typelevel.sbt

import com.github.sbt.git.GitPlugin
import com.github.sbt.git.SbtGit.git
import org.typelevel.sbt.kernel.GitHelper
import org.typelevel.sbt.kernel.V
import sbt._
import sbtcrossproject.CrossPlugin.autoImport._
Expand Down Expand Up @@ -191,19 +189,9 @@ object TypelevelSettingsPlugin extends AutoPlugin {
Seq("-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath)
},
Compile / doc / scalacOptions ++= {
val tagOrHash =
GitHelper.getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value)
val infoOpt = scmInfo.value

if (tlIsScala3.value)
Seq("-project-version", version.value)
else // TODO move to GitHub plugin
tagOrHash.toSeq flatMap { vh =>
infoOpt.toSeq flatMap { info =>
val path = s"${info.browseUrl}/blob/${vh}€{FILE_PATH}.scala"
Seq("-doc-source-url", path)
}
}
else Nil
},
javacOptions ++= Seq(
"-encoding",
Expand Down

0 comments on commit cc38be3

Please sign in to comment.