├── .github ├── dependabot.yml └── workflows │ ├── ci.yml │ └── release.yml ├── .gitignore ├── .java-version ├── LICENSE ├── README.md ├── build.sbt ├── notes ├── 0.1.0.markdown ├── 0.1.1.markdown ├── 0.1.2.markdown ├── 0.2.0.markdown ├── 0.3.0.markdown ├── 0.3.1.markdown ├── 0.3.2.markdown ├── 0.3.3.markdown ├── 0.4.0.markdown ├── 0.4.1.markdown └── about.markdown ├── project ├── build.properties └── plugins.sbt └── src ├── main └── scala │ └── sbtunidoc │ ├── BaseUnidocPlugin.scala │ ├── GenJavadocKeys.scala │ ├── GenJavadocPlugin.scala │ ├── JavaUnidocPlugin.scala │ ├── PublishJavadocPlugin.scala │ ├── ScalaUnidocPlugin.scala │ ├── Unidoc.scala │ └── UnidocKeys.scala └── sbt-test └── unidoc ├── java-unidoc ├── a │ └── A.scala ├── b │ └── B.scala ├── build.sbt ├── c │ └── C.scala ├── project │ └── plugin.sbt └── test ├── scala-unidoc ├── a │ └── A.scala ├── b │ └── B.scala ├── build.sbt ├── c │ └── C.scala ├── project │ └── plugin.sbt └── test └── scala3-unidoc ├── a └── A.scala ├── b └── B.scala ├── build.sbt ├── c └── C.scala ├── project └── plugin.sbt └── test /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test: 10 | name: Test 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | include: 15 | - scala-version: '2.12.17' 16 | sbt-version: '1.5.5' 17 | java-version: 8 18 | - scala-version: '2.12.17' 19 | sbt-version: '1.5.5' 20 | java-version: 11 21 | - scala-version: '2.12.17' 22 | sbt-version: '1.5.5' 23 | java-version: 17 24 | 25 | steps: 26 | - name: Checkout current branch 27 | uses: actions/checkout@v4 28 | - name: Setup java 29 | uses: actions/setup-java@v4 30 | with: 31 | distribution: 'temurin' 32 | java-version: ${{ matrix.java-version }} 33 | - uses: sbt/setup-sbt@v1 34 | - name: Test 35 | env: 36 | SCALA_VERSION: ${{ matrix.scala-version }} 37 | SBT_VERSION: ${{ matrix.sbt-version }} 38 | run: sbt "++${SCALA_VERSION}" "^^${SBT_VERSION}" test scripted 39 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | tags: ["*"] 5 | jobs: 6 | publish: 7 | runs-on: ubuntu-20.04 8 | steps: 9 | - uses: actions/checkout@v4 10 | with: 11 | fetch-depth: 0 12 | - uses: actions/setup-java@v4 13 | with: 14 | distribution: 'temurin' 15 | java-version: 8 16 | - uses: sbt/setup-sbt@v1 17 | - run: sbt ci-release 18 | env: 19 | PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} 20 | PGP_SECRET: ${{ secrets.PGP_SECRET }} 21 | SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 22 | SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings/ 4 | /project/project/ 5 | target 6 | .bsp/ 7 | .DS_Store 8 | .idea/ 9 | .metals/ 10 | .vscode/ 11 | -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 1.8 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | sbt-unidoc 2 | ========== 3 | 4 | sbt plugin to unify scaladoc/javadoc across multiple projects. 5 | 6 | how to add this plugin 7 | ---------------------- 8 | 9 | For sbt 1.x (requires sbt 1.5.x and above) add the following to your `project/plugins.sbt`: 10 | 11 | ```scala 12 | addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") 13 | ``` 14 | 15 | **Note**: We changed the organization from `"com.eed3si9n"` to `"com.github.sbt"`. 16 | 17 | For older sbt 1.x and sbt 0.13 add the following to your `project/plugins.sbt`: 18 | 19 | ```scala 20 | addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3") 21 | ``` 22 | 23 | how to unify scaladoc 24 | --------------------- 25 | 26 | 1. Enable `ScalaUnidocPlugin` in your root project's settings. 27 | 28 | 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. 29 | 30 | Here's an example setup using multi-project build.sbt: 31 | 32 | ```scala 33 | ThisBuild / organization := "com.example" 34 | ThisBuild / version := "0.1-SNAPSHOT" 35 | ThisBuild / scalaVersion := "2.12.15" 36 | ThisBuild / autoAPIMappings := true 37 | 38 | val library = (project in file("library")) 39 | .settings( 40 | name := "foo-library" 41 | ) 42 | 43 | val app = (project in file("app")) 44 | .dependsOn(library) 45 | .settings( 46 | name := "foo-app" 47 | ) 48 | 49 | val root = (project in file(".")) 50 | .enablePlugins(ScalaUnidocPlugin) 51 | .aggregate(library, app) 52 | .settings( 53 | name := "foo" 54 | ) 55 | ``` 56 | 57 | From the root project, run `unidoc` task: 58 | 59 | ``` 60 | foo> unidoc 61 | ... 62 | [info] Generating Scala API documentation for main sources to /unidoc-sample/target/scala-2.10/unidoc... 63 | [info] Scala API documentation generation successful. 64 | [success] Total time: 10 s, completed May 16, 2013 12:57:10 AM 65 | ``` 66 | 67 | A Scala unidoc is created under `crossTarget / "unidoc"` containing entities from all projects under the build. 68 | 69 | how to exclude a project 70 | ------------------------ 71 | 72 | 1. Construct `ScalaUnidoc / unidoc / unidocProjectFilter` in the root project's settings. 73 | 74 | ```scala 75 | val root = (project in file(".")) 76 | .enablePlugins(ScalaUnidocPlugin) 77 | .aggregate(library, app) 78 | .settings( 79 | name := "foo", 80 | ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(app) 81 | ) 82 | ``` 83 | 84 | This will skip Scaladoc for the app project. 85 | 86 | how to include multiple configurations 87 | -------------------------------------- 88 | 89 | 1. Construct `ScalaUnidoc / unidoc / unidocConfigurationFilter` in the root project's settings. 90 | 91 | ```scala 92 | val root = (project in file(".")) 93 | .enablePlugins(ScalaUnidocPlugin) 94 | .aggregate(library, app) 95 | .settings( 96 | name := "foo", 97 | TestScalaUnidoc / unidoc / unidocConfigurationFilter := inConfigurations(Compile, Test) 98 | ) 99 | ``` 100 | 101 | Running `test:unidoc` will now create unidoc including both `Compile` and `Test` configuration. 102 | 103 | how to publish Scala unidoc to Github Pages 104 | ------------------------------------------- 105 | 106 | Add sbt-site and sbt-ghpages to your `project/site.sbt`: 107 | 108 | ```scala 109 | addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2") 110 | 111 | addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2") 112 | ``` 113 | 114 | Then in `build.sbt` import `GitKeys`, 115 | 116 | ```scala 117 | import com.typesafe.sbt.SbtGit.GitKeys._ 118 | ``` 119 | 120 | Add `ScalaUnidoc / packageDoc / mappings` to the site's mapping: 121 | 122 | ```scala 123 | val root = (project in file(".")) 124 | .enablePlugins(ScalaUnidocPlugin, GhpagesPlugin) 125 | .aggregate(library, app) 126 | .settings( 127 | name := "foo", 128 | ScalaUnidoc / siteSubdirName := "latest/api", 129 | addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, ScalaUnidoc / siteSubdirName), 130 | gitRemoteRepo := "git@github.com:user/foo.git" 131 | ) 132 | ``` 133 | 134 | Here's how to preview and publish it: 135 | 136 | ``` 137 | foo> previewSite 138 | foo> ghpagesPushSite 139 | ``` 140 | 141 | how to unify javadoc 142 | -------------------- 143 | 144 | 1. Enable `GenJavadocPlugin` in child projects. 145 | 2. Enable `JavaUnidocPlugin` in the root project. 146 | 147 | ```scala 148 | ThisBuild / organization := "com.example" 149 | ThisBuild / version := "0.1-SNAPSHOT" 150 | ThisBuild / scalaVersion := scalaVersion := "2.12.15" 151 | ThisBuild / autoAPIMappings := true 152 | 153 | val library = (project in file("library")) 154 | .enablePlugins(GenJavadocPlugin) 155 | .settings( 156 | name := "foo-library" 157 | ) 158 | 159 | val app = (project in file("app")) 160 | .enablePlugins(GenJavadocPlugin) 161 | .dependsOn(library) 162 | .settings( 163 | name := "foo-app" 164 | ) 165 | 166 | val root = (project in file(".")) 167 | .enablePlugins(JavaUnidocPlugin) 168 | .aggregate(library, app) 169 | .settings( 170 | name := "foo" 171 | ) 172 | ``` 173 | 174 | `GenJavadocPlugin` adds a compiler plugin called [genjavadoc][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`. 175 | 176 | First `clean` all projects (in the above, root aggreates both children), then run `unidoc` task from the root project: 177 | 178 | ``` 179 | foo> clean 180 | [success] Total time: 0 s, completed May 16, 2013 1:13:55 AM 181 | foo> unidoc 182 | [info] Compiling 10 Scala sources ... 183 | [info] Generating Java API documentation for main sources to /unidoc-sample/target/javaunidoc... 184 | [warn] Loading source file /unidoc-sample/app/target/java/foo/App$.java... 185 | .... 186 | [info] Java API documentation generation successful. 187 | [success] Total time: 1 s, completed May 16, 2013 1:14:12 AM 188 | ``` 189 | 190 | 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. 191 | A Java unidoc is created under `target/javaunidoc` containing entities from all projects under the build. 192 | 193 | how to publish genjavadoc instead of scaladoc 194 | --------------------------------------------- 195 | 196 | 1. Enable `PublishJavadocPlugin` in child projects. 197 | 198 | This will substitute the `Compile / packageDoc` with `Genjavadoc / packageDoc` to use the enhanced Javadoc. 199 | 200 | how to unify both Scaladoc and Javadoc 201 | -------------------------------------- 202 | 203 | 1. Enable `GenJavadocPlugin` (or `PublishJavadocPlugin`) in child projects. 204 | 2. Enable `ScalaUnidocPlugin` and `JavaUnidocPlugin` in the root project. 205 | 206 | This combines both Scala unidoc settings and Java unidoc settings. Run `unidoc` from the root project to execute both. 207 | 208 | credits 209 | ------- 210 | 211 | The original implementation of `unidoc` task was written by Peter Vlugter ([@pvlugter](https://github.com/pvlugter)) for Akka project. I took [Unidoc.scala](https://github.com/akka/akka/blob/05ba6df5acf48eaf447b5898787e63badbe02cf9/project/Unidoc.scala) in akka/akka@ed40dff7d7353c5cb15b7408ec049116081cb1fc and refactored it. sbt-unidoc is Open Source and available under the Apache 2 License. 212 | 213 | [genjavadoc]: https://github.com/typesafehub/genjavadoc 214 | -------------------------------------------------------------------------------- /build.sbt: -------------------------------------------------------------------------------- 1 | ThisBuild / scalaVersion := "2.12.17" 2 | ThisBuild / version := { 3 | val orig = (ThisBuild / version).value 4 | if (orig.endsWith("-SNAPSHOT")) "0.5.0-SNAPSHOT" 5 | else orig 6 | } 7 | 8 | lazy val root = (project in file(".")) 9 | .enablePlugins(SbtPlugin) 10 | .settings( 11 | name := "sbt-unidoc", 12 | scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Dplugin.version=" + version.value), 13 | scriptedBufferLog := false, 14 | // sbt-unidoc requires sbt 1.5.0 and up 15 | pluginCrossBuild / sbtVersion := "1.5.0", 16 | ) 17 | 18 | Global / onChangedBuildSource := ReloadOnSourceChanges 19 | ThisBuild / description := "sbt plugin to create a unified API document across projects" 20 | ThisBuild / organization := "com.github.sbt" 21 | ThisBuild / homepage := Some(url("https://github.com/sbt/sbt-unidoc")) 22 | ThisBuild / Compile / scalacOptions := Seq("-feature", "-deprecation", "-Xlint") 23 | ThisBuild / licenses := List("Apache License v2" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")) 24 | ThisBuild / developers := List( 25 | Developer( 26 | "eed3si9n", 27 | "Eugene Yokota", 28 | "@eed3si9n", 29 | url("https://github.com/eed3si9n") 30 | ) 31 | ) 32 | ThisBuild / pomIncludeRepository := { _ => 33 | false 34 | } 35 | ThisBuild / publishTo := { 36 | val nexus = "https://oss.sonatype.org/" 37 | if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots") 38 | else Some("releases" at nexus + "service/local/staging/deploy/maven2") 39 | } 40 | ThisBuild / publishMavenStyle := true 41 | ThisBuild / dynverSonatypeSnapshots := true 42 | -------------------------------------------------------------------------------- /notes/0.1.0.markdown: -------------------------------------------------------------------------------- 1 | This is the initial release of [sbt-unidoc](https://github.com/sbt/sbt-unidoc). 2 | 3 | The original implementation of `unidoc` command was written by [@pvlugter](https://github.com/pvlugter) for Akka's build definition. [@eed3si9n](https://github.com/eed3si9n) turned it into a plugin, and refactored it some more. 4 | 5 | The basic use case of sbt-unidoc is to unify Scaladoc generation across all projects in a build. This is useful for builds that modularizes its parts into subprojects like Akka. After setting it up, you just run `unidoc` task from the root project. 6 | 7 | Another interesting use case is to unify Javadoc generation, except plain Javadoc won't know your Scala code. So they wrote [a compiler plugin](https://github.com/typesafehub/genjavadoc) that generates Scala-equivalent Java code, so you can generate Javadoc. See [sbt-unidoc](https://github.com/sbt/sbt-unidoc) for the details. 8 | -------------------------------------------------------------------------------- /notes/0.1.1.markdown: -------------------------------------------------------------------------------- 1 | ## minor enhancements 2 | 3 | - Exposed `scalacOptions in unidoc` and `javacOptions in unidoc` for easier rewiring. 4 | -------------------------------------------------------------------------------- /notes/0.1.2.markdown: -------------------------------------------------------------------------------- 1 | ## minor enhancements 2 | 3 | - Adding `Defaults.configSettings` to make easy integration with sbt-site. 4 | -------------------------------------------------------------------------------- /notes/0.2.0.markdown: -------------------------------------------------------------------------------- 1 | ## for sbt 0.13 2 | 3 | Adjusted `unidoc` task dependencies to keep up with the changes that were made to `doc` task in sbt 0.13. 4 | -------------------------------------------------------------------------------- /notes/0.3.0.markdown: -------------------------------------------------------------------------------- 1 | [1]: http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Tasks.html#getting-values-from-multiple-scopes 2 | [@inkytonik]: https://github.com/inkytonik 3 | [2]: https://github.com/sbt/sbt-unidoc/issues/2 4 | 5 | ## ScopeFilter support 6 | 7 | Previous releases of sbt-unidoc were hardcoded to `Compile` configuration. By using [ScopeFilter feature][1] added in sbt 0.13, sbt-unidoc 0.3.0 is able to unify Scaladocs from arbiterary projects and configurations. For instance, to exclude a project: 8 | 9 | unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(typelevel) 10 | 11 | or to use only given projects: 12 | 13 | unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(library, app) 14 | 15 | Out of the box, simply adding `unidocSettings` to the root project's setting would wire `unidoc` to `Compile` configuration and `test:unidoc` to `Test`. Here is how we can aggregate both `Compile` and `Test`: 16 | 17 | unidocConfigurationFilter in (TestScalaUnidoc, unidoc) := inConfigurations(Compile, Test) 18 | 19 | This feature was requested by [@inkytonik][@inkytonik] in [#2][2]. 20 | 21 | ### breaking changes 22 | 23 | String-based `excludedProjects` is now replaced with `unidocProjectFilter`. 24 | -------------------------------------------------------------------------------- /notes/0.3.1.markdown: -------------------------------------------------------------------------------- 1 | 2 | ## unidocGenjavadocVersion 3 | 4 | sbt-unidoc 0.3.1 updates the underlying [genjavadoc][1] compiler plugin to 0.7, which fixes [resource leakage][37]. 5 | 6 | It also adds a new key `unidocGenjavadocVersion` to make the setting configurable. The change was contributed by [@2m][2m] as [#4][4]. 7 | 8 | [1]: https://github.com/typesafehub/genjavadoc 9 | [2m]: https://github.com/2m 10 | [4]: https://github.com/sbt/sbt-unidoc/pull/4 11 | [37]: https://github.com/typesafehub/genjavadoc/pull/37 12 | -------------------------------------------------------------------------------- /notes/0.3.2.markdown: -------------------------------------------------------------------------------- 1 | [@travisbrown]: https://github.com/travisbrown 2 | [10]: https://github.com/sbt/sbt-unidoc/pull/10 3 | 4 | ## `apiMappings` and `autoAPIMappings` 5 | 6 | sbt-unidoc 0.3.2 fixes the handling of `apiMappings`. 7 | To use `autoAPIMappings`, turn it on in *all subprojects*, and the API mappings would be aggregated. 8 | The fix was contributed by [@travisbrown][@travisbrown] in [#10][10]. 9 | -------------------------------------------------------------------------------- /notes/0.3.3.markdown: -------------------------------------------------------------------------------- 1 | [@rkuhn]: https://github.com/rkuhn 2 | [13]: https://github.com/sbt/sbt-unidoc/pull/13 3 | 4 | ## Resolved edge case when generating java docs 5 | 6 | sbt-unidoc 0.3.3 fixes the unidoc task not properly forcing compilation 7 | before generating docs, thus missing generated sources (if there are any). 8 | The fix was contributed by [@rkuhn][@rkuhn] in [#13][13]. 9 | -------------------------------------------------------------------------------- /notes/0.4.0.markdown: -------------------------------------------------------------------------------- 1 | ## auto plugin 2 | 3 | [@nrinaudo][@nrinaudo] contributed migration to auto plugin in [#31][31]. 4 | 5 | Before: 6 | 7 | import UnidocKeys._ 8 | val root = (project in file(".")) 9 | .aggregate(library, app) 10 | .settings(commonSettings: _*) 11 | .settings(unidocSettings: _*) 12 | 13 | After: 14 | 15 | val root = (project in file(".")) 16 | .enablePlugins(ScalaUnidocPlugin) 17 | .aggregate(library, app) 18 | .settings(commonSettings: _*) 19 | 20 | [@nrinaudo]: https://github.com/nrinaudo 21 | [31]: https://github.com/sbt/sbt-unidoc/pull/31 22 | -------------------------------------------------------------------------------- /notes/0.4.1.markdown: -------------------------------------------------------------------------------- 1 | ## cross building for sbt 1.0 2 | 3 | sbt-unidoc is cross published to both sbt 0.13 and sbt 1.x. 4 | 5 | This was contributed by @liff in #38. To verify the PR, @xuwei-k contributed tests in #40 and #42. 6 | -------------------------------------------------------------------------------- /notes/about.markdown: -------------------------------------------------------------------------------- 1 | [sbt-unidoc](https://github.com/sbt/sbt-unidoc) is a plug-in for sbt that unifies scaladoc/javadoc across multiple projects. 2 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.10.11 2 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0") 2 | addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.3") 3 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/BaseUnidocPlugin.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt.Keys._ 4 | import sbt._ 5 | import sbt.plugins.JvmPlugin 6 | 7 | /** Provides default settings for unidoc plugins. 8 | * 9 | * There's no reason to enable this plugin directly. See [[ScalaUnidocPlugin]] or [[JavaUnidocPlugin]] instead. 10 | */ 11 | object BaseUnidocPlugin extends AutoPlugin { 12 | object autoImport extends UnidocKeys 13 | import autoImport._ 14 | 15 | override def projectSettings = Seq( 16 | Compile / unidoc := Seq.empty, 17 | Test / unidoc := Seq.empty 18 | ) 19 | 20 | override def requires = JvmPlugin 21 | 22 | def baseUnidocSettings(sc: Configuration): Seq[sbt.Def.Setting[_]] = Seq( 23 | doc := Unidoc(streams.value.cacheDirectory, (unidoc / compilers).value, (unidoc / sources).value, (unidoc / fullClasspath).value, 24 | (unidoc / scalacOptions).value, (unidoc / javacOptions).value, (unidoc / apiMappings).value, (unidoc / maxErrors).value, 25 | (unidoc / target).value, configuration.value, streams.value, (unidoc / sourcePositionMappers).value, fileConverter.value), 26 | unidoc / compilers := (sc / compilers).value, 27 | unidoc / sources := (unidoc / unidocAllSources).value.flatten.sortBy { _.getAbsolutePath }, 28 | unidoc / scalacOptions := (sc / doc / scalacOptions).value, 29 | unidoc / javacOptions := (sc / doc / javacOptions).value, 30 | unidoc / fullClasspath := (unidoc / unidocAllClasspaths).value.flatten.distinct.sortBy { _.data.getName }, 31 | unidoc / unidocAllClasspaths := allClasspathsTask.value, 32 | unidoc / apiMappings := { 33 | val all = (unidoc / unidocAllAPIMappings).value 34 | val allList = all map { _.toList } 35 | allList.flatten.distinct.toMap 36 | }, 37 | unidoc / unidocAllAPIMappings := allAPIMappingsTask.value, 38 | unidoc / maxErrors := (sc / doc / maxErrors).value, 39 | unidoc / unidocScopeFilter := ScopeFilter((unidoc / unidocProjectFilter).value, (unidoc / unidocConfigurationFilter).value), 40 | unidoc / unidocProjectFilter := inAnyProject, 41 | unidoc / unidocConfigurationFilter := inConfigurations(sc) 42 | ) 43 | 44 | lazy val allClasspathsTask = Def.taskDyn { 45 | val f = (unidoc / unidocScopeFilter).value 46 | dependencyClasspath.all(f) 47 | } 48 | lazy val allAPIMappingsTask = Def.taskDyn { 49 | val f = (unidoc / unidocScopeFilter).value 50 | (Compile / doc / apiMappings).all(f) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/GenJavadocKeys.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt.settingKey 4 | 5 | trait GenJavadocKeys { 6 | val unidocGenjavadocVersion = settingKey[String]("Version of the genjavadoc compiler plugin.") 7 | } 8 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/GenJavadocPlugin.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt._ 4 | import sbt.Keys._ 5 | import sbt.plugins.JvmPlugin 6 | 7 | object GenJavadocPlugin extends AutoPlugin { 8 | object autoImport extends GenJavadocKeys { 9 | lazy val Genjavadoc = config("genjavadoc") extend Compile 10 | } 11 | import autoImport._ 12 | 13 | override def globalSettings = unidocGenjavadocVersion := "0.18" 14 | 15 | override def requires = JvmPlugin 16 | 17 | override def projectSettings = Seq( 18 | libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % unidocGenjavadocVersion.value cross CrossVersion.full), 19 | scalacOptions += ("-P:genjavadoc:out=" + (target.value / "java"))) 20 | } 21 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/JavaUnidocPlugin.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt._ 4 | import Keys._ 5 | import BaseUnidocPlugin.autoImport._ 6 | 7 | /** Generates unified javadoc documentation. 8 | * 9 | * This plugin must be enabled on the aggregating project. Children projects must enable [[GenJavadocPlugin]]. 10 | */ 11 | object JavaUnidocPlugin extends AutoPlugin { 12 | object autoImport { 13 | lazy val JavaUnidoc = config("javaunidoc") extend Compile 14 | lazy val TestJavaUnidoc = config("testjavaunidoc") extend Test 15 | } 16 | 17 | import autoImport._ 18 | 19 | override def requires = BaseUnidocPlugin 20 | 21 | override def projectSettings = 22 | javaUnidocTask(JavaUnidoc, Compile) ++ 23 | javaUnidocTask(TestJavaUnidoc, Test) ++ 24 | inConfig(TestJavaUnidoc)(Seq( 25 | unidoc/ target := target.value / "testjavaunidoc" 26 | )) 27 | 28 | def javaUnidocTask(c: Configuration, sc: Configuration): Seq[sbt.Def.Setting[_]] = 29 | inConfig(c)(Defaults.configSettings ++ baseJavaUnidocTasks(sc)) ++ Seq( 30 | sc / unidoc ++= Seq((c / doc).value) 31 | ) 32 | 33 | def baseJavaUnidocTasks(sc: Configuration): Seq[sbt.Def.Setting[_]] = BaseUnidocPlugin.baseUnidocSettings(sc) ++ Seq( 34 | unidoc / target := target.value / "javaunidoc", 35 | unidoc / unidocAllSources := allJavaSourcesTask.value 36 | ) 37 | 38 | lazy val javaSources: sbt.Def.Initialize[Task[Seq[File]]] = Def.task { 39 | val compiled = compile.value 40 | val sourceJavaFiles = sources.value filter {_.getName endsWith ".java"} 41 | val targetJavaFiles: Seq[File] = (target.value / "java" ** "*.java").get().sorted 42 | sourceJavaFiles ++ targetJavaFiles 43 | } 44 | 45 | lazy val allJavaSourcesTask = Def.taskDyn { 46 | val f = (unidoc / unidocScopeFilter).value 47 | javaSources.all(f) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/PublishJavadocPlugin.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt._ 4 | import sbt.Keys._ 5 | 6 | /** Publishes javadoc artifacts rather than scaladoc ones. */ 7 | object PublishJavadocPlugin extends AutoPlugin { 8 | override def requires = GenJavadocPlugin 9 | 10 | override def projectSettings = genjavadocExtraTask(GenJavadocPlugin.autoImport.Genjavadoc, Compile) 11 | 12 | def genjavadocExtraTask(c: Configuration, sc: Configuration): Seq[sbt.Def.Setting[_]] = 13 | inConfig(c)(Defaults.configSettings ++ baseGenjavadocExtraTasks(sc)) ++ Seq( 14 | sc / packageDoc := (c / packageDoc).value 15 | ) 16 | 17 | def baseGenjavadocExtraTasks(sc: Configuration): Seq[sbt.Def.Setting[_]] = Seq( 18 | packageDoc / artifactName := { (sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar" }, 19 | sources := { 20 | (sc / compile).value 21 | (target.value / "java" ** "*.java").get() ++ (sc / sources).value.filter(_.getName.endsWith(".java")) 22 | }, 23 | doc / javacOptions := (sc / doc / javacOptions).value 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/ScalaUnidocPlugin.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt._ 4 | import Keys._ 5 | import BaseUnidocPlugin.autoImport._ 6 | 7 | /** Generates unified scaladoc documentation. */ 8 | object ScalaUnidocPlugin extends AutoPlugin { 9 | override def requires = BaseUnidocPlugin 10 | 11 | object autoImport { 12 | lazy val ScalaUnidoc = config("scalaunidoc") extend Compile 13 | lazy val TestScalaUnidoc = config("testscalaunidoc") extend Test 14 | } 15 | import autoImport._ 16 | 17 | override def projectSettings = 18 | scalaUnidocTask(ScalaUnidoc, Compile) ++ 19 | scalaUnidocTask(TestScalaUnidoc, Test) ++ 20 | inConfig(TestScalaUnidoc)(Seq( 21 | unidoc / target := crossTarget.value / "testunidoc" 22 | )) 23 | 24 | def scalaUnidocTask(c: Configuration, sc: Configuration): Seq[sbt.Def.Setting[_]] = 25 | inConfig(c)(Defaults.configSettings ++ baseScalaUnidocTasks(sc)) ++ Seq( 26 | sc / unidoc ++= Seq((c / doc).value) 27 | ) 28 | 29 | def baseScalaUnidocTasks(sc: Configuration): Seq[sbt.Def.Setting[_]] = BaseUnidocPlugin.baseUnidocSettings(sc) ++ Seq( 30 | unidoc / target := crossTarget.value / "unidoc", 31 | unidoc / unidocAllSources := allScalaSources.value 32 | ) 33 | 34 | lazy val allScalaSources = Def.taskDyn { 35 | val f = (unidoc / unidocScopeFilter).value 36 | if(ScalaArtifacts.isScala3(scalaVersion.value)) { 37 | tastyFiles.all(f) // Since Scaladoc 3 works on TASTy files 38 | } else { 39 | sources.all(f) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/Unidoc.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt._ 4 | import sbt.Keys._ 5 | import sbt.internal.inc.{AnalyzingCompiler, ManagedLoggedReporter} 6 | import sbt.internal.util.Attributed.data 7 | import xsbti.compile.{Compilers, IncToolOptionsUtil} 8 | import xsbti.{FileConverter, Reporter} 9 | 10 | object Unidoc { 11 | import java.io.PrintWriter 12 | 13 | // This is straight out of docTaskSettings in Defaults.scala. 14 | def apply(cache: File, cs: Compilers, srcs: Seq[File], cp: Classpath, 15 | sOpts: Seq[String], jOpts: Seq[String], xapis: Map[File, URL], maxErrors: Int, 16 | out: File, config: Configuration, s: TaskStreams, spm: Seq[xsbti.Position => Option[xsbti.Position]], converter: FileConverter): File = { 17 | val hasScala = srcs.exists(_.name.endsWith(".scala")) || 18 | srcs.exists(_.name.endsWith(".tasty")) || // Condition for Scaladoc 3 19 | sOpts.contains("-siteroot") // Condition for Scaladoc 3 20 | val hasJava = srcs.exists(_.name.endsWith(".java")) 21 | val label = nameForSrc(config.name) 22 | val reporter = new ManagedLoggedReporter( 23 | maxErrors, 24 | s.log, 25 | foldMappers(spm)) 26 | (hasScala, hasJava) match { 27 | case (true, _) => 28 | val options = sOpts ++ Opts.doc.externalAPI(xapis) 29 | val runDoc = Doc.scaladoc(label, s.cacheStoreFactory sub "scala", cs.scalac match { 30 | case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scaladoc")) 31 | }, Nil) 32 | runDoc(srcs, data(cp).toList, out, options, maxErrors, s.log) 33 | case (_, true) => 34 | val javadoc = 35 | sbt.inc.Doc.cachedJavadoc(label, s.cacheStoreFactory sub "java", cs.javaTools) 36 | javadoc.run( 37 | srcs.toList.map(f => converter.toVirtualFile(f.toPath)), 38 | data(cp).toList.map(f => converter.toVirtualFile(f.toPath)), 39 | converter, 40 | out.toPath, 41 | jOpts.toList, 42 | IncToolOptionsUtil.defaultIncToolOptions(), 43 | s.log, 44 | reporter) 45 | case _ => () // do nothing 46 | } 47 | out 48 | } 49 | 50 | private[this] def exported(w: PrintWriter, command: String): Seq[String] => Unit = args => 51 | w.println( (command +: args).mkString(" ") ) 52 | private[this] def exported(s: TaskStreams, command: String): Seq[String] => Unit = args => 53 | exported(s.text("export"), command) 54 | private[this] def foldMappers[A](mappers: Seq[A => Option[A]]) = 55 | mappers.foldRight({ (p: A) => 56 | p 57 | }) { (mapper, mappers) => 58 | { (p: A) => 59 | mapper(p).getOrElse(mappers(p)) 60 | } 61 | } 62 | def nameForSrc(name: String): String = name match { 63 | case "compile"|"javaunidoc"|"scalaunidoc" => "main" 64 | case _ => name 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/scala/sbtunidoc/UnidocKeys.scala: -------------------------------------------------------------------------------- 1 | package sbtunidoc 2 | 3 | import sbt.Keys.Classpath 4 | import sbt.{File, ScopeFilter, URL, settingKey, taskKey} 5 | 6 | trait UnidocKeys { 7 | val unidoc = taskKey[Seq[File]]("Create unified scaladoc for all aggregates.") 8 | val unidocAllSources = taskKey[Seq[Seq[File]]]("All sources.") 9 | val unidocAllClasspaths = taskKey[Seq[Classpath]]("All classpaths.") 10 | val unidocAllAPIMappings = taskKey[Seq[Map[File, URL]]]("All API mappings.") 11 | val unidocScopeFilter = settingKey[ScopeFilter]("Control sources to be included in unidoc.") 12 | val unidocProjectFilter = settingKey[ScopeFilter.ProjectFilter]("Control projects to be included in unidoc.") 13 | val unidocConfigurationFilter = settingKey[ScopeFilter.ConfigurationFilter]("Control configurations to be included in unidoc.") 14 | } 15 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/a/A.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class A 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/b/B.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class B 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/build.sbt: -------------------------------------------------------------------------------- 1 | val commonSettings = Seq( 2 | scalaVersion := "2.11.12" 3 | ) 4 | 5 | def module(name: String) = 6 | Project(name, file(name)).settings( 7 | commonSettings 8 | ).enablePlugins( 9 | GenJavadocPlugin 10 | ) 11 | 12 | lazy val a = module("a") 13 | lazy val b = module("b") 14 | lazy val c = module("c") 15 | 16 | lazy val root = project.in(file(".")).settings( 17 | commonSettings, 18 | JavaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(c) 19 | ).enablePlugins( 20 | JavaUnidocPlugin 21 | ).aggregate( 22 | a, b, c 23 | ) 24 | 25 | TaskKey[Unit]("check") := { 26 | if (scala.util.Properties.isJavaAtLeast("17")) { 27 | assert(file("target/javaunidoc/allclasses-index.html").isFile) 28 | } else if (scala.util.Properties.isJavaAtLeast("11")) { 29 | assert(file("target/javaunidoc/allclasses.html").isFile) 30 | } else { 31 | assert(file("target/javaunidoc/allclasses-frame.html").isFile) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/c/C.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class C 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/project/plugin.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.github.sbt" % "sbt-unidoc" % System.getProperty("plugin.version")) 2 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/java-unidoc/test: -------------------------------------------------------------------------------- 1 | > unidoc 2 | 3 | > check 4 | $ exists target/javaunidoc/example/A.html 5 | $ exists target/javaunidoc/example/B.html 6 | -$ exists target/javaunidoc/example/C.html 7 | 8 | -$ exists target/scala-2.11/unidoc/example/A.html 9 | -$ exists target/scala-2.11/unidoc/example/B.html 10 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/a/A.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class A 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/b/B.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class B 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/build.sbt: -------------------------------------------------------------------------------- 1 | val commonSettings = Seq( 2 | scalaVersion := "2.11.12" 3 | ) 4 | 5 | lazy val a = project.settings( 6 | commonSettings 7 | ) 8 | 9 | lazy val b = project.settings( 10 | commonSettings 11 | ) 12 | 13 | lazy val c = project.settings( 14 | commonSettings 15 | ) 16 | 17 | lazy val root = project.in(file(".")).settings( 18 | commonSettings, 19 | ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(c) 20 | ).enablePlugins( 21 | ScalaUnidocPlugin 22 | ).aggregate( 23 | a, b, c 24 | ) 25 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/c/C.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class C 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/project/plugin.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.github.sbt" % "sbt-unidoc" % System.getProperty("plugin.version")) 2 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala-unidoc/test: -------------------------------------------------------------------------------- 1 | > unidoc 2 | $ exists target/scala-2.11/unidoc/example/A.html 3 | $ exists target/scala-2.11/unidoc/example/B.html 4 | -$ exists target/scala-2.11/unidoc/example/C.html 5 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/a/A.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class A 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/b/B.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class B 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/build.sbt: -------------------------------------------------------------------------------- 1 | val commonSettings = Seq( 2 | scalaVersion := "3.3.4" 3 | ) 4 | 5 | lazy val a = project.settings( 6 | commonSettings 7 | ) 8 | 9 | lazy val b = project.settings( 10 | commonSettings 11 | ) 12 | 13 | lazy val c = project.settings( 14 | commonSettings 15 | ) 16 | 17 | lazy val root = project.in(file(".")).settings( 18 | commonSettings, 19 | ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(c) 20 | ).enablePlugins( 21 | ScalaUnidocPlugin 22 | ).aggregate( 23 | a, b, c 24 | ) 25 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/c/C.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | class C 4 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/project/plugin.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.github.sbt" % "sbt-unidoc" % System.getProperty("plugin.version")) 2 | -------------------------------------------------------------------------------- /src/sbt-test/unidoc/scala3-unidoc/test: -------------------------------------------------------------------------------- 1 | > unidoc 2 | $ exists target/scala-3.3.4/unidoc/example/A.html 3 | $ exists target/scala-3.3.4/unidoc/example/B.html 4 | -$ exists target/scala-3.3.4/unidoc/example/C.html 5 | --------------------------------------------------------------------------------