Support providing settings via Global and ThisBuild
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently all the settings are rigidly defined at the project level (foo := defaultFoo
in projectSettings
). This means that the users can only override each of them at the project level - so Global/foo
and ThisBuild/foo
are ignored. This is inconvenient for multi-project builds, where it makes sense to provide project-wide overrides in local.sbt
.
Describe the solution you’d like
Most of the defaults don’t depend on the other project settings (e.g. foo := baseDirectory.value
), and don’t use extra scoping (e.g. aggregate in foo
) . We should move those to globalSettings
as described here. For the other settings we should only provide the default if there’s no previous value:
foo := foo.?.value.getOrElse(defaultFoo)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
What is the difference between ThisBuild and Global scopes?
I'll quote relevant parts: There are three scope axes: The subproject axis; The dependency configuration axis; The task axis. Scoping by project ...
Read more >sbt Reference Manual — Scopes
Each setting defined in the build definition (for example in build.sbt ) applies to a scoped key ... Run sbt and inspect name...
Read more >Consider scoping the scala version only in ThisBuild or in Global
This often causes problems when people want to set their scala versions globally, because they are overriden by the sbt defaults.
Read more >Making sense of SBT - Beyond the lines
We've seen that SBT provides a DSL to defined tasks ( Setting can be considered as a Task that runs only once). This...
Read more >An introduction to SBT - Rock the JVM Blog
Now, let's look at the other configuration options in the build.sbt file. We can provide a version for the project using the option...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your explanation. In my day to day work I only see rather simple project setups, so I highly value input from a point of view of more complex setups. I suggest to release it like it currently is and address other more special use cases if any come up later. I’ll update the docs for this PR and prepare a v3.0.0 release.
@albuch, in that quote I was talking about the defaults that are, by their nature, local to a project. In your PR, those are
We can’t reduce those to
Global
settings.I wasn’t arguing about adding new defaults, just about massaging the existing ones.
Scope delegation is not involved here.
dependencyCheckOutputDirectory
settings in the plugin and inbuild.sbt
(on project level) have to use the same scope.Probably. I can imagine a situation with user code in a separate
AutoPlugin
settingdependencyCheckOutputDirectory
, but not defining a dependency onDependencyCheckPlugin
- in which case the resulting value ofdependencyCheckOutputDirectory
would depend on the order in which SBT happens to apply the plugins. Though that does sound as an unlikely scenario/use case, so I’m probably overthinking it.All an all, I’m perfectly happy with just moving the “simple” defaults to
Global
, as you have done in your PR.