Merge branch 'master' of git@github.com:harrah/xsbt

This commit is contained in:
Mark Harrah 2010-04-23 19:08:38 -04:00
commit ad8d44ed2b
8 changed files with 71 additions and 2 deletions

View File

@ -153,8 +153,15 @@ final class BuilderProject(val info: ProjectInfo, val pluginPath: Path, rawLogge
lazy val extract = pluginTask(extractSources()) dependsOn(autoUpdate)
lazy val autoUpdate = pluginTask(loadAndUpdate(false)) dependsOn(compile)
// manual update. force uptodate = false
lazy val update = task { setUptodate(false); loadAndUpdate(true) } dependsOn(compile)
lazy val update = task { manualUpdate() } dependsOn(compile) describedAs("Manual plugin update. Used when autoUpdate is disabled.")
def manualUpdate() =
{
setUptodate(false)
val result = loadAndUpdate(true)
logInfo("'reload' required to rebuild plugins.")
result
}
def doSync() = pluginCompileConditional.run orElse { setUptodate(true); None }
def extractSources() =
{

View File

@ -454,6 +454,7 @@ class xMain extends xsbti.AppMain
printCmd(SetAction + " <property> <value>", "Sets the value of the property given as its argument.")
printCmd(GetAction + " <property>", "Gets the value of the property given as its argument.")
printCmd(ProjectConsoleAction, "Enters the Scala interpreter with the current project definition bound to the variable 'current' and all members imported.")
printCmd(BuilderCommand, "Set the current project to be the project definition builder.")
if(!isInteractive)
printCmd(InteractiveCommand, "Enters the sbt interactive shell")
}

View File

@ -36,7 +36,8 @@ final case class ProjectInfo(projectDirectory: File, dependencies: Iterable[Proj
val builderPath = projectPath / ProjectInfo.MetadataDirectoryName
/** The boot directory contains the jars needed for building the project, including Scala, sbt, processors and dependencies of these.*/
def bootPath = builderPath / Project.BootDirectoryName
/** The path to the build definition project. */
/** The path to the build definition project.
* Currently, this is 'project/build'. */
def builderProjectPath = builderPath / Project.BuilderProjectDirectoryName
def builderProjectOutputPath = builderProjectPath / Project.DefaultOutputDirectoryName
/** The path to the plugin definition project. This declares the plugins to use for the build definition.*/

View File

@ -0,0 +1 @@
first.property=set-first

View File

@ -0,0 +1,2 @@
first.property=set-first
second.property=set-second

View File

@ -0,0 +1,2 @@
project.name=test-env
project.version=1.0

View File

@ -0,0 +1,29 @@
import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
lazy val FirstDefault = "a"
lazy val SecondDefault = "b"
lazy val FirstSet = "set-first"
lazy val SecondSet = "set-second"
lazy val extra = new BasicEnvironment
{
def log = Test.this.log
def envBackingPath = info.builderPath / "extra.properties"
lazy val firstProperty = propertyOptional[String](FirstDefault)
lazy val secondProperty = propertyOptional[String](SecondDefault)
}
import extra.{firstProperty, secondProperty}
lazy val checkFirstUnset = checkTask(firstProperty, FirstDefault, "first.property")
lazy val checkFirstSet = checkTask(firstProperty, FirstSet, "first.property")
lazy val checkSecondUnset = checkTask(secondProperty, SecondDefault, "second.property")
lazy val checkSecondSet = checkTask(secondProperty, SecondSet, "second.property")
def checkTask[T](property: extra.Property[T], expected: T, name: String): Task =
task { if(property.value == expected) None else Some("Expected "+name+" to be '" + expected + "', was: " + property.value) }
}

View File

@ -0,0 +1,26 @@
# check that both properties are unset
> check-first-unset
->check-first-set
> check-second-unset
->check-second-set
# create the extra properties file with only the first property set
$ copy-file changes/first.properties project/extra.properties
> reload
-> check-first-unset
>check-first-set
> check-second-unset
->check-second-set
# create the extra properties file with both properties set
$ copy-file changes/second.properties project/extra.properties
> reload
-> check-first-unset
>check-first-set
-> check-second-unset
>check-second-set