sbt / sbt-projectmatrix

MIT License
123 stars 14 forks source link

Provide a way to enable plugins per platform #52

Open thesamet opened 3 years ago

thesamet commented 3 years ago

It would be desirable to have a way (or if one already exists to document it), to enable an sbt plugin for a specific platform in the matrix. For example, scalajs-bundler's instructions suggest to install like this:

lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file("."))
  .jvmSettings(BuildSettings.jvmSettings)
  .jsSettings(BuildSettings.jsSettings)
  .jsConfigure { project => project.enablePlugins(ScalaJSBundlerPlugin) }

It looks like the only way in sbt-projectmatrix right now to transform a Project is by calling customRow() directly, however that would require me to copy-paste the definition of jsPlatform in my own SBT build and modify it accordingly.

sirthias commented 3 years ago

To underline the point: It doesn't make sense to have plugins like sbt-scalafmt or sbt-header enabled for all sub-projects/modules that share the same sources files. To complicate the matter: it does make sense to run those plugins on the source directories that are specific to the respective scala version or platform, i.e. /scala-2.13 or /scalajs.