scala - Disable sbt subproject doc generation -
i have multi-project scala build in sbt, in have root project aggregates 2 subprojects: macro library , core library uses macro library.
i'm using excellent sbt-unidoc
plugin create single, unified scaladoc
api entire library (macro + core combined).
unfortunately, sbt-unidoc
has limitations. instance, default, not hook doc
task, , output placed in target directory's unidoc
folder, instead of api
folder. combined, these prevent resulting documentation being generated , packaged when executing publish
or publishlocal
commands. fortunately (and an issue raised inkytonic
on sbt-unidoc
github site), there's simple solution this:
lazy val customunidocsettings = unidocsettings ++ seq ( doc in compile := (doc in scalaunidoc).value, target in unidoc in scalaunidoc := crosstarget.value / "api" )
these settings employed in root project:
lazy val macro = (project in file ("macro")). settings ( name = "foo-macro" ) lazy val core = (project in file ("core")). settings ( name = "foo-core" ). dependson (macro) lazy val root = (project in file (".")). settings (customunidocsettings: _*). settings ( name = "foo" ). aggregate (macro, core)
now, if execute sbt tasks doc
, publish
, publishlocal
, etc. root
project generate unified documentation 2 subprojects , unified documentation packaged during publication.
unfortunately, these same commands attempt generate individual subproject api documentation both macro
, core
subprojects - and, variety of reasons in particular case, these fail. not mention takes time generate documentation twice.
so, here's question: there simple way disable doc
task each subproject?
the approach i've been able discover far trick doc
thinking there no files embedded scaladoc. works, it's fudge rather real solution:
lazy val nodocfilesettings = seq ( sources in doc in compile := list() ) lazy val macro = (project in file ("macro")). settings (nodocfilesettings: _*). settings ( name = "foo-macro" ) lazy val core = (project in file ("core")). settings (nodocfilesettings: _*). settings ( name = "foo-core" ). dependson (macro)
any suggestions?
you can exactly want aggregate. in case
lazy val root = (project in file (".")). settings (customunidocsettings: _*). settings ( name = "foo", aggregate in doc := false ). aggregate (macro, core)
should work, believe.
Comments
Post a Comment