-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We now maintain a set of `ScalacOptions` "managed" by sbt-tpolecat. When computing `scalacOptions`, we do not overwrite them, but instead we get the previous `scalacOptions.value` and we modify it. We only remove options that are managed by sbt-tpolecat. And we only add options that are not already there (because they were already added in an upper delegate scope). By default, we automatically compute the set of managed options as all the options that are "ever" added once by sbt-tpolecat in the delegate chain.
- Loading branch information
Showing
4 changed files
with
126 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
plugin/src/sbt-test/sbt-tpolecat/scalacOptions/project/OtherPlugin.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package build | ||
|
||
import sbt.Keys._ | ||
import sbt._ | ||
|
||
object OtherPlugin extends AutoPlugin { | ||
object autoImport { | ||
val otherPluginActivate = settingKey[Boolean]("activate the options of OtherPlugin") | ||
} | ||
|
||
import autoImport._ | ||
|
||
override def globalSettings: Seq[Setting[_]] = Seq( | ||
otherPluginActivate := false | ||
) | ||
|
||
override def projectSettings: Seq[Setting[_]] = Seq( | ||
scalacOptions ++= { | ||
if (otherPluginActivate.value) Seq("other-plugin-option-1") | ||
else Nil | ||
}, | ||
Compile / scalacOptions ++= { | ||
if (otherPluginActivate.value) Seq("other-plugin-option-2") | ||
else Nil | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters