@@ -2,14 +2,27 @@ import _root_.bloop.integrations.sbt.BloopDefaults
22import build .BuildImplementation .BuildDefaults
33import xerial .sbt .Sonatype .SonatypeKeys
44
5- ( Global / useGpg) := false
5+ Global / useGpg := false
66
7- ( ThisBuild / dynverSeparator) := " -"
7+ ThisBuild / dynverSeparator := " -"
88
99// Tell bloop to aggregate source deps (benchmark) config files in the same bloop config dir
10- ( Global / bloopAggregateSourceDependencies) := true
10+ Global / bloopAggregateSourceDependencies := true
1111
12- (ThisBuild / bloopExportJarClassifiers) := Some (Set (" sources" ))
12+ ThisBuild / bloopExportJarClassifiers := Some (Set (" sources" ))
13+
14+ ThisBuild / scalafixDependencies += " com.github.liancheng" %% " organize-imports" % " 0.6.0"
15+
16+ val scalafixSettings : Seq [Setting [_]] = Seq (
17+ scalacOptions ++= {
18+ if (scalaVersion.value.startsWith(" 2.11" )) Seq (" -Ywarn-unused-import" )
19+ else if (scalaVersion.value.startsWith(" 2.12" )) Seq (" -Ywarn-unused" , " -Xlint:unused" )
20+ else if (scalaVersion.value.startsWith(" 2.13" )) Seq (" -Wunused" )
21+ else Seq .empty
22+ },
23+ semanticdbEnabled := true ,
24+ semanticdbVersion := scalafixSemanticdb.revision
25+ )
1326
1427/**
1528 * ************************************************************************************************
@@ -22,6 +35,7 @@ val benchmarkBridge = project
2235 .in(file(" .benchmark-bridge-compilation" ))
2336 .aggregate(BenchmarkBridgeCompilation )
2437 .disablePlugins(ScriptedPlugin )
38+ .settings(scalafixSettings)
2539 .settings(
2640 releaseEarly := { () },
2741 (publish / skip) := true ,
@@ -30,6 +44,7 @@ val benchmarkBridge = project
3044 )
3145
3246lazy val bloopShared = (project in file(" shared" ))
47+ .settings(scalafixSettings)
3348 .settings(
3449 name := " bloop-shared" ,
3550 libraryDependencies ++= Seq (
@@ -62,6 +77,7 @@ import build.Dependencies.{
6277lazy val backend = project
6378 .enablePlugins(BuildInfoPlugin )
6479 .disablePlugins(ScriptedPlugin )
80+ .settings(scalafixSettings)
6581 .settings(testSettings ++ testSuiteSettings)
6682 .dependsOn(bloopShared)
6783 .settings(
@@ -121,6 +137,7 @@ lazy val jsonConfig210 = crossProject(JVMPlatform)
121137 .crossType(CrossType .Pure )
122138 .in(file(" config" ))
123139 .disablePlugins(ScriptedPlugin )
140+ .disablePlugins(ScalafixPlugin )
124141 .settings(publishJsonModuleSettings)
125142 .settings(
126143 name := " bloop-config" ,
@@ -143,6 +160,7 @@ lazy val jsonConfig211 = crossProject(JSPlatform, JVMPlatform)
143160 .crossType(CrossType .Pure )
144161 .in(file(" config" ))
145162 .disablePlugins(ScriptedPlugin )
163+ .settings(scalafixSettings)
146164 .settings(publishJsonModuleSettings)
147165 .settings(
148166 name := " bloop-config" ,
@@ -173,6 +191,7 @@ lazy val jsonConfig212 = crossProject(JSPlatform, JVMPlatform)
173191 .crossType(CrossType .Pure )
174192 .in(file(" config" ))
175193 .disablePlugins(ScriptedPlugin )
194+ .settings(scalafixSettings)
176195 .settings(publishJsonModuleSettings)
177196 .settings(
178197 name := " bloop-config" ,
@@ -205,12 +224,13 @@ lazy val jsonConfig213 = crossProject(JSPlatform, JVMPlatform)
205224 .crossType(CrossType .Pure )
206225 .in(file(" config" ))
207226 .disablePlugins(ScriptedPlugin )
227+ .settings(scalafixSettings)
208228 .settings(publishJsonModuleSettings)
209229 .settings(
210230 name := " bloop-config" ,
211231 (Compile / unmanagedSourceDirectories) +=
212232 Keys .baseDirectory.value / " .." / " src" / " main" / " scala-2.11-13" ,
213- scalaVersion := " 2.13.1 " ,
233+ scalaVersion := Dependencies . Scala213Version ,
214234 testResourceSettings
215235 )
216236 .jvmSettings(
@@ -251,6 +271,7 @@ lazy val frontend: Project = project
251271 .disablePlugins(ScriptedPlugin )
252272 .enablePlugins(BuildInfoPlugin )
253273 .configs(IntegrationTest )
274+ .settings(scalafixSettings)
254275 .settings(assemblySettings, releaseSettings)
255276 .settings(
256277 testSettings,
@@ -362,6 +383,7 @@ lazy val bloopgun: Project = project
362383 .disablePlugins(ScriptedPlugin )
363384 .enablePlugins(BuildInfoPlugin )
364385 .enablePlugins(GraalVMNativeImagePlugin )
386+ .settings(scalafixSettings)
365387 .settings(testSuiteSettings)
366388 .settings(bloopgunSettings)
367389 .settings(target := (file(" bloopgun" ) / " target" / " bloopgun-2.12" ).getAbsoluteFile)
@@ -371,6 +393,7 @@ lazy val bloopgun213: Project = project
371393 .disablePlugins(ScriptedPlugin )
372394 .enablePlugins(BuildInfoPlugin )
373395 .enablePlugins(GraalVMNativeImagePlugin )
396+ .settings(scalafixSettings)
374397 .settings(testSuiteSettings)
375398 .settings(
376399 scalaVersion := Dependencies .Scala213Version ,
@@ -455,6 +478,7 @@ lazy val launcherTest = project
455478 .in(file(" launcher-test" ))
456479 .disablePlugins(ScriptedPlugin )
457480 .dependsOn(launcher, frontend % " test->test" )
481+ .settings(scalafixSettings)
458482 .settings(testSuiteSettings)
459483 .settings(
460484 name := " bloop-launcher-test" ,
@@ -469,6 +493,7 @@ lazy val launcher = project
469493 .in(file(" launcher-core" ))
470494 .disablePlugins(ScriptedPlugin )
471495 .dependsOn(sockets, bloopgun)
496+ .settings(scalafixSettings)
472497 .settings(testSuiteSettings)
473498 .settings(
474499 name := " bloop-launcher-core" ,
@@ -479,6 +504,7 @@ lazy val launcher213 = project
479504 .in(file(" launcher-core" ))
480505 .disablePlugins(ScriptedPlugin )
481506 .dependsOn(sockets, bloopgun213)
507+ .settings(scalafixSettings)
482508 .settings(testSuiteSettings)
483509 .settings(
484510 name := " bloop-launcher-core" ,
@@ -521,6 +547,7 @@ lazy val launcherShaded213 = project
521547lazy val bloop4j = project
522548 .disablePlugins(ScriptedPlugin )
523549 .dependsOn(jsonConfig212.jvm)
550+ .settings(scalafixSettings)
524551 .settings(
525552 name := " bloop4j" ,
526553 (run / fork) := true ,
@@ -534,6 +561,7 @@ lazy val benchmarks = project
534561 .dependsOn(frontend % " compile->it" , BenchmarkBridgeCompilation % " compile->compile" )
535562 .disablePlugins(ScriptedPlugin )
536563 .enablePlugins(BuildInfoPlugin , JmhPlugin )
564+ .settings(scalafixSettings)
537565 .settings(benchmarksSettings(frontend))
538566 .settings(
539567 (publish / skip) := true
@@ -654,6 +682,7 @@ lazy val sbtBloop10: Project = project
654682 .dependsOn(jsonConfig212.jvm, launcher, bloop4j)
655683 .enablePlugins(ScriptedPlugin )
656684 .in(integrations / " sbt-bloop" )
685+ .settings(scalafixSettings)
657686 .settings(BuildDefaults .scriptedSettings)
658687 .settings(sbtPluginSettings(" sbt-bloop-core" , Sbt1Version ))
659688
@@ -686,11 +715,13 @@ lazy val sbtBloop013Shaded =
686715lazy val mavenBloop = project
687716 .in(integrations / " maven-bloop" )
688717 .disablePlugins(ScriptedPlugin )
718+ .disablePlugins(ScalafixPlugin )
689719 .enablePlugins(BuildInfoPlugin )
690720 .dependsOn(jsonConfig213.jvm % " compile->compile;test->test" )
721+ .settings(scalafixSettings)
691722 .settings(
692723 name := " maven-bloop" ,
693- scalaVersion := (jsonConfig213.jvm / scalaVersion).value ,
724+ scalaVersion := Dependencies . Scala213Version ,
694725 publishM2 := publishM2.dependsOn(jsonConfig213.jvm / publishM2).value,
695726 BuildDefaults .mavenPluginBuildSettings,
696727 buildInfoKeys := Seq [BuildInfoKey ](version),
@@ -704,6 +735,7 @@ lazy val gradleBloop211 = project
704735 .disablePlugins(ScriptedPlugin )
705736 .dependsOn(jsonConfig211.jvm % " compile->compile;test->test" )
706737 .settings(name := " gradle-bloop" )
738+ .settings(scalafixSettings)
707739 .settings(BuildDefaults .gradlePluginBuildSettings)
708740 .settings(BuildInfoPlugin .buildInfoScopedSettings(Test ))
709741 .settings(scalaVersion := Dependencies .Scala211Version )
@@ -726,6 +758,7 @@ lazy val gradleBloop212 = project
726758 .enablePlugins(BuildInfoPlugin )
727759 .disablePlugins(ScriptedPlugin )
728760 .settings(name := " gradle-bloop" )
761+ .settings(scalafixSettings)
729762 .dependsOn(jsonConfig212.jvm % " compile->compile;test->test" , frontend % " test->test" )
730763 .settings(BuildDefaults .gradlePluginBuildSettings, testSettings)
731764 .settings(BuildInfoPlugin .buildInfoScopedSettings(Test ))
@@ -741,6 +774,7 @@ lazy val gradleBloop212 = project
741774 )
742775
743776lazy val buildpressConfig = (project in file(" buildpress-config" ))
777+ .settings(scalafixSettings)
744778 .settings(
745779 scalaVersion := Scala212Version ,
746780 libraryDependencies ++= List (
@@ -766,6 +800,7 @@ val docs = project
766800 .in(file(" docs-gen" ))
767801 .dependsOn(frontend)
768802 .enablePlugins(MdocPlugin , DocusaurusPlugin )
803+ .settings(scalafixSettings)
769804 .settings(
770805 name := " bloop-docs" ,
771806 moduleName := " bloop-docs" ,
@@ -782,6 +817,7 @@ lazy val jsBridge06 = project
782817 .dependsOn(frontend % Provided , frontend % " test->test" )
783818 .in(file(" bridges" ) / " scalajs-0.6" )
784819 .disablePlugins(ScriptedPlugin )
820+ .settings(scalafixSettings)
785821 .settings(testSettings)
786822 .settings(
787823 name := " bloop-js-bridge-0.6" ,
@@ -796,6 +832,7 @@ lazy val jsBridge1 = project
796832 .dependsOn(frontend % Provided , frontend % " test->test" )
797833 .in(file(" bridges" ) / " scalajs-1" )
798834 .disablePlugins(ScriptedPlugin )
835+ .settings(scalafixSettings)
799836 .settings(testSettings)
800837 .settings(
801838 name := " bloop-js-bridge-1" ,
@@ -812,6 +849,7 @@ lazy val jsBridge1 = project
812849lazy val nativeBridge04 = project
813850 .dependsOn(frontend % Provided , frontend % " test->test" )
814851 .in(file(" bridges" ) / " scala-native-0.4" )
852+ .settings(scalafixSettings)
815853 .disablePlugins(ScriptedPlugin )
816854 .settings(testSettings)
817855 .settings(
0 commit comments