Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto plugins are required to declare their project configurations #676

Closed
huntc opened this issue Oct 4, 2015 · 5 comments
Closed

Auto plugins are required to declare their project configurations #676

huntc opened this issue Oct 4, 2015 · 5 comments
Assignees

Comments

@huntc
Copy link
Contributor

huntc commented Oct 4, 2015

Auto plugins are required to register any configurations that they may introduce in order to allow a user to declare any addition configurations of their own. For example, given some other configuration named Backend:

lazy val root = (project in file("."))
  .enablePlugins(JavaAppPackaging)
  .configs(Backend)

...a bundle:dist will subsequently fail as the plugin's configurations are effectively zapped.

Each new auto plugin that introduces a configuration should declare the configurations that it provides so that they may be prepended to declarations such as the one above. The method to override for each auto plugin is projectConfigurations. Here's an example from sbt-bundle (pending a PR):

  override def projectConfigurations: Seq[Configuration] =
    Seq(
      Bundle,
      BundleConfiguration
    )
@muuki88
Copy link
Contributor

muuki88 commented Oct 4, 2015

So for example our DockerPlugin should have an additional line

  object autoImport extends DockerKeys {
    val Docker = config("docker") extend Universal
  }
  import autoImport._

override def projectConfigurations: Seq[Configuration] = Docker :: Nil

Does this have any effect on existing behaviour?

@huntc
Copy link
Contributor Author

huntc commented Oct 4, 2015

I understand that adding it is benign.

@huntc
Copy link
Contributor Author

huntc commented Oct 4, 2015

I took a look at the sbt source and the auto plugin config sequence is prepended to any user supplied config via this override.

Perhaps @eed3si9n can confirm the effect of overriding the method as the right thing to do though.

@muuki88 muuki88 self-assigned this Mar 20, 2016
muuki88 added a commit that referenced this issue Mar 28, 2016
FIX #676 adding configuration scopes to project configurations
@huntc
Copy link
Contributor Author

huntc commented Mar 28, 2016

Nice work!

@muuki88
Copy link
Contributor

muuki88 commented Mar 28, 2016

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants