-
Notifications
You must be signed in to change notification settings - Fork 32
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
genjavadoc should be plugged into scaladoc, not scalac #66
Comments
Actually, I just had a look at the genjavadoc plugin - it does a separate invocation of scalac to run, so it's not run as part of a normal compile. So it seems Akka needlessly disables it. Though, plugging into scaladoc rather than scalac would still be interesting, as it would mean doing a full build including java/scala docs for a project would only invoke the scala compiler twice, rather than 3 times. |
Well, I was wrong about genjavadoc plugin doing a separate invocation of scalac, but here's the configuration required to make it do a separate invocation of scalac: object Unidoc extends AutoPlugin {
lazy val GenjavadocCompilerPlugin = config("genjavadocplugin") hide
override def trigger = allRequirements
override def requires = plugins.JvmPlugin
override def projectConfigurations: Seq[Configuration] = Seq(Genjavadoc)
override lazy val projectSettings = inConfig(Genjavadoc)(Defaults.configSettings) ++ Seq(
ivyConfigurations += GenjavadocCompilerPlugin,
libraryDependencies += "com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.9" % "genjavadocplugin->default(compile)" cross CrossVersion.full,
scalacOptions in Genjavadoc ++= Seq(
"-P:genjavadoc:out=" + (target.value / "java"),
"-P:genjavadoc:fabricateParams=false"
),
scalacOptions in Genjavadoc ++=
update.value.matching(configurationFilter(GenjavadocCompilerPlugin.name)).filter(_.getName.contains("genjavadoc"))
.map("-Xplugin:" + _.getAbsolutePath),
sources in Genjavadoc := (sources in Compile).value,
dependencyClasspath in Genjavadoc := (dependencyClasspath in Compile).value
)
} Using the above, javadocs are only evaluated by Most of the code there is actually working around the fact that genjavadoc does not support an enabled flag, so that it can be disabled in compile and test. Instead, we have to manually add the plugin to just the Genjavadoc scope, instead of using sbt's built in auto compiler plugin support. |
I don't know if this is possible, but given the overhead of running
genjavadoc
on every compile (which I don't know much about, but it's enough to warrant the Akka team having it turned off by default), then it seems plugging in to scalac is not the right thing to do. Rather, it would make a lot more sense to plug into scaladoc, because your most likely to want to generate the javadoc when you run scaladac. Theoretically, since scaladoc uses scalac, this should be possible.The text was updated successfully, but these errors were encountered: