Skip to content

Commit

Permalink
Enable -source-links for Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry authored Jan 26, 2023
1 parent 58c53f1 commit d7a4cf5
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ object GithubActionsScaladocSourceUrl extends AutoPlugin {
originalScalacOptions
}
},
Compile / doc / scalacOptions ++= {
if (scalaBinaryVersion.value == "3") {
for {
repositoryBuilder <- GitPlugin.gitRepositoryBuilder.?.value
workTree <- GitPlugin.gitWorkTree.value
slug <- GithubActionsEnvironmentVariables.githubRepository.?.value
} yield {
val repository = repositoryBuilder.build()
try {
val hash = repository.resolve(Constants.HEAD).name
raw"-source-links:$workTree=github://$slug/$hash"
} finally {
repository.close()
}
}
} else {
None
}
},
scalacOptions in Compile in doc := {
val originalScalacOptions = (scalacOptions in Compile in doc).value
(GitPlugin.gitRepositoryBuilder.?.value, GithubActionsEnvironmentVariables.githubRepository.?.value) match {
Expand Down

0 comments on commit d7a4cf5

Please sign in to comment.