Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unidoc in the presence of macro's #2484

Merged
merged 1 commit into from Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Expand Up @@ -56,8 +56,10 @@ lazy val root = Project(
.enablePlugins(UnidocRoot, NoPublish, DeployRsync, AggregatePRValidation)
.disablePlugins(BintrayPlugin, MimaPlugin)
.settings(
// Unidoc doesn't like macros
unidocProjectExcludes := Seq(parsing, httpJmhBench),
// Unidoc doesn't like macro definitions
unidocProjectExcludes := Seq(parsing),
// Support applying macros in unidoc:
scalaMacroSupport,
unmanagedSources in (Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get,
deployRsyncArtifact := {
val unidocArtifacts = (unidoc in Compile).value
Expand Down
17 changes: 13 additions & 4 deletions project/Doc.scala
Expand Up @@ -31,7 +31,15 @@ object Scaladoc extends AutoPlugin {

override lazy val projectSettings =
inTask(doc)(Seq(
scalacOptions in Compile ++= scaladocOptions(version.value, (baseDirectory in ThisBuild).value),
scalacOptions in Compile ++=
scaladocOptions(
version.value,
(baseDirectory in ThisBuild).value,
libraryDependencies.value
.filter(_.configurations.contains("plugin->default(compile)"))
// Can we get the from the classpath somehow?
.map(module => file(s"~/.ivy2/cache/${module.organization}/${module.name}_${scalaVersion.value}/jars/${module.name}_${scalaVersion.value}-${module.revision}.jar"))
),
autoAPIMappings := CliOptions.scaladocAutoAPI.get
)) ++
Seq(validateDiagrams in Compile := true) ++
Expand All @@ -49,16 +57,17 @@ object Scaladoc extends AutoPlugin {
publishArtifact in (Compile, packageDoc) := scalaVersion.value != "2.13.0-M5"
)

def scaladocOptions(ver: String, base: File): List[String] = {
def scaladocOptions(ver: String, base: File, plugins: Seq[File]): List[String] = {
val urlString = GitHub.url(ver) + "/€{FILE_PATH}.scala"
val opts = List(
"-implicits",
"-groups",
"-doc-source-url", urlString,
"-sourcepath", base.getAbsolutePath,
// Workaround https://issues.scala-lang.org/browse/SI-10028
"-skip-packages", "akka.pattern:org.specs2"
)
"-skip-packages", "akka.pattern:org.specs2",
) ++
plugins.map(plugin => "-Xplugin:" + plugin)
CliOptions.scaladocDiagramsEnabled.ifTrue("-diagrams").toList ::: opts
}

Expand Down