From 155cd057c0bb47e6c66250b5bd5599179042c4ee Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 11 Aug 2017 03:57:14 -0400 Subject: [PATCH] Unidoc --- CONTRIBUTING.md | 20 +++++- build.sbt | 3 +- main/src/main/scala/sbt/Defaults.scala | 24 +++---- notes/1.1.2.markdown | 81 ++++++++++++++++++++++ project/Docs.scala | 88 +++++++++++++++++++++--- project/plugins.sbt | 2 + sbt/src/main/scala/package.scala | 93 +++++++++++++------------- 7 files changed, 238 insertions(+), 73 deletions(-) create mode 100644 notes/1.1.2.markdown diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f14b8aa6..d1a256e67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -136,7 +136,14 @@ See [PROFILING](./PROFILING.md) Other notes for maintainers --------------------------- -### Publishing VS Code Extensions +Please note that these tests run PAINFULLY slow if the version set in +`build.sbt` is set to SNAPSHOT, as every time the scripted test boots +up a test instance of sbt, remote mirrors are scanned for possible +updates. It is recommended that you set the version suffix to +`-devel`, as in `1.0.0-devel`. + +Note for maintainers +==================== Reference https://code.visualstudio.com/docs/extensions/publish-extension @@ -158,3 +165,14 @@ Contributing to sbt requires you or your employer to sign the To make it easier to respect our license agreements, we have added an sbt task that takes care of adding the LICENSE headers to new files. Run `headerCreate` and sbt will put a copyright notice into it. + +### Building API docs + +1. Rebase wip/unidoc branch https://github.com/eed3si9n/sbt/tree/wip/unidoc on top of the target sbt version. +2. Set the version to the target version. +3. Check out the right versions for all modules locally, and run ./sbt-allsources.sh. +4. ghpagesPushSite + +### Building Documentation + +The scala-sbt.org site documentation is a separate project [website](https://github.com/sbt/website). Follow [the steps in the README](https://github.com/sbt/website#scala-sbtorg) to generate the documentation. diff --git a/build.sbt b/build.sbt index e8fb1e45a..c1d4154b4 100644 --- a/build.sbt +++ b/build.sbt @@ -143,7 +143,7 @@ val scriptedSbtReduxMimaSettings = Def settings ( ) lazy val sbtRoot: Project = (project in file(".")) - .enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin) + .enablePlugins(ScriptedPlugin, ScalaUnidocPlugin, DocsPlugin) .configs(Sxr.SxrConf) .aggregate(nonRoots: _*) .settings( @@ -165,7 +165,6 @@ lazy val sbtRoot: Project = (project in file(".")) else "") }, Util.baseScalacOptions, - Docs.settings, Sxr.settings, scalacOptions += "-Ymacro-expand:none", // for both sxr and doc sources in sxr := { diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 3b47bf390..ba3fefba2 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -148,7 +148,7 @@ object Defaults extends BuildCommon { ) ) private[sbt] lazy val globalCore: Seq[Setting[_]] = globalDefaults( - defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq( + defaultTestTasks(Keys.test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq( excludeFilter :== HiddenFileFilter, fileInputs :== Nil, fileInputIncludeFilter :== AllPassFilter.toNio, @@ -867,7 +867,7 @@ object Defaults extends BuildCommon { ) ) lazy val testTasks - : Seq[Setting[_]] = testTaskOptions(test) ++ testTaskOptions(testOnly) ++ testTaskOptions( + : Seq[Setting[_]] = testTaskOptions(Keys.test) ++ testTaskOptions(testOnly) ++ testTaskOptions( testQuick ) ++ testDefaults ++ Seq( testLoader := ClassLoaders.testTask.value, @@ -882,23 +882,23 @@ object Defaults extends BuildCommon { executeTests := ( Def.taskDyn { allTestGroupsTask( - (streams in test).value, + (streams in Keys.test).value, loadedTestFrameworks.value, testLoader.value, - (testGrouping in test).value, - (testExecution in test).value, - (fullClasspath in test).value, + (testGrouping in Keys.test).value, + (testExecution in Keys.test).value, + (fullClasspath in Keys.test).value, testForkedParallel.value, - (javaOptions in test).value, + (javaOptions in Keys.test).value, (classLoaderLayeringStrategy).value, projectId = s"${thisProject.value.id} / ", ) } ).value, // ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value, - testResultLogger in (Test, test) :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185 - test := { - val trl = (testResultLogger in (Test, test)).value + testResultLogger in (Test, Keys.test) :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185 + Keys.test := { + val trl = (testResultLogger in (Test, Keys.test)).value val taskName = Project.showContextKey(state.value).show(resolvedScoped.value) try trl.run(streams.value.log, executeTests.value, taskName) finally close(testLoader.value) @@ -1005,8 +1005,8 @@ object Defaults extends BuildCommon { def testQuickFilter: Initialize[Task[Seq[String] => Seq[String => Boolean]]] = Def.task { - val cp = (fullClasspath in test).value - val s = (streams in test).value + val cp = (fullClasspath in Keys.test).value + val s = (streams in Keys.test).value val ans: Seq[Analysis] = cp.flatMap(_.metadata get Keys.analysis) map { case a0: Analysis => a0 } diff --git a/notes/1.1.2.markdown b/notes/1.1.2.markdown new file mode 100644 index 000000000..a81b00018 --- /dev/null +++ b/notes/1.1.2.markdown @@ -0,0 +1,81 @@ +### Fixes + +- Fixes triggered execution's resource leak by caching the watch service. [#3999][3999] by [@eatkins][@eatkins] +- Fixes classloader classloader inheriting the dependencies of Scala compiler during `run` [zinc#505][zinc505] by [@eed3si9n][@eed3si9n] +- Fixes forked test concurrency issue. [#4030][4030] by [@eatkins][@eatkins] +- Fixes `new` command leaving behind target directory [#4033][4033] by [@eed3si9n][@eed3si9n] +- Fixes handling on null Content-Type. [lm214][lm214] by [@staale][@staale] +- Fixes null handling of `managedChecksums` in `ivySettings` file. [lm#218][lm218] by [@IanGabes][@IanGabes] +- Adds `sbt.boot.lock` as a JVM property to opt-out of locking. [#3927][3927] by [@dwijnand][@dwijnand] +- Provides `SBT_GLOBAL_SERVER_DIR` env var as a workaround to long socket file path on UNIX. [#3932][3932] by [@dwijnand][@dwijnand] +- Fixes forked runs reporting noisy "Stream closed" exception. [#3970][3970] by [@retronym][@retronym] +- Fixes test compilation not getting included in VS Code save trigger. [#4022][4022] by [@tmiyamon][@tmiyamon] +- Fixes sbt server responding with string id when number id passed. [#4025][4025] by [@tiqwab][@tiqwab] +- Fixes `getDecoder` in Analysis format [zinc#502][zinc502] by [@jilen][@jilen] +- Fixes equal / hashCode inconsistencies around Array. [zinc#513][zinc513] by [@eed3si9n][@eed3si9n] +- Whitelists `java9-rt-ext- output` in rt export process [lp#211][lp211] by [@eatkins][@eatkins] +- Fixes JDK version detection. [lp#219][lp219] by [@eed3si9n][@eed3si9n] and [@2m][@2m] +- Fixes quoting in Windows bat file. [lp#220][lp220] by [@ForNeVeR][@ForNeVeR] +- Fixes `-error` not supressing startup logs. [#4036][4036] by [@eed3si9n][@eed3si9n] + +### Improvements + +- Performance optimization around logging. [util#152][util152] by [@retronym][@retronym] +- Performance fix by caching the hashCode of `Configuration`. [lm#213][lm213] by [@retronym][@retronym] +- Returns error code `-33000L` on sbt server when a command fails. [#3991][3991] by [@dwijnand][@dwijnand] +- Allows wildcards in organization and artifact. [#215][lm215] by [@dhs3000][@dhs3000] +- Updates to latest Jsch to support stronger key exchange algorithms. [lm#217][lm217] by [@ryandbair][@ryandbair] +- Fixes preloading of compiler bridge. [lp#222][lp222] by [@analytically][@analytically] + +### Internal + +- Updates [contribution guide][CONTRIBUTING]. [#3960][3960]/[#4019][4019] by [@eed3si9n][@eed3si9n] +- Deletes `buildinfo.BuildInfo` from sbt main that was intended for testing. [3967][3967] by [@dwijnand][@dwijnand] and [@xuwei-k][@xuwei-k] +- Various improvements around Zinc benchmark by [@retronym][@retronym] + + [@eed3si9n]: https://github.com/eed3si9n + [@dwijnand]: http://github.com/dwijnand + [@cunei]: https://github.com/cunei + [@jvican]: https://github.com/jvican + [@Duhemm]: https://github.com/Duhemm + [@xuwei-k]: https://github.com/xuwei-k + [@retronym]: https://github.com/retronym + [@eatkins]: https://github.com/eatkins + [@itohiro73]: https://github.com/itohiro73 + [@tmiyamon]: https://github.com/tmiyamon + [@tiqwab]: https://github.com/tiqwab + [@staale]: https://github.com/staale + [@ryandbair]: https://github.com/ryandbair + [@dhs3000]: https://github.com/dhs3000 + [@IanGabes]: https://github.com/IanGabes + [@jilen]: https://github.com/jilen + [@2m]: https://github.com/2m + [@ForNeVeR]: https://github.com/ForNeVeR + [@analytically]: https://github.com/analytically + [3927]: https://github.com/sbt/sbt/pull/3927 + [3932]: https://github.com/sbt/sbt/pull/3932 + [3960]: https://github.com/sbt/sbt/pull/3960 + [3967]: https://github.com/sbt/sbt/pull/3967 + [3970]: https://github.com/sbt/sbt/pull/3970 + [3999]: https://github.com/sbt/sbt/pull/3999 + [3991]: https://github.com/sbt/sbt/pull/3991 + [4019]: https://github.com/sbt/sbt/pull/4019 + [4022]: https://github.com/sbt/sbt/pull/4022 + [4025]: https://github.com/sbt/sbt/pull/4025 + [4030]: https://github.com/sbt/sbt/pull/4030 + [4033]: https://github.com/sbt/sbt/pull/4033 + [4036]: https://github.com/sbt/sbt/pull/4036 + [util152]: https://github.com/sbt/util/pull/152 + [lm213]: https://github.com/sbt/librarymanagement/pull/213 + [lm214]: https://github.com/sbt/librarymanagement/pull/214 + [lm215]: https://github.com/sbt/librarymanagement/pull/215 + [lm217]: https://github.com/sbt/librarymanagement/pull/217 + [lm218]: https://github.com/sbt/librarymanagement/pull/218 + [zinc502]: https://github.com/sbt/zinc/pull/502 + [zinc505]: https://github.com/sbt/zinc/pull/505 + [zinc513]: https://github.com/sbt/zinc/pull/513 + [lp211]: https://github.com/sbt/sbt-launcher-package/pull/211 + [lp219]: https://github.com/sbt/sbt-launcher-package/pull/219 + [lp220]: https://github.com/sbt/sbt-launcher-package/pull/220 + [lp222]: https://github.com/sbt/sbt-launcher-package/pull/222 + [CONTRIBUTING]: https://github.com/sbt/sbt/blob/1.x/CONTRIBUTING.md diff --git a/project/Docs.scala b/project/Docs.scala index 806f9493d..13064d817 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -1,26 +1,93 @@ import sbt._, Keys._ -/* + import StatusPlugin.autoImport._ import com.typesafe.sbt.site.SitePlugin.autoImport._ -import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._ -import com.typesafe.sbt.sbtghpages.GhpagesPlugin.autoImport._ +import com.typesafe.sbt.site.SiteScaladocPlugin +import SiteScaladocPlugin.autoImport._ +import com.typesafe.sbt.sbtghpages.GhpagesPlugin +import GhpagesPlugin.autoImport._ import com.typesafe.sbt.SbtGit, SbtGit.{ git, GitKeys } import Sxr.{ sxr, SxrConf } - */ +import sbtunidoc.{ BaseUnidocPlugin, ScalaUnidocPlugin } +import BaseUnidocPlugin.autoImport._ +import ScalaUnidocPlugin.autoImport._ -object Docs { - def settings: Seq[Setting[_]] = Nil +object DocsPlugin extends AutoPlugin { + override def requires = GhpagesPlugin && ScalaUnidocPlugin && SiteScaladocPlugin - /* val siteExcludes = Set(".buildinfo", "objects.inv") def siteInclude(f: File) = !siteExcludes.contains(f.getName) - def settings: Seq[Setting[_]] = Def settings ( + override def projectSettings: Seq[Setting[_]] = Def settings ( siteSubdirName in SiteScaladoc := "api", - siteIncludeSxr("sxr"), - ghPagesSettings + // siteIncludeSxr("sxr"), + ghPagesSettings, + unidocProjectFilter in (ScalaUnidoc, unidoc) := { + inProjects(projectRefs(baseDirectory.value): _*) + }, + doc in Compile := { (unidoc in Compile).value.head } ) + /** + * This is a list manually constructed from + * sbt:sbtRoot> projects + */ + def projectRefs(base: File): Seq[ProjectReference] = { + val parent = base.getParentFile + val lmPath = parent / "librarymanagement" + val zincPath = parent / "zinc" + val ioPath = parent / "io" + val utilPath = parent / "util" + Vector( + LocalProject("actionsProj"), + LocalProject("collectionProj"), + LocalProject("commandProj"), + LocalProject("completeProj"), + LocalProject("coreMacrosProj"), + LocalProject("logicProj"), + LocalProject("mainProj"), + LocalProject("mainSettingsProj"), + LocalProject("protocolProj"), + LocalProject("runProj"), + LocalProject("sbtProj"), + LocalProject("scriptedPluginProj"), + LocalProject("scriptedSbtProj"), + LocalProject("stdTaskProj"), + LocalProject("taskProj"), + LocalProject("testAgentProj"), + ) ++ + Vector( + ProjectRef(lmPath, "lmCore"), + ProjectRef(lmPath, "lmIvy"), + ) ++ + Vector( + // skipping some of the internal subprojects here + ProjectRef(zincPath, "compilerBridge"), + ProjectRef(zincPath, "compilerInterface"), + ProjectRef(zincPath, "zinc"), + ProjectRef(zincPath, "zincApiInfo"), + ProjectRef(zincPath, "zincClassfile"), + ProjectRef(zincPath, "zincClasspath"), + ProjectRef(zincPath, "zincCompile"), + ProjectRef(zincPath, "zincCompileCore"), + ProjectRef(zincPath, "zincCore"), + ProjectRef(zincPath, "zincPersist"), + ) ++ + Vector( + ProjectRef(ioPath, "io"), + ) ++ + Vector( + ProjectRef(utilPath, "utilCache"), + ProjectRef(utilPath, "utilControl"), + ProjectRef(utilPath, "utilInterface"), + ProjectRef(utilPath, "utilLogging"), + ProjectRef(utilPath, "utilPosition"), + ProjectRef(utilPath, "utilRelation"), + ProjectRef(utilPath, "utilScripted"), + ProjectRef(utilPath, "utilTracking"), + ) + } + def ghPagesSettings = Def settings ( git.remoteRepo := "git@github.com:sbt/sbt.github.com.git", localRepoDirectory, @@ -52,5 +119,4 @@ object Docs { IO.copy(toCopy) repo } - */ } diff --git a/project/plugins.sbt b/project/plugins.sbt index c5959a110..41081f452 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,3 +10,5 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1") +addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1") +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2") diff --git a/sbt/src/main/scala/package.scala b/sbt/src/main/scala/package.scala index 01d133947..d35252944 100644 --- a/sbt/src/main/scala/package.scala +++ b/sbt/src/main/scala/package.scala @@ -13,52 +13,51 @@ import sbt.internal.FileChangesMacro import scala.language.experimental.macros -package object sbt - extends sbt.IOSyntax0 - with sbt.std.TaskExtra - with sbt.internal.util.Types - with sbt.ProjectExtra - with sbt.librarymanagement.DependencyBuilders - with sbt.librarymanagement.DependencyFilterExtra - with sbt.librarymanagement.LibraryManagementSyntax - with sbt.BuildExtra - with sbt.TaskMacroExtra - with sbt.ScopeFilter.Make - with sbt.BuildSyntax - with sbt.OptionSyntax - with sbt.SlashSyntax - with sbt.Import { - // IO - def uri(s: String): URI = new URI(s) - def file(s: String): File = new File(s) - def url(s: String): URL = new URL(s) - implicit def fileToRichFile(file: File): sbt.io.RichFile = new sbt.io.RichFile(file) - implicit def filesToFinder(cc: Traversable[File]): sbt.io.PathFinder = - sbt.io.PathFinder.strict(cc) - /* - * Provides macro extension methods. Because the extension methods are all macros, no instance - * of FileChangesMacro.TaskOps is ever made which is why it is ok to use `???`. - */ - implicit def taskToTaskOpts[T](t: TaskKey[T]): FileChangesMacro.TaskOps[T] = ??? - implicit val fileStampJsonFormatter: JsonFormat[Seq[(NioPath, FileStamp)]] = - FileStamp.Formats.seqPathFileStampJsonFormatter - implicit val pathJsonFormatter: JsonFormat[Seq[NioPath]] = FileStamp.Formats.seqPathJsonFormatter - implicit val fileJsonFormatter: JsonFormat[Seq[File]] = FileStamp.Formats.seqFileJsonFormatter - implicit val singlePathJsonFormatter: JsonFormat[NioPath] = FileStamp.Formats.pathJsonFormatter - implicit val singleFileJsonFormatter: JsonFormat[File] = FileStamp.Formats.fileJsonFormatter - // others +// package object sbt +// extends sbt.IOSyntax0 +// with sbt.std.TaskExtra +// with sbt.internal.util.Types +// with sbt.ProjectExtra +// with sbt.librarymanagement.DependencyBuilders +// with sbt.librarymanagement.DependencyFilterExtra +// with sbt.librarymanagement.LibraryManagementSyntax +// with sbt.BuildExtra +// with sbt.TaskMacroExtra +// with sbt.ScopeFilter.Make +// with sbt.BuildSyntax +// with sbt.OptionSyntax +// with sbt.SlashSyntax +// with sbt.Import { +// // IO +// def uri(s: String): URI = new URI(s) +// def file(s: String): File = new File(s) +// def url(s: String): URL = new URL(s) +// implicit def fileToRichFile(file: File): sbt.io.RichFile = new sbt.io.RichFile(file) +// implicit def filesToFinder(cc: Traversable[File]): sbt.io.PathFinder = +// sbt.io.PathFinder.strict(cc) +// /* +// * Provides macro extension methods. Because the extension methods are all macros, no instance +// * of FileChangesMacro.TaskOps is ever made which is why it is ok to use `???`. +// */ +// implicit def taskToTaskOpts[T](t: TaskKey[T]): FileChangesMacro.TaskOps[T] = ??? +// implicit val fileStampJsonFormatter: JsonFormat[Seq[(NioPath, FileStamp)]] = +// FileStamp.Formats.seqPathFileStampJsonFormatter +// implicit val pathJsonFormatter: JsonFormat[Seq[NioPath]] = FileStamp.Formats.seqPathJsonFormatter +// implicit val fileJsonFormatter: JsonFormat[Seq[File]] = FileStamp.Formats.seqFileJsonFormatter +// implicit val singlePathJsonFormatter: JsonFormat[NioPath] = FileStamp.Formats.pathJsonFormatter +// implicit val singleFileJsonFormatter: JsonFormat[File] = FileStamp.Formats.fileJsonFormatter +// others +// object CompileOrder { +// val JavaThenScala = xsbti.compile.CompileOrder.JavaThenScala +// val ScalaThenJava = xsbti.compile.CompileOrder.ScalaThenJava +// val Mixed = xsbti.compile.CompileOrder.Mixed +// } +// type CompileOrder = xsbti.compile.CompileOrder - object CompileOrder { - val JavaThenScala = xsbti.compile.CompileOrder.JavaThenScala - val ScalaThenJava = xsbti.compile.CompileOrder.ScalaThenJava - val Mixed = xsbti.compile.CompileOrder.Mixed - } - type CompileOrder = xsbti.compile.CompileOrder +// final val ThisScope = Scope.ThisScope +// final val Global = Scope.Global +// final val GlobalScope = Scope.GlobalScope - final val ThisScope = Scope.ThisScope - final val Global = Scope.Global - final val GlobalScope = Scope.GlobalScope - - def config(name: String): Configuration = - macro sbt.librarymanagement.ConfigurationMacro.configMacroImpl -} +// def config(name: String): Configuration = +// macro sbt.librarymanagement.ConfigurationMacro.configMacroImpl +// }