@@ -42,6 +42,7 @@ object cli extends Cli
42
42
43
43
object `cli-options` extends CliOptions
44
44
object `build-macros` extends BuildMacros
45
+ object config extends Cross [Config ](Scala .all: _* )
45
46
object options extends Options
46
47
object scalaparse extends ScalaParse
47
48
object directives extends Directives
@@ -157,10 +158,6 @@ trait BuildMacros extends ScalaCliSbtModule
157
158
with ScalaCliScalafixModule
158
159
with HasTests {
159
160
def scalaVersion = Scala .defaultInternal
160
- def scalacOptions = T {
161
- super .scalacOptions() ++
162
- (if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" ) else Nil )
163
- }
164
161
def compileIvyDeps = T {
165
162
if (scalaVersion().startsWith(" 3" ))
166
163
super .compileIvyDeps()
@@ -400,7 +397,7 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
400
397
def ivyDeps = super .ivyDeps() ++ Agg (
401
398
// Deps.asm,
402
399
Deps .bloopConfig,
403
- Deps .jsoniterCore ,
400
+ Deps .jsoniterCore213 ,
404
401
Deps .pprint,
405
402
Deps .scalametaTrees,
406
403
Deps .scalaparse,
@@ -440,6 +437,29 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
440
437
}
441
438
}
442
439
440
+ class Config (val crossScalaVersion : String ) extends ScalaCliCrossSbtModule
441
+ with ScalaCliPublishModule
442
+ with ScalaCliScalafixModule {
443
+ def ivyDeps = {
444
+ val maybeCollectionCompat =
445
+ if (crossScalaVersion.startsWith(" 2.12." )) Seq (Deps .collectionCompat)
446
+ else Nil
447
+ super .ivyDeps() ++ maybeCollectionCompat ++ Agg (
448
+ Deps .jsoniterCore
449
+ )
450
+ }
451
+ def compileIvyDeps = super .compileIvyDeps() ++ Agg (
452
+ Deps .jsoniterMacros
453
+ )
454
+
455
+ // Disabling Scalafix in 2.13 and 3, so that it doesn't remove
456
+ // some compatibility-related imports, that are actually only used
457
+ // in Scala 2.12.
458
+ def fix (args : String * ) =
459
+ if (crossScalaVersion.startsWith(" 2.12." )) super .fix(args : _* )
460
+ else T .command(())
461
+ }
462
+
443
463
trait Options extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
444
464
with ScalaCliScalafixModule {
445
465
def scalaVersion = Scala .defaultInternal
@@ -497,10 +517,6 @@ class Scala3Graal(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
497
517
)
498
518
super .resources() ++ Seq (mill.PathRef (extraResourceDir))
499
519
}
500
- def scalacOptions = T {
501
- super .scalacOptions() ++
502
- (if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" ) else Nil )
503
- }
504
520
}
505
521
506
522
trait Scala3GraalProcessor extends ScalaModule with ScalaCliPublishModule {
@@ -534,7 +550,7 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
534
550
Deps .asm,
535
551
Deps .collectionCompat,
536
552
Deps .javaClassName,
537
- Deps .jsoniterCore ,
553
+ Deps .jsoniterCore213 ,
538
554
Deps .nativeTestRunner,
539
555
Deps .osLib,
540
556
Deps .pprint,
@@ -582,7 +598,7 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
582
598
trait CliOptions extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
583
599
def ivyDeps = super .ivyDeps() ++ Agg (
584
600
Deps .caseApp,
585
- Deps .jsoniterCore ,
601
+ Deps .jsoniterCore213 ,
586
602
Deps .osLib,
587
603
Deps .signingCliOptions
588
604
)
@@ -651,15 +667,15 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
651
667
def scalaVersion = T (myScalaVersion)
652
668
653
669
def scalacOptions = T {
654
- super .scalacOptions() ++ asyncScalacOptions(scalaVersion()) ++
655
- (if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" ) else Nil )
670
+ super .scalacOptions() ++ asyncScalacOptions(scalaVersion())
656
671
}
657
672
def javacOptions = T {
658
673
super .javacOptions() ++ Seq (" --release" , " 16" )
659
674
}
660
675
def moduleDeps = Seq (
661
676
`build-module`,
662
677
`cli-options`,
678
+ config(Scala .scala3),
663
679
`scala3-graal`(Scala .scala3)
664
680
)
665
681
@@ -671,7 +687,7 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
671
687
Deps .coursierPublish,
672
688
Deps .jimfs, // scalaJsEnvNodeJs pulls jimfs:1.1, whose class path seems borked (bin compat issue with the guava version it depends on)
673
689
Deps .jniUtils,
674
- Deps .jsoniterCore ,
690
+ Deps .jsoniterCore213 ,
675
691
Deps .libsodiumjni,
676
692
Deps .metaconfigTypesafe,
677
693
Deps .pythonNativeLibs,
@@ -724,7 +740,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
724
740
PathRef (T .dest / " working-dir" )
725
741
}
726
742
def scalacOptions = T {
727
- super .scalacOptions() ++ Seq (" -Xasync" , " -Ywarn-unused " , " - deprecation" )
743
+ super .scalacOptions() ++ Seq (" -Xasync" , " -deprecation" )
728
744
}
729
745
730
746
def modulesPath = T {
@@ -752,7 +768,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
752
768
Deps .coursier
753
769
.exclude((" com.github.plokhotnyuk.jsoniter-scala" , " jsoniter-scala-macros" )),
754
770
Deps .dockerClient,
755
- Deps .jsoniterCore ,
771
+ Deps .jsoniterCore213 ,
756
772
Deps .libsodiumjni,
757
773
Deps .pprint,
758
774
Deps .scalaAsync,
@@ -939,11 +955,7 @@ class Runner(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
939
955
with ScalaCliPublishModule
940
956
with ScalaCliScalafixModule {
941
957
def scalacOptions = T {
942
- super .scalacOptions() ++ {
943
- if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" )
944
- else Nil
945
- } ++ Seq (" -release" , " 8" )
946
-
958
+ super .scalacOptions() ++ Seq (" -release" , " 8" )
947
959
}
948
960
def mainClass = Some (" scala.cli.runner.Runner" )
949
961
def sources = T .sources {
@@ -965,10 +977,7 @@ class TestRunner(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
965
977
with ScalaCliPublishModule
966
978
with ScalaCliScalafixModule {
967
979
def scalacOptions = T {
968
- super .scalacOptions() ++ {
969
- if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" , " -deprecation" )
970
- else Nil
971
- } ++ Seq (" -release" , " 8" )
980
+ super .scalacOptions() ++ Seq (" -release" , " 8" )
972
981
}
973
982
def ivyDeps = super .ivyDeps() ++ Agg (
974
983
Deps .asm,
@@ -983,9 +992,7 @@ class BloopRifle(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
983
992
with HasTests
984
993
with ScalaCliScalafixModule {
985
994
def scalacOptions = T {
986
- super .scalacOptions() ++
987
- (if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" ) else Nil ) ++
988
- Seq (" -deprecation" )
995
+ super .scalacOptions() ++ Seq (" -deprecation" )
989
996
}
990
997
def ivyDeps = super .ivyDeps() ++ Agg (
991
998
Deps .bsp4j,
@@ -1023,12 +1030,6 @@ class BloopRifle(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
1023
1030
class TastyLib (val crossScalaVersion : String ) extends ScalaCliCrossSbtModule
1024
1031
with ScalaCliPublishModule
1025
1032
with ScalaCliScalafixModule {
1026
- def scalacOptions = T (
1027
- super .scalacOptions() ++ {
1028
- if (scalaVersion().startsWith(" 2." )) Seq (" -Ywarn-unused" )
1029
- else Nil
1030
- }
1031
- )
1032
1033
def constantsFile = T .persistent {
1033
1034
val dir = T .dest / " constants"
1034
1035
val dest = dir / " Constants.scala"
0 commit comments