mirror of https://github.com/sbt/sbt.git
Merge pull request #1253 from sbt/wip/fix-1247
FIx configuration ordering issues in sbt 0.13.5
This commit is contained in:
commit
5c513c909d
|
|
@ -469,7 +469,7 @@ object Load
|
|||
val autoConfigs = autoPlugins.flatMap(_.projectConfigurations)
|
||||
val loadedSbtFiles = loadSbtFiles(project.auto, project.base, autoPlugins, project.settings)
|
||||
// add the automatically selected settings, record the selected AutoPlugins, and register the automatically selected configurations
|
||||
val transformed = project.copy(settings = loadedSbtFiles.settings).setAutoPlugins(autoPlugins).overrideConfigs(autoConfigs : _*)
|
||||
val transformed = project.copy(settings = loadedSbtFiles.settings).setAutoPlugins(autoPlugins).prefixConfigs(autoConfigs : _*)
|
||||
(transformed, loadedSbtFiles.projects)
|
||||
}
|
||||
def defaultLoad = loadSbtFiles(AddSettings.defaultSbtFiles, buildBase, Nil, Nil).projects
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ sealed trait Project extends ProjectDefinition[ProjectReference]
|
|||
/** Adds configurations to this project. Added configurations replace existing configurations with the same name.*/
|
||||
def overrideConfigs(cs: Configuration*): Project = copy(configurations = Defaults.overrideConfigs(cs : _*)(configurations))
|
||||
|
||||
/** Adds configuration at the *start* of the configuration list for this rpoject. Prevous configurations replace this prefix
|
||||
* list with the same name.
|
||||
*/
|
||||
private[sbt] def prefixConfigs(cs: Configuration*): Project = copy(configurations = Defaults.overrideConfigs(configurations : _*)(cs))
|
||||
|
||||
/** Adds new configurations directly to this project. To override an existing configuration, use `overrideConfigs`. */
|
||||
def configs(cs: Configuration*): Project = copy(configurations = configurations ++ cs)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
lazy val foo = taskKey[Unit]("Runs the foo task")
|
||||
|
||||
lazy val bar = taskKey[Unit]("Runs the bar task")
|
||||
|
||||
def makeFoo(config: Configuration): Setting[_] =
|
||||
foo in config := IO.write(file(s"${config.name}-foo"), "foo")
|
||||
|
||||
lazy val PerformanceTest = (config("pt") extend Test)
|
||||
|
||||
lazy val root = (
|
||||
(project in file("."))
|
||||
.configs(PerformanceTest)
|
||||
.settings(Seq(Compile, Test, Runtime, PerformanceTest).map(makeFoo) :_*)
|
||||
.settings(
|
||||
bar in PerformanceTest := IO.write(file("pt-bar"), "bar")
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# First make sure a task just on the new config delegates.
|
||||
> bar
|
||||
$ exists pt-bar
|
||||
|
||||
|
||||
# Now make sure compile is the default configuration
|
||||
> foo
|
||||
$ exists compile-foo
|
||||
Loading…
Reference in New Issue