diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7e21b833..269bb1935 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,16 +47,14 @@ See below for details on getting sbt sources and modifying the documentation. 4. To build the launcher and publish all components locally, $ sbt - > publish-local + > publishLocal - To build documentation, run `make-site` or the individual commands directly: + To build documentation, run `makeSite` or the individual commands directly: > doc > sphinx:mappings > sxr - (Note: sxr currently doesn't work for macros, so it doesn't work for sbt right now.) - 5. To use this locally built version of sbt, copy your stable `~/bin/sbt` script to `~/bin/xsbt` and change it to use the launcher jar in `/target/`. For the v0.13.0 tag, the full location is: /target/sbt-launch-0.13.0.jar @@ -69,9 +67,9 @@ See below for details on getting sbt sources and modifying the documentation. 1. When developing sbt itself, run `compile` when checking compilation only. -2. To use your modified version of sbt in a project locally, run `publish-local`. +2. To use your modified version of sbt in a project locally, run `publishLocal`. -3. After each `publish-local`, clean the `~/.sbt/boot/` directory. Alternatively, if sbt is running and the launcher hasn't changed, run `reboot full` to have sbt do this for you. +3. After each `publishLocal`, clean the `~/.sbt/boot/` directory. Alternatively, if sbt is running and the launcher hasn't changed, run `reboot full` to have sbt do this for you. 4. If a project has `project/build.properties` defined, either delete the file or change `sbt.version` to `0.13.1-SNAPSHOT`. diff --git a/project/Docs.scala b/project/Docs.scala index 9450b67fb..8a55639be 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -28,7 +28,7 @@ object Docs site.settings ++ site.sphinxSupport(DocsPath) ++ site.includeScaladoc("api") ++ -// siteIncludeSxr("sxr") ++ + siteIncludeSxr("sxr") ++ ghPagesSettings ++ Seq( SphinxSupport.sphinxEnv in SphinxSupport.Sphinx <<= sphinxEnvironmentVariables, diff --git a/project/Sbt.scala b/project/Sbt.scala index 2c60bd1c0..5eaec85f6 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -135,7 +135,7 @@ object Sbt extends Build // Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object // technically, we need a dependency on all of mainSub's dependencies, but we don't do that since this is strictly an integration project // with the sole purpose of providing certain identifiers without qualification (with a package object) - lazy val sbtSub = baseProject(sbtPath, "Simple Build Tool") dependsOn(mainSub, compileInterfaceSub, precompiled282, precompiled292, precompiled293, scriptedSbtSub % "test->test") settings(sbtSettings : _*) + lazy val sbtSub = baseProject(sbtPath, "sbt") dependsOn(mainSub, compileInterfaceSub, precompiled282, precompiled292, precompiled293, scriptedSbtSub % "test->test") settings(sbtSettings : _*) /* Nested subproject paths */ def sbtPath = file("sbt") @@ -202,25 +202,24 @@ object Sbt extends Build import Sxr.sxr def releaseSettings = Release.settings(nonRoots, proguard in Proguard) - def rootSettings = releaseSettings ++ Docs.settings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchSub) ++ - Sxr.settings ++ docSetting ++ Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ + def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchSub) ++ + Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Transform.conscriptSettings(launchSub) def otherRootSettings = Seq( scripted <<= scriptedTask, scriptedSource <<= (sourceDirectory in sbtSub) / "sbt-test", - sources in sxr <<= deepTasks(sources in Compile), - Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.flatten), - fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtSub), - compileInputs in (Compile,sxr) <<= (sources in sxr, compileInputs in (sbtSub, Compile, compile), fullClasspath in sxr, scalacOptions) map { (srcs, in, cp, opts) => - in.copy(config = in.config.copy(sources = srcs, classpath = cp.files)) - }, - compileInputs in (Compile,doc) <<= (compileInputs in (Compile,sxr), scalacOptions in doc) map { (ci, opts) => - ci.copy(config = ci.config.copy(options = opts)) - }, publishAll <<= inAll(nonRoots, publishLocal.task), - publishAll <<= (publishAll, publishLocal).map((x,y)=> ()), // publish all normal deps as well as the sbt-launch jar - TaskKey[Unit]("build-all") <<= Seq(publishLocal, /*sxr,*/ doc).dependOn + publishAll <<= (publishAll, publishLocal).map((x,y)=> ()) // publish all normal deps as well as the sbt-launch jar ) + def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq( + scalacOptions += "-Ymacro-no-expand", // for both sxr and doc + sources in sxr <<= deepTasks(sources in Compile), //sxr + sources in Compile <<= sources in sxr, // doc + Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.flatten), // to properly relativize the source paths + fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtSub), + dependencyClasspath in (Compile,doc) <<= fullClasspath in sxr + ) + // the launcher is published with metadata so that the scripted plugin can pull it in // being proguarded, it shouldn't ever be on a classpath with other jars, however def proguardedLauncherSettings = Seq( @@ -231,7 +230,6 @@ object Sbt extends Build publishLauncher <<= publish, packageBin in Compile <<= (proguard in Proguard, Transform.conscriptConfigs).map( (x,y) => x) ) - def docSetting = inConfig(Compile)(inTask(sxr)(Defaults.docSetting(doc in ThisScope.copy(task = Global, config = Global)))) def interfaceSettings = javaOnly ++ Seq( projectComponent, diff --git a/project/Sxr.scala b/project/Sxr.scala index beba6864c..02c50b9e3 100644 --- a/project/Sxr.scala +++ b/project/Sxr.scala @@ -11,18 +11,19 @@ object Sxr lazy val settings: Seq[Setting[_]] = inTask(sxr)(inSxrSettings) ++ baseSettings def baseSettings = Seq( - libraryDependencies += "org.scala-tools.sxr" % "sxr_2.9.0" % "0.2.7" % sxrConf.name + libraryDependencies += "org.scala-sbt.sxr" % "sxr_2.10" % "0.3.0" % sxrConf.name ) def inSxrSettings = Seq( - managedClasspath <<= update map { _.matching( configurationFilter(sxrConf.name) ).classpath }, - scalacOptions <+= sourceDirectories map { "-P:sxr:base-directory:" + _.absString }, - scalacOptions <+= managedClasspath map { "-Xplugin:" + _.files.absString }, - scalacOptions in doc += "-Ymacro-no-expand", - target <<= target in taskGlobal apply { _ / "browse" }, + managedClasspath := update.value.matching( configurationFilter(sxrConf.name) ).classpath, + scalacOptions += "-P:sxr:base-directory:" + sourceDirectories.value.absString, + scalacOptions += "-Xplugin:" + managedClasspath.value.files.filter(_.getName.contains("sxr")).absString, + scalacOptions += "-Ystop-after:sxr", + target := target.in(taskGlobal).value / "browse", sxr in taskGlobal <<= sxrTask ) def taskGlobal = ThisScope.copy(task = Global) - def sxrTask = (sources, cacheDirectory, target, scalacOptions in sxr, classpathOptions, scalaInstance, fullClasspath in sxr, streams) map { (srcs, cache, out, opts, cpOpts, si, cp, s) => + def sxrTask = (sources, target, scalacOptions, classpathOptions, scalaInstance, fullClasspath, streams) map { (srcs, out, opts, cpOpts, si, cp, s) => + val cache = s.cacheDirectory val outputDir = out.getParentFile / (out.getName + ".sxr") val f = FileFunction.cached(cache / "sxr", FilesInfo.hash) { in => s.log.info("Generating sxr output in " + outputDir.getAbsolutePath + "...") diff --git a/project/Util.scala b/project/Util.scala index 3dfb5485f..d11e8664a 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -39,9 +39,8 @@ object Util def testedBaseProject(path: File, nameString: String) = baseProject(path, nameString) settings(testDependencies) lazy val javaOnly = Seq[Setting[_]](/*crossPaths := false, */compileOrder := CompileOrder.JavaThenScala, unmanagedSourceDirectories in Compile <<= Seq(javaSource in Compile).join) - lazy val base: Seq[Setting[_]] = baseScalacOptions ++ Licensed.settings + lazy val base: Seq[Setting[_]] = Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings lazy val baseScalacOptions = Seq( - projectComponent, scalacOptions ++= Seq("-Xelide-below", "0"), scalacOptions <++= scalaVersion map CrossVersion.partialVersion map { case Some((2, 9)) => Nil // support 2.9 for some subprojects for the Scala Eclipse IDE diff --git a/src/sphinx/Detailed-Topics/Compiler-Plugins.rst b/src/sphinx/Detailed-Topics/Compiler-Plugins.rst index e4013b693..bfd90ac91 100644 --- a/src/sphinx/Detailed-Topics/Compiler-Plugins.rst +++ b/src/sphinx/Detailed-Topics/Compiler-Plugins.rst @@ -16,7 +16,7 @@ for specifying `plugin` as the configuration for a dependency: :: - addCompilerPlugin("org.scala-tools.sxr" %% "sxr" % "0.2.7") + addCompilerPlugin("org.scala-tools.sxr" %% "sxr" % "0.3.0") The `compile` and `testCompile` actions will use any compiler plugins found in the `lib` directory or in the `plugin` @@ -33,7 +33,7 @@ You can still specify compiler plugins manually. For example: :: - scalacOptions += "-Xplugin:/sxr-0.2.7.jar" + scalacOptions += "-Xplugin:/sxr-0.3.0.jar" Continuations Plugin Example ============================ diff --git a/src/sphinx/Detailed-Topics/Scripts.rst b/src/sphinx/Detailed-Topics/Scripts.rst index 4116b9da3..d7b5641f8 100644 --- a/src/sphinx/Detailed-Topics/Scripts.rst +++ b/src/sphinx/Detailed-Topics/Scripts.rst @@ -149,4 +149,4 @@ REPL classpath: This syntax was a quick hack. Feel free to improve it. The relevant class is -`IvyConsole <../../sxr/IvyConsole.scala.html>`_. +`IvyConsole <../../sxr/sbt/IvyConsole.scala.html>`_. diff --git a/src/sphinx/Dormant/Settings.rst b/src/sphinx/Dormant/Settings.rst index edd6d9dd0..60845468a 100644 --- a/src/sphinx/Dormant/Settings.rst +++ b/src/sphinx/Dormant/Settings.rst @@ -402,6 +402,6 @@ locations of the dependencies for that configuration. ) As before, *update* and *configuration* are defined in -`Keys <../../sxr/Keys.scala.html>`_. +`Keys <../../sxr/sbt/Keys.scala.html>`_. *update* is of type `TaskKey[UpdateReport]` and *configuration* is of type `SettingKey[Configuration]`. diff --git a/src/sphinx/Extending/Build-State.rst b/src/sphinx/Extending/Build-State.rst index 2772f5799..3ef8d141e 100644 --- a/src/sphinx/Extending/Build-State.rst +++ b/src/sphinx/Extending/Build-State.rst @@ -111,7 +111,7 @@ define settings in `.sbt` files, for example. `Scope <../../api/sbt/Scope.html>`_ selects the scope the key is obtained for. There are convenience overloads of `in` that can be used to specify only the required scope axes. See -`Structure.scala <../../sxr/Structure.scala.html>`_ for where `in` and +`Structure.scala <../../sxr/sbt/Structure.scala.html>`_ for where `in` and other parts of the settings interface are defined. Some examples: :: diff --git a/src/sphinx/Extending/Commands.rst b/src/sphinx/Extending/Commands.rst index 88bceb034..d086b1be5 100644 --- a/src/sphinx/Extending/Commands.rst +++ b/src/sphinx/Extending/Commands.rst @@ -50,7 +50,7 @@ by `State`) determine valid completions for the `project` command. Examples for the general and specific cases are shown in the following sections. -See `Command.scala <../../sxr/Command.scala.html#10761>`_ for the source +See `Command.scala <../../sxr/sbt/Command.scala.html>`_ for the source API details for constructing commands. General commands diff --git a/src/sphinx/Extending/Settings-Core.rst b/src/sphinx/Extending/Settings-Core.rst index 2b7ddaca8..b815b8b54 100644 --- a/src/sphinx/Extending/Settings-Core.rst +++ b/src/sphinx/Extending/Settings-Core.rst @@ -217,7 +217,7 @@ underlying `SettingKey[Task[T]]` (and they both wrap an underlying For example, `a := 3` for a SettingKey *a* will very roughly translate to `setting(a, value(3))`. For a TaskKey *a*, it will roughly translate to `setting(a, value( task { 3 } ) )`. See -`main/Structure.scala <../../sxr/Structure.scala>`_ +`main/Structure.scala <../../sxr/sbt/Structure.scala>`_ for details. Settings definitions diff --git a/src/sphinx/Getting-Started/Basic-Def.rst b/src/sphinx/Getting-Started/Basic-Def.rst index ea302d11a..9b19c5260 100644 --- a/src/sphinx/Getting-Started/Basic-Def.rst +++ b/src/sphinx/Getting-Started/Basic-Def.rst @@ -153,7 +153,7 @@ Built-in Keys ~~~~~~~~~~~~~ The built-in keys are just fields in an object called -`Keys <../../sxr/Keys.scala.html>`_. A +`Keys <../../sxr/sbt/Keys.scala.html>`_. A `build.sbt` implicitly has an `import sbt.Keys._`, so `sbt.Keys.name` can be referred to as `name`. diff --git a/src/sphinx/Getting-Started/Custom-Settings.rst b/src/sphinx/Getting-Started/Custom-Settings.rst index e5a3e8329..09bc1c52f 100644 --- a/src/sphinx/Getting-Started/Custom-Settings.rst +++ b/src/sphinx/Getting-Started/Custom-Settings.rst @@ -11,16 +11,16 @@ Getting Started Guide, especially :doc:`build.sbt ` and :doc:`more ab Defining a key -------------- -`Keys <../../sxr/Keys.scala.html>`_ is +`Keys <../../sxr/sbt/Keys.scala.html>`_ is packed with examples illustrating how to define keys. Most of the keys are implemented in -`Defaults <../../sxr/Defaults.scala.html>`_. +`Defaults <../../sxr/sbt/Defaults.scala.html>`_. Keys have one of three types. `SettingKey` and `TaskKey` are described in :doc:`.sbt build definition `. Read about `InputKey` on the :doc:`/Extending/Input-Tasks` page. -Some examples from `Keys <../../sxr/Keys.scala.html>`_: +Some examples from `Keys <../../sxr/sbt/Keys.scala.html>`_: :: diff --git a/src/sphinx/Getting-Started/Library-Dependencies.rst b/src/sphinx/Getting-Started/Library-Dependencies.rst index da4563741..da6b2ba02 100644 --- a/src/sphinx/Getting-Started/Library-Dependencies.rst +++ b/src/sphinx/Getting-Started/Library-Dependencies.rst @@ -80,7 +80,7 @@ or like this, where `configuration` is also a string: libraryDependencies += groupID % artifactID % revision % configuration -`libraryDependencies` is declared in `Keys <../../sxr/Keys.scala.html>`_ like this: +`libraryDependencies` is declared in `Keys <../../sxr/sbt/Keys.scala.html#sbt.Keys.libraryDependencies>`_ like this: :: @@ -178,7 +178,7 @@ For example: resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" The `resolvers` key is defined in -`Keys <../../sxr/Keys.scala.html>`_ like +`Keys <../../sxr/sbt/Keys.scala.html#sbt.Keys.resolvers>`_ like this: :: diff --git a/src/sphinx/Getting-Started/More-About-Settings.rst b/src/sphinx/Getting-Started/More-About-Settings.rst index 1d4c5b625..125929825 100644 --- a/src/sphinx/Getting-Started/More-About-Settings.rst +++ b/src/sphinx/Getting-Started/More-About-Settings.rst @@ -154,7 +154,7 @@ keys create a `Setting[Task[T]]` rather than a `Setting[T]` when you build a setting with `:=`, etc. Tasks can use settings as inputs, but settings cannot use tasks as inputs. -Take these two keys (from `Keys <../../sxr/Keys.scala.html>`_): +Take these two keys (from `Keys <../../sxr/sbt/Keys.scala.html>`_): ::