Restore sxr support and fix links to sxr'd sources. Fixes #863.

This commit is contained in:
Mark Harrah 2013-09-24 11:25:02 -04:00
parent 743ce99315
commit b2599c1bb1
15 changed files with 41 additions and 45 deletions

View File

@ -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 `<sbt>/target/`. For the v0.13.0 tag, the full location is:
<sbt>/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`.

View File

@ -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,

View File

@ -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,

View File

@ -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 + "...")

View File

@ -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

View File

@ -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:<path-to-sxr>/sxr-0.2.7.jar"
scalacOptions += "-Xplugin:<path-to-sxr>/sxr-0.3.0.jar"
Continuations Plugin Example
============================

View File

@ -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>`_.

View File

@ -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]`.

View File

@ -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:
::

View File

@ -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

View File

@ -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

View File

@ -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`.

View File

@ -11,16 +11,16 @@ Getting Started Guide, especially :doc:`build.sbt <Basic-Def>` 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 <Basic-Def>`. 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>`_:
::

View File

@ -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:
::

View File

@ -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>`_):
::