@@ -44,16 +44,16 @@ def crossSetting[A](
44
44
logo := Welcome .logo
45
45
usefulTasks := Welcome .tasks
46
46
47
- ThisBuild / scalafixScalaBinaryVersion := scalaBinaryVersion.value
47
+ ThisBuild / scalafixScalaBinaryVersion := " 2.13 "
48
48
49
49
inThisBuild(
50
50
List (
51
51
version ~= { dynVer =>
52
52
if (isCI) dynVer
53
53
else localSnapshotVersion // only for local publishing
54
54
},
55
- scalaVersion := V .scala213 ,
56
- crossScalaVersions := List (V .scala213 ),
55
+ scalaVersion := V .scala3 ,
56
+ crossScalaVersions := List (V .scala3 ),
57
57
organization := " org.scalameta" ,
58
58
licenses := Seq (
59
59
" Apache-2.0" -> url(" http://www.apache.org/licenses/LICENSE-2.0" )
@@ -137,7 +137,7 @@ commands ++= Seq(
137
137
runMtagsPublishLocal(st, v, localSnapshotVersion)
138
138
}
139
139
" interfaces/publishLocal" ::
140
- s " ++ ${V .scala213 } metals/publishLocal " ::
140
+ s " ++ ${V .scala3 } metals/publishLocal " ::
141
141
" mtags-java/publishLocal" ::
142
142
publishMtags
143
143
},
@@ -220,6 +220,27 @@ val sharedSettings = sharedJavacOptions ++ sharedScalacOptions ++ List(
220
220
)
221
221
),
222
222
),
223
+ excludeDependencies ++= crossSetting(
224
+ scalaVersion.value,
225
+ if3 = {
226
+ // Exclude cross published version dependencies leading to conflicts in Scala 3 vs 2.13
227
+ // When using Scala 3 exclude Scala 2.13 standard native libraries,
228
+ // when using Scala 2.13 exclude Scala 3 standard native libraries
229
+ // Use full name, Maven style published artifacts cannot use artifact/cross version for exclusion rules
230
+ List (
231
+ ExclusionRule ()
232
+ .withOrganization(" org.scala-lang.modules" )
233
+ .withName(
234
+ " scala-collection-compat_2.13"
235
+ ),
236
+ ExclusionRule ()
237
+ .withOrganization(" org.scala-lang.modules" )
238
+ .withName(
239
+ " scala-xml_2.13"
240
+ ),
241
+ )
242
+ },
243
+ ),
223
244
scalacOptions ++= lintingOptions(scalaVersion.value),
224
245
)
225
246
@@ -282,21 +303,19 @@ def multiScalaDirectories(root: File, scalaVersion: String) = {
282
303
result.toList
283
304
}
284
305
285
- def scala3ScalametaDependency =
286
- (" org.scalameta" %% " scalameta" % V .scalameta)
287
- .cross(CrossVersion .for3Use2_13)
288
- .exclude(" org.scala-lang" , " scala-reflect" )
289
- .exclude(" org.scala-lang" , " scala-compiler" )
290
- // the correct one should be brought in by the scala 3 compiler
291
- .exclude(" org.scala-lang" , " scala-library" )
292
- .exclude(
293
- " com.lihaoyi" ,
294
- " geny_2.13" ,
295
- ) // avoid 2.13 and 3 on the classpath since we rely on it directly
296
- .exclude(
297
- " com.lihaoyi" ,
298
- " sourcecode_2.13" ,
299
- ) // avoid 2.13 and 3 on the classpath since it comes in via pprint
306
+ def scalametaDependency = (" org.scalameta" %% " scalameta" % V .scalameta)
307
+ .cross(CrossVersion .for3Use2_13)
308
+ .exclude(" org.scala-lang" , " scala-reflect" )
309
+ .exclude(" org.scala-lang" , " scala-compiler" )
310
+ .exclude(" org.scala-lang.modules" , " scala-collection-compat" )
311
+ .exclude(
312
+ " com.lihaoyi" ,
313
+ " geny_2.13" ,
314
+ ) // avoid 2.13 and 3 on the classpath since we rely on it directly
315
+ .exclude(
316
+ " com.lihaoyi" ,
317
+ " sourcecode_2.13" ,
318
+ )
300
319
301
320
val mtagsSettings = List (
302
321
crossScalaVersions := V .supportedScalaVersions ++ V .nightlyScala3Versions,
@@ -327,7 +346,7 @@ val mtagsSettings = List(
327
346
),
328
347
if3 = List (
329
348
" org.scala-lang" %% " scala3-compiler" % scalaVersion.value,
330
- scala3ScalametaDependency ,
349
+ scalametaDependency ,
331
350
),
332
351
if3WithPresentationCompiler = List (
333
352
" org.scala-lang" %% " scala3-presentation-compiler" % scalaVersion.value
@@ -360,21 +379,21 @@ val mtagsSettings = List(
360
379
},
361
380
)
362
381
363
- lazy val mtags3 = project
382
+ lazy val mtags2 = project
364
383
.in(file(" .mtags" ))
365
384
.settings(
366
385
Compile / unmanagedSourceDirectories := Seq (),
367
386
sharedSettings,
368
387
mtagsSettings,
369
388
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags" / " src" / " main" / " scala" ,
370
389
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala" ,
371
- Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-3 " ,
372
- moduleName := " mtags3 " ,
373
- scalaVersion := V .scala3 ,
374
- target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target3 " ,
390
+ Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-2.13 " ,
391
+ moduleName := " mtags2 " ,
392
+ scalaVersion := V .scala213 ,
393
+ target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target2 " ,
375
394
publish / skip := true ,
376
395
scalafixConfig := Some (
377
- (ThisBuild / baseDirectory).value / " .scalafix3 .conf"
396
+ (ThisBuild / baseDirectory).value / " .scalafix2 .conf"
378
397
),
379
398
)
380
399
.dependsOn(interfaces)
@@ -391,9 +410,6 @@ lazy val mtags3WithPresentationCompiler = project
391
410
scalaVersion := V .firstScala3PCVersion,
392
411
target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target3-wrapper" ,
393
412
publish / skip := true ,
394
- scalafixConfig := Some (
395
- (ThisBuild / baseDirectory).value / " .scalafix3.conf"
396
- ),
397
413
)
398
414
.dependsOn(interfaces)
399
415
.enablePlugins(BuildInfoPlugin )
@@ -443,7 +459,8 @@ lazy val metals = project
443
459
// for BSP
444
460
" org.scala-sbt.ipcsocket" % " ipcsocket" % " 1.6.2" ,
445
461
" ch.epfl.scala" % " bsp4j" % V .bsp,
446
- " ch.epfl.scala" %% " bloop-launcher-core" % V .bloop,
462
+ (" ch.epfl.scala" %% " bloop-launcher-core" % V .bloop)
463
+ .cross(CrossVersion .for3Use2_13),
447
464
// for LSP
448
465
V .lsp4j,
449
466
// for DAP
@@ -473,13 +490,16 @@ lazy val metals = project
473
490
// Scala dependencies
474
491
// ==================
475
492
" org.scalameta" % " mdoc-interfaces" % V .mdoc,
476
- " org.scalameta" %% " scalafmt-dynamic" % V .scalafmt,
493
+ (" org.scalameta" %% " scalafmt-dynamic" % V .scalafmt)
494
+ .cross(CrossVersion .for3Use2_13),
495
+ " com.googlecode.java-diff-utils" % " diffutils" % " 1.3.0" ,
477
496
" ch.epfl.scala" % " scalafix-interfaces" % V .scalafix,
478
497
// For reading classpaths.
479
498
// for fetching ch.epfl.scala:bloop-frontend and other library dependencies
480
499
" io.get-coursier" % " interface" % V .coursierInterfaces,
481
500
// for comparing versions
482
- " io.get-coursier" %% " versions" % " 0.3.2" ,
501
+ (" io.get-coursier" %% " versions" % " 0.3.2" )
502
+ .cross(CrossVersion .for3Use2_13),
483
503
// for logging
484
504
" com.outr" %% " scribe" % V .scribe,
485
505
" com.outr" %% " scribe-file" % V .scribe,
@@ -489,10 +509,11 @@ lazy val metals = project
489
509
// For remote language server
490
510
" com.lihaoyi" %% " requests" % " 0.8.0" ,
491
511
// for producing SemanticDB from Scala source files
492
- " org.scalameta " %% " scalameta " % V .scalameta ,
493
- " org.scalameta" % " semanticdb-scalac-core" % V .scalameta cross CrossVersion .full,
512
+ scalametaDependency ,
513
+ // "org.scalameta" % "semanticdb-scalac-core" % V.scalameta cross CrossVersion.full,
494
514
// For starting Ammonite
495
- " io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" ,
515
+ (" io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" )
516
+ .cross(CrossVersion .for3Use2_13),
496
517
" org.scala-lang.modules" %% " scala-xml" % " 2.2.0" ,
497
518
" org.scala-lang.modules" %% " scala-parallel-collections" % " 1.0.4" ,
498
519
(" org.virtuslab.scala-cli" % " scala-cli-bsp" % V .scalaCli)
@@ -558,6 +579,7 @@ lazy val `sbt-metals` = project
558
579
lazy val input = project
559
580
.in(file(" tests/input" ))
560
581
.settings(
582
+ scalaVersion := V .scala213,
561
583
sharedSettings,
562
584
publish / skip := true ,
563
585
libraryDependencies ++= List (
@@ -690,7 +712,7 @@ lazy val mtest = project
690
712
),
691
713
libraryDependencies ++= {
692
714
if (isScala3WithPresentationCompiler(scalaVersion.value))
693
- List (scala3ScalametaDependency )
715
+ List (scalametaDependency )
694
716
else Nil
695
717
},
696
718
Compile / unmanagedSourceDirectories ++= {
@@ -742,6 +764,7 @@ def isInTestShard(name: String, logger: Logger): Boolean = {
742
764
lazy val metalsDependencies = project
743
765
.in(file(" target/.dependencies" ))
744
766
.settings(
767
+ scalaVersion := V .scala213,
745
768
publish / skip := true ,
746
769
// silent the intransitive dependency warning
747
770
publishMavenStyle := false ,
@@ -750,13 +773,13 @@ lazy val metalsDependencies = project
750
773
// will pick them up and update them. They aren't actually used.
751
774
" com.lihaoyi" %% " ammonite-util" % V .ammonite,
752
775
" org.typelevel" % " kind-projector" % V .kindProjector cross CrossVersion .full,
753
- " com.olegpy" %% " better-monadic-for" % V .betterMonadicFor,
776
+ ( " com.olegpy" %% " better-monadic-for" % V .betterMonadicFor) ,
754
777
" com.lihaoyi" % " mill-contrib-testng" % V .mill,
755
778
" org.virtuslab.scala-cli" % " cli_3" % V .scalaCli intransitive (),
756
779
" ch.epfl.scala" % " bloop-maven-plugin" % V .mavenBloop,
757
780
" ch.epfl.scala" %% " gradle-bloop" % V .gradleBloop,
758
781
" com.sourcegraph" % " semanticdb-java" % V .javaSemanticdb,
759
- " ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter intransitive (),
782
+ ( " ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter) intransitive (),
760
783
),
761
784
)
762
785
.disablePlugins(ScalafixPlugin )
@@ -771,9 +794,16 @@ lazy val unit = project
771
794
sharedSettings,
772
795
Test / javaOptions += " -Xmx2G" ,
773
796
libraryDependencies ++= List (
774
- " io.get-coursier" %% " coursier" % V .coursier, // for jars
775
- " ch.epfl.scala" %% " bloop-config" % V .bloopConfig,
797
+ (" io.get-coursier" %% " coursier" % V .coursier)
798
+ .cross(CrossVersion .for3Use2_13), // for jars
799
+ (" ch.epfl.scala" %% " bloop-config" % V .bloopConfig)
800
+ .cross(CrossVersion .for3Use2_13),
776
801
" org.scalameta" %% " munit" % V .munit,
802
+ // The dependencies listed below are only listed so Scala Steward
803
+ // will pick them up and update them. They aren't actually used.
804
+ (" com.lihaoyi" %% " ammonite-util" % V .ammonite intransitive ())
805
+ .cross(CrossVersion .for3Use2_13),
806
+ " com.lihaoyi" % " mill-contrib-testng" % V .mill intransitive (),
777
807
),
778
808
buildInfoPackage := " tests" ,
779
809
Compile / resourceGenerators += InputProperties
0 commit comments