All Projects → sbt → Sbt Unidoc

sbt / Sbt Unidoc

Licence: apache-2.0
sbt plugin to create a unified API document across projects

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Sbt Unidoc

Sbt Buildinfo
I know this because build.sbt knows this.
Stars: ✭ 486 (+330.09%)
Mutual labels:  sbt, sbt-plugin
Flyway Sbt
Flyway SBT plugin
Stars: ✭ 101 (-10.62%)
Mutual labels:  sbt, sbt-plugin
Sbt Release
A release plugin for sbt
Stars: ✭ 582 (+415.04%)
Mutual labels:  sbt, sbt-plugin
Soteria
Plugin to block compilation when unapproved dependencies are used or code styling does not comply.
Stars: ✭ 36 (-68.14%)
Mutual labels:  sbt, sbt-plugin
Sbt Frege
Frege support for sbt
Stars: ✭ 51 (-54.87%)
Mutual labels:  sbt, sbt-plugin
Xsbt Web Plugin
Servlet support for sbt
Stars: ✭ 381 (+237.17%)
Mutual labels:  sbt, sbt-plugin
Sbt Docker
Create Docker images directly from sbt
Stars: ✭ 689 (+509.73%)
Mutual labels:  sbt, sbt-plugin
sbt-jni
SBT Plugin to ease working with JNI
Stars: ✭ 110 (-2.65%)
Mutual labels:  sbt, sbt-plugin
Sbt Multi Jvm
Multi-JVM testing in sbt
Stars: ✭ 50 (-55.75%)
Mutual labels:  sbt, sbt-plugin
Sbt Play Gulp
Gulp asset pipeline for Play Framework
Stars: ✭ 38 (-66.37%)
Mutual labels:  sbt, sbt-plugin
sbt-assembly
Deploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
Stars: ✭ 1,801 (+1493.81%)
Mutual labels:  sbt, sbt-plugin
Sbt S3 Resolver
☁️Amazon S3-based resolver for sbt
Stars: ✭ 112 (-0.88%)
Mutual labels:  sbt, sbt-plugin
sbt-publish-more
📤 Publish artifacts to more than one repository
Stars: ✭ 21 (-81.42%)
Mutual labels:  sbt, sbt-plugin
Sbt Dependency Graph
sbt plugin to create a dependency graph for your project
Stars: ✭ 1,223 (+982.3%)
Mutual labels:  sbt, sbt-plugin
sbt-hepek
Sbt plugin for rendering Scala objects to files. And more!
Stars: ✭ 17 (-84.96%)
Mutual labels:  sbt, sbt-plugin
Sbt Updates
sbt plugin that can check Maven and Ivy repositories for dependency updates
Stars: ✭ 653 (+477.88%)
Mutual labels:  sbt, sbt-plugin
sbt-ammonite-classpath
Export the classpath for Ammonite and Almond
Stars: ✭ 29 (-74.34%)
Mutual labels:  sbt, sbt-plugin
sbt-ecr
An SBT plugin for managing Docker images within Amazon ECR.
Stars: ✭ 52 (-53.98%)
Mutual labels:  sbt, sbt-plugin
Sbt Ignore Play Generated
Configure linters and coverage tools to ignore Play's generated source files.
Stars: ✭ 10 (-91.15%)
Mutual labels:  sbt, sbt-plugin
Sbt Native Packager
sbt Native Packager
Stars: ✭ 1,480 (+1209.73%)
Mutual labels:  sbt, sbt-plugin

sbt-unidoc

sbt plugin to unify scaladoc/javadoc across multiple projects.

how to add this plugin

For sbt 0.13 and sbt 1.x add the following to your project/unidoc.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")

how to unify scaladoc

  1. Enable ScalaUnidocPlugin in your root project's settings.

Note: If one of your subprojects is defining def macros, add scalacOptions in (ScalaUnidoc, unidoc) += "-Ymacro-expand:none" to the root project's setting to temporary halt the macro expansion.

Here's an example setup using multi-project build.sbt:

val commonSettings = Seq(
    organization := "com.example",
    version := "0.1-SNAPSHOT",
    scalaVersion := "2.10.3",
    autoAPIMappings := true
  )

val library = (project in file("library")).
  settings(commonSettings: _*).
  settings(
    name := "foo-library"
  )

val app = (project in file("app")).
  settings(commonSettings: _*).
  settings(
    name := "foo-app"
  ).
  dependsOn(library)

val root = (project in file(".")).
  settings(commonSettings: _*).
  enablePlugins(ScalaUnidocPlugin).
  settings(
    name := "foo"
  ).
  aggregate(library, app)

From the root project, run unidoc task:

