Merge pull request #264 from indrajitr/misc

Misc updates
This commit is contained in:
Mark Harrah 2011-11-10 04:40:06 -08:00
commit ed22ac31a3
7 changed files with 31 additions and 31 deletions

View File

@ -21,11 +21,11 @@ There is a [video of a demo] given at [Scala Days 2011] based on sbt 0.10.0 that
$ git clone git://github.com/harrah/xsbt.git
$ cd xsbt
3. The initial branch is the development branch 0.11, which contains the latest code for the 0.11.x series. To build a specific release or commit, switch to the associated tag. The tag for the latest stable release is v0.11.0:
3. The initial branch is the development branch 0.11, which contains the latest code for the 0.11.x series. To build a specific release or commit, switch to the associated tag. The tag for the latest stable release is v0.11.1:
$ git checkout v0.11.0
$ git checkout v0.11.1
Note that sbt is always built with the previous stable release. For example, the 0.11 branch is built with 0.11.0, the v0.11.0 tag is built with 0.10.1, and the v0.10.1 tag is built with 0.10.0.
Note that sbt is always built with the previous stable release. For example, the 0.11 branch is built with 0.11.1, the v0.11.1 tag is built with 0.11.0, the v0.11.0 tag is built with 0.10.1, and the v0.10.1 tag is built with 0.10.0.
4. To build the launcher, publish all components locally, and build API and SXR documentation:
@ -35,13 +35,13 @@ There is a [video of a demo] given at [Scala Days 2011] based on sbt 0.10.0 that
$ sbt publish-local proguard sxr doc
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 `<xsbt>/target/`. For the v0.11.0 tag, the full location is:
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 `<xsbt>/target/`. For the v0.11.1 tag, the full location is:
<xsbt>/target/sbt-launch-0.11.0.jar
<xsbt>/target/sbt-launch-0.11.1.jar
If using the 0.11 development branch, the launcher is at:
<xsbt>/target/sbt-launch-0.11.1-SNAPSHOT.jar
<xsbt>/target/sbt-launch-0.11.2-SNAPSHOT.jar
## Modifying sbt
@ -49,6 +49,6 @@ When developing sbt itself, there is no need to run `build-all`, since this gene
To use your modified version of sbt in a project locally, run `publish-local`. If you have modified the launcher, also run `proguard`.
After each `publish-local`, clean the `project/boot/` directory in the project in which you want to use the locally built sbt. Alternatively, if sbt is running and the launcher hasn't changed, run `reboot full` to have sbt do this for you.
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.
If a project has `project/build.properties` defined, either delete the file or change `sbt.version` to `0.11.1-SNAPSHOT`.
If a project has `project/build.properties` defined, either delete the file or change `sbt.version` to `0.11.2-SNAPSHOT`.

View File

