mirror of https://github.com/sbt/sbt.git
Merge pull request #1902 from dwijnand/define-project-settings-with-SettingsDefinition
Define Project.settings with SettingsDefinition.
This commit is contained in:
commit
b4a5265aaa
|
|
@ -141,7 +141,7 @@ sealed trait Project extends ProjectDefinition[ProjectReference] {
|
||||||
def aggregate(refs: ProjectReference*): Project = copy(aggregate = (aggregate: Seq[ProjectReference]) ++ refs)
|
def aggregate(refs: ProjectReference*): Project = copy(aggregate = (aggregate: Seq[ProjectReference]) ++ refs)
|
||||||
|
|
||||||
/** Appends settings to the current settings sequence for this project. */
|
/** Appends settings to the current settings sequence for this project. */
|
||||||
def settings(ss: Setting[_]*): Project = copy(settings = (settings: Seq[Setting[_]]) ++ ss)
|
def settings(ss: SettingsDefinition*): Project = copy(settings = (settings: Seq[Setting[_]]) ++ ss.flatMap(_.settings))
|
||||||
|
|
||||||
@deprecated("Use settingSets method.", "0.13.5")
|
@deprecated("Use settingSets method.", "0.13.5")
|
||||||
def autoSettings(select: AddSettings*): Project = settingSets(select.toSeq: _*)
|
def autoSettings(select: AddSettings*): Project = settingSets(select.toSeq: _*)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
[@dwijnand]: https://github.com/dwijnand
|
||||||
|
[1902]: https://github.com/sbt/sbt/pull/1902
|
||||||
|
|
||||||
|
### Fixes with compatibility implications
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- Facilitate nicer ways of declaring project settings. See below. [#1902][1902] by [@dwijnand][@dwijnand]
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
### Nicer ways of declaring project settings
|
||||||
|
|
||||||
|
Now a `Seq[Setting[_]]` can be passed to `Project.settings` without the needs for "varargs expansion", ie. `: _*`
|
||||||
|
|
||||||
|
Instead of:
|
||||||
|
|
||||||
|
lazy val foo = project settings (sharedSettings: _*)
|
||||||
|
|
||||||
|
It is now possible to do:
|
||||||
|
|
||||||
|
lazy val foo = project settings sharedSettings
|
||||||
|
|
||||||
|
Also, `Seq[Setting[_]]` can be declared at the same level as individual settings in `Project.settings`, for instance:
|
||||||
|
|
||||||
|
lazy val foo = project settings (
|
||||||
|
sharedSettings,
|
||||||
|
version := "1.0",
|
||||||
|
someMoreSettings
|
||||||
|
)
|
||||||
|
|
||||||
|
[#1902][1902] by [@dwijnand][@dwijnand]
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
// Just checking that existing ways of
|
||||||
|
// setting up projects typechecks
|
||||||
|
|
||||||
|
val sharedSettings1 = Seq(
|
||||||
|
name := "sharedSettings1"
|
||||||
|
)
|
||||||
|
|
||||||
|
val sharedSettings2 = Seq[Setting[_]](
|
||||||
|
name := "sharedSettings2"
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val root = project in file(".")
|
||||||
|
|
||||||
|
lazy val oldSchool = (project
|
||||||
|
settings ((sharedSettings1 ++ sharedSettings2): _*)
|
||||||
|
settings (
|
||||||
|
name := "pre seq settings"
|
||||||
|
)
|
||||||
|
settings (sharedSettings1: _*)
|
||||||
|
settings (
|
||||||
|
name := "mid seq settings"
|
||||||
|
)
|
||||||
|
settings (sharedSettings2: _*)
|
||||||
|
settings (
|
||||||
|
name := "post seq settings"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val newSchool = (project
|
||||||
|
settings sharedSettings1
|
||||||
|
settings sharedSettings2
|
||||||
|
settings (
|
||||||
|
name := "pre seq settings",
|
||||||
|
sharedSettings1,
|
||||||
|
name := "mid seq settings",
|
||||||
|
sharedSettings2,
|
||||||
|
name := "post seq settings"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> about
|
||||||
Loading…
Reference in New Issue