foo> unidoc
...
[info] Generating Scala API documentation for main sources to /unidoc-sample/target/scala-2.10/unidoc...
[info] Scala API documentation generation successful.
[success] Total time: 10 s, completed May 16, 2013 12:57:10 AM

A Scala unidoc is created under crossTarget / "unidoc" containing entities from all projects under the build.

how to exclude a project

  1. Construct unidocProjectFilter in (ScalaUnidoc, unidoc) in the root project's settings.
val root = (project in file(".")).
  settings(commonSettings: _*).
  enablePlugins(ScalaUnidocPlugin).
  settings(
    name := "foo",
    unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(app)
  ).
  aggregate(library, app)

This will skip Scaladoc for the app project.

how to include multiple configurations

  1. Construct unidocConfigurationFilter in (ScalaUnidoc, unidoc) in the root project's settings.
val root = (project in file(".")).
  settings(commonSettings: _*).
  enablePlugins(ScalaUnidocPlugin).
  settings(
    name := "foo",
    unidocConfigurationFilter in (TestScalaUnidoc, unidoc) := inConfigurations(Compile, Test)
  ).
  aggregate(library, app)

Running test:unidoc will now create unidoc including both Compile and Test configuration.

how to publish Scala unidoc to Github Pages

Add sbt-site and sbt-ghpages to your project/site.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")

Then in build.sbt import GitKeys,

import com.typesafe.sbt.SbtGit.GitKeys._

Add mappings in packageDoc in ScalaUnidoc to the site's mapping:

val root = (project in file(".")).
  settings(commonSettings: _*).
  enablePlugins(ScalaUnidocPlugin, GhpagesPlugin).
  settings(
    name := "foo",
    siteSubdirName in ScalaUnidoc := "latest/api",
    addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
    gitRemoteRepo := "[email protected]:user/foo.git"
  ).
  aggregate(library, app)

Here's how to preview and publish it:

foo> previewSite
foo> ghpagesPushSite

how to unify javadoc

  1. Enable GenJavadocPlugin in child projects.
  2. Enable JavaUnidocPlugin in the root project.
val commonSettings = Seq(
    organization := "com.example",
    version := "0.1-SNAPSHOT",
    scalaVersion := "2.10.3",
    autoAPIMappings := true
)

val library = (project in file("library")).
  settings(commonSettings: _*).
  enablePlugins(GenJavadocPlugin).
  settings(
    name := "foo-library"
  )

val app = (project in file("app")).
  settings(commonSettings: _*).
  enablePlugins(GenJavadocPlugin).
  settings(
    name := "foo-app"
  ).
  dependsOn(library)

val root = (project in file(".")).
  settings(commonSettings: _*).
  enablePlugins(JavaUnidocPlugin).
  settings(
    name := "foo"
  ).
  aggregate(library, app)

GenJavadocPlugin adds a compiler plugin called genjavadoc, which generates Java source code into target/java from Scala source code, so javadoc can be generated. The main benefits of javadoc are having natural documentation for Java API, IDE support, and Java enum support. However, the genjavadoc does not always generate compilable Java code; if you see misbehavior please open an issue with genjavadoc.

First clean all projects (in the above, root aggreates both children), then run unidoc task from the root project:

foo> clean
[success] Total time: 0 s, completed May 16, 2013 1:13:55 AM
foo> unidoc
[info] Compiling 10 Scala sources ...
[info] Generating Java API documentation for main sources to /unidoc-sample/target/javaunidoc...
[warn] Loading source file /unidoc-sample/app/target/java/foo/App$.java...
....
[info] Java API documentation generation successful.
[success] Total time: 1 s, completed May 16, 2013 1:14:12 AM

Cleaning is necessary since genjavadoc does not track the correspondence between Scala sources and emitted Java files, leading to extraneous Java sources when deleting classes. A Java unidoc is created under target/javaunidoc containing entities from all projects under the build.

how to publish genjavadoc instead of scaladoc

  1. Enable PublishJavadocPlugin in child projects.

This will substitute the packageDoc in Compile with packageDoc in Genjavadoc to use the enhanced Javadoc.

how to unify both Scaladoc and Javadoc

  1. Enable GenJavadocPlugin (or PublishJavadocPlugin) in child projects.
  2. Enable ScalaUnidocPlugin and JavaUnidocPlugin in the root project.

This combines both Scala unidoc settings and Java unidoc settings. Run unidoc from the root project to execute both.

credits

The original implementation of unidoc task was written by Peter Vlugter (@pvlugter) for Akka project. I took Unidoc.scala in akka/[email protected] and refactored it. sbt-unidoc is Open Source and available under the Apache 2 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].