-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.scala
50 lines (39 loc) · 1.76 KB
/
plugin.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package africa.shuwari.sbt
import org.typelevel.sbt.tpolecat.CiMode
import org.typelevel.sbt.tpolecat.ReleaseMode
import org.typelevel.sbt.tpolecat.TpolecatPlugin
import org.typelevel.sbt.tpolecat.VerboseMode
import org.typelevel.scalacoptions.ScalacOption
import sbt.{ScalaVersion as _, *}
import scala.collection.GenTraversableOnce
import africa.shuwari.sbt.BuildModePlugin.Mode
import africa.shuwari.sbt.JSKeys.*
import scala.language.implicitConversions
object ScalaOptionsPlugin extends AutoPlugin {
object autoImport {
final val ScalaCompiler = JSKeys
final val ScalacOption = org.typelevel.scalacoptions.ScalacOption
type ScalacOption = org.typelevel.scalacoptions.ScalacOption
}
override def requires: Plugins = BuildModePlugin && TpolecatPlugin
override def trigger: PluginTrigger = allRequirements
def tpolecatPluginModeSetting = Def.setting {
BuildModePlugin.buildMode.value match {
case Mode.Development => VerboseMode
case Mode.Integration => CiMode
case Mode.Release => ReleaseMode
}
}
override def projectSettings: Seq[Setting[?]] = List(
basePackages := List.empty,
TpolecatPlugin.autoImport.tpolecatVerboseModeOptions := TpolecatPlugin.autoImport.tpolecatDevModeOptions.value,
TpolecatPlugin.autoImport.tpolecatDevModeOptions := ScalaCompilerOptions.developmentOptions.value,
TpolecatPlugin.autoImport.tpolecatCiModeOptions := ScalaCompilerOptions
.ciOptions(TpolecatPlugin.autoImport.tpolecatReleaseModeOptions)
.value,
TpolecatPlugin.autoImport.tpolecatReleaseModeOptions := ScalaCompilerOptions
.tpolecatReleaseOptionsSetting(TpolecatPlugin.autoImport.tpolecatDevModeOptions)
.value,
TpolecatPlugin.autoImport.tpolecatOptionsMode := tpolecatPluginModeSetting.value
)
}