@ -16,7 +16,7 @@ package sbt
import org.scalatools.testing.{AnnotatedFingerprint, SubclassFingerprint}
import sys.error
import scala.xml.{Node => XNode,NodeSeq}
import scala.xml.NodeSeq
import org.apache.ivy.core.module.{descriptor, id}
import descriptor.ModuleDescriptor, id.ModuleRevisionId
import java.io.File
@ -193,11 +193,10 @@ object Defaults extends BuildCommon
}
def compilersSetting = compilers <<= (scalaInstance, appConfiguration, streams, classpathOptions, javaHome) map { (si, app, s, co, jh) => Compiler.compilers(si, co, jh)(app, s.log) }
lazy val configTasks = docSetting(doc) ++ Seq(
lazy val configTasks = docSetting(doc) ++ compileInputsSettings ++ Seq(
initialCommands in GlobalScope :== "",
cleanupCommands in GlobalScope :== "",
compile <<= compileTask,
compileInputs <<= compileInputsTask,
compileIncSetup <<= compileIncSetupTask,
console <<= consoleTask,
consoleQuick <<= consoleQuickTask,
@ -442,11 +441,10 @@ object Defaults extends BuildCommon
new Run(si, trap, tmp)
}
def docSetting(key: TaskKey[File]): Seq[Setting[_]] = inTask(key)(Seq(
def docSetting(key: TaskKey[File]): Seq[Setting[_]] = inTask(key)(compileInputsSettings ++ Seq(
cacheDirectory ~= (_ / key.key.label),
target <<= docDirectory, // deprecate docDirectory in favor of 'target in doc'; remove when docDirectory is removed
scalacOptions <<= scaladocOptions or scalacOptions, // deprecate scaladocOptions in favor of 'scalacOptions in doc'; remove when scaladocOptions is removed
compileInputs <<= compileInputsTask,
key in TaskGlobal <<= (cacheDirectory, compileInputs, target, configuration, streams) map { (cache, in, out, config, s) =>
// For Scala/Java hybrid projects, the output docs are rebased to `scala` or `java` sub-directory accordingly. We do hybrid
// mode iff both *.scala and *.java files exist -- other doc resources (package.html, *.jpg etc.) don't influence the decision.
@ -488,13 +486,15 @@ object Defaults extends BuildCommon
(dependencyClasspath, cacheDirectory, skip in compile, definesClass) map { (cp, cacheDir, skip, definesC) =>
Compiler.IncSetup(analysisMap(cp), definesC, skip, cacheDir / "compile")
}
def compileInputsTask =
(dependencyClasspath, sources, compilers, javacOptions, scalacOptions, classDirectory, compileOrder, compileIncSetup, streams) map {
(cp, srcs, cs, javacOpts, scalacOpts, classes, order, incSetup, s) =>
val classpath = classes +: data(cp)
Compiler.inputs(classpath, srcs, classes, scalacOpts, javacOpts, 100, order)(cs, incSetup, s.log)
}
def compileInputsSettings: Seq[Setting[_]] = {
val optionsPair = TaskKey.local[(Seq[String], Seq[String])]
Seq(optionsPair <<= (scalacOptions, javacOptions) map Pair.apply,
compileInputs <<= (dependencyClasspath, sources, compilers, optionsPair, classDirectory, compileOrder, compileIncSetup, maxErrors, streams) map {
(cp, srcs, cs, optsPair, classes, order, incSetup, maxErr, s) =>
Compiler.inputs(classes +: data(cp), srcs, classes, optsPair._1, optsPair._2, maxErr, order)(cs, incSetup, s.log)
})
}
def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID = m.extra(CustomPomParser.SbtVersionKey -> sbtV, CustomPomParser.ScalaVersionKey -> scalaV).copy(crossVersion = false)
def writePluginsDescriptor(plugins: Set[String], dir: File): Seq[File] =
{
@ -1205,4 +1205,4 @@ trait BuildCommon
def getPrevious[T](task: TaskKey[T]): Initialize[Task[Option[T]]] =
(state, resolvedScoped) map { (s, ctx) => getFromContext(task, ctx, s) }
}
}

View File

@ -36,7 +36,7 @@ object TaskData
def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
(streams.identity zipWith i) { (sTask, iTask) =>
(streams zipWith i) { (sTask, iTask) =>
(sTask,iTask) map { case s :+: value :+: HNil =>
Operations.write( s.binary(id), convert(value) )(f)
value

View File

@ -164,7 +164,7 @@ object Sbt extends Build
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).identity,
fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtSub),
compileInputs in (Compile,sxr) <<= (sources in sxr, compileInputs in sbtSub in Compile, fullClasspath in sxr) map { (srcs, in, cp) =>
in.copy(config = in.config.copy(sources = srcs, classpath = cp.files))
},
@ -178,7 +178,7 @@ object Sbt extends Build
projectComponent,
exportJars := true,
componentID := Some("xsbti"),
watchSources <++= apiDefinitions.identity,
watchSources <++= apiDefinitions,
resourceGenerators in Compile <+= (version, resourceManaged, streams) map generateVersionFile,
apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil },
sourceGenerators in Compile <+= (cacheDirectory, apiDefinitions, fullClasspath in Compile in datatypeSub, sourceManaged in Compile, mainClass in datatypeSub in Compile, runner, streams) map generateAPICached

View File

@ -20,7 +20,7 @@ object Transform
transformResources <<= (fileMappings in transformResources, resourceProperties) map { (rs, props) =>
rs map { case (in, out) => transform(in, out, props) }
},
resourceGenerators <+= transformResources.identity
resourceGenerators <+= transformResources
)
def transformMappings = (inputResources, inputResourceDirectories, resourceManaged) map { (rs, rdirs, rm) =>
(rs --- rdirs) x (rebase(rdirs, rm)|flat(rm)) toSeq
@ -46,4 +46,4 @@ object Transform
lazy val Snapshots = typesafeRepository("snapshots")
def typesafeRepository(status: String) =
""" typesafe-ivy-%s: http://repo.typesafe.com/typesafe/ivy-%<s/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]""" format status
}
}

View File

@ -17,6 +17,8 @@ class ForkRun(config: ForkScalaRun) extends ScalaRun
{
def run(mainClass: String, classpath: Seq[File], options: Seq[String], log: Logger): Option[String] =
{
log.info("Running " + mainClass + " " + options.mkString(" "))
val scalaOptions = classpathOption(classpath) ::: mainClass :: options.toList
val strategy = config.outputStrategy getOrElse LoggedOutput(log)
val process = Fork.scala.fork(config.javaHome, config.runJVMOptions, config.scalaJars, scalaOptions, config.workingDirectory, config.connectInput, strategy)
@ -95,4 +97,4 @@ object Run
else
Some("Nonzero exit code: " + exitCode)
}
}
}

View File

@ -13,8 +13,7 @@ $ exists "target/api/java"
> 'set sources in (Compile, doc) <<= sources in (Compile, doc) map { _.filterNot(_.getName endsWith ".java") }'
> clean
> doc
> ; clean ; doc
# pure scala project, only scaladoc at top level
$ exists "target/api/index.js"
@ -24,8 +23,7 @@ $ absent "target/api/java"
> 'set sources in (Compile, doc) <<= sources in Compile map { _.filter(_.getName endsWith ".java") }'
> clean
> doc
> ; clean ; doc
# pure java project, only javadoc at top level
$ exists "target/api/package-list"