mirror of https://github.com/sbt/sbt.git
Merge branch 'master' of git@github.com:harrah/xsbt
This commit is contained in:
commit
ad8d44ed2b
|
|
@ -153,8 +153,15 @@ final class BuilderProject(val info: ProjectInfo, val pluginPath: Path, rawLogge
|
||||||
lazy val extract = pluginTask(extractSources()) dependsOn(autoUpdate)
|
lazy val extract = pluginTask(extractSources()) dependsOn(autoUpdate)
|
||||||
lazy val autoUpdate = pluginTask(loadAndUpdate(false)) dependsOn(compile)
|
lazy val autoUpdate = pluginTask(loadAndUpdate(false)) dependsOn(compile)
|
||||||
// manual update. force uptodate = false
|
// 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 doSync() = pluginCompileConditional.run orElse { setUptodate(true); None }
|
||||||
def extractSources() =
|
def extractSources() =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,7 @@ class xMain extends xsbti.AppMain
|
||||||
printCmd(SetAction + " <property> <value>", "Sets the value of the property given as its argument.")
|
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(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(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)
|
if(!isInteractive)
|
||||||
printCmd(InteractiveCommand, "Enters the sbt interactive shell")
|
printCmd(InteractiveCommand, "Enters the sbt interactive shell")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ final case class ProjectInfo(projectDirectory: File, dependencies: Iterable[Proj
|
||||||
val builderPath = projectPath / ProjectInfo.MetadataDirectoryName
|
val builderPath = projectPath / ProjectInfo.MetadataDirectoryName
|
||||||
/** The boot directory contains the jars needed for building the project, including Scala, sbt, processors and dependencies of these.*/
|
/** The boot directory contains the jars needed for building the project, including Scala, sbt, processors and dependencies of these.*/
|
||||||
def bootPath = builderPath / Project.BootDirectoryName
|
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 builderProjectPath = builderPath / Project.BuilderProjectDirectoryName
|
||||||
def builderProjectOutputPath = builderProjectPath / Project.DefaultOutputDirectoryName
|
def builderProjectOutputPath = builderProjectPath / Project.DefaultOutputDirectoryName
|
||||||
/** The path to the plugin definition project. This declares the plugins to use for the build definition.*/
|
/** The path to the plugin definition project. This declares the plugins to use for the build definition.*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
first.property=set-first
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
first.property=set-first
|
||||||
|
second.property=set-second
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
project.name=test-env
|
||||||
|
project.version=1.0
|
||||||
|
|
@ -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) }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue