@@ -36,16 +36,16 @@ def crossSetting[A](
36
36
logo := Welcome .logo
37
37
usefulTasks := Welcome .tasks
38
38
39
- ThisBuild / scalafixScalaBinaryVersion := scalaBinaryVersion.value
39
+ ThisBuild / scalafixScalaBinaryVersion := " 2.13 "
40
40
41
41
inThisBuild(
42
42
List (
43
43
version ~= { dynVer =>
44
44
if (isCI) dynVer
45
45
else localSnapshotVersion // only for local publishing
46
46
},
47
- scalaVersion := V .scala213 ,
48
- crossScalaVersions := List (V .scala213 ),
47
+ scalaVersion := V .scala3 ,
48
+ crossScalaVersions := List (V .scala3 ),
49
49
organization := " org.scalameta" ,
50
50
licenses := Seq (
51
51
" Apache-2.0" -> url(" http://www.apache.org/licenses/LICENSE-2.0" )
@@ -128,7 +128,7 @@ commands ++= Seq(
128
128
runMtagsPublishLocal(st, v, localSnapshotVersion)
129
129
}
130
130
" interfaces/publishLocal" ::
131
- s " ++ ${V .scala213 } metals/publishLocal " ::
131
+ s " ++ ${V .scala3 } metals/publishLocal " ::
132
132
" mtags-java/publishLocal" ::
133
133
publishMtags
134
134
},
@@ -218,6 +218,27 @@ val sharedSettings = sharedJavacOptions ++ sharedScalacOptions ++ List(
218
218
)
219
219
),
220
220
),
221
+ excludeDependencies ++= crossSetting(
222
+ scalaVersion.value,
223
+ if3 = {
224
+ // Exclude cross published version dependencies leading to conflicts in Scala 3 vs 2.13
225
+ // When using Scala 3 exclude Scala 2.13 standard native libraries,
226
+ // when using Scala 2.13 exclude Scala 3 standard native libraries
227
+ // Use full name, Maven style published artifacts cannot use artifact/cross version for exclusion rules
228
+ List (
229
+ ExclusionRule ()
230
+ .withOrganization(" org.scala-lang.modules" )
231
+ .withName(
232
+ " scala-collection-compat_2.13"
233
+ ),
234
+ ExclusionRule ()
235
+ .withOrganization(" org.scala-lang.modules" )
236
+ .withName(
237
+ " scala-xml_2.13"
238
+ ),
239
+ )
240
+ },
241
+ ),
221
242
scalacOptions ++= lintingOptions(scalaVersion.value),
222
243
)
223
244
@@ -299,6 +320,10 @@ def withExcludes(moduleId: ModuleID) =
299
320
" com.lihaoyi" ,
300
321
" sourcecode_2.13" ,
301
322
) // avoid 2.13 and 3 on the classpath since it comes in via pprint
323
+ .exclude(
324
+ " org.scala-lang.modules" ,
325
+ " scala-parallel-collections_2.13" ,
326
+ ) // avoid 2.13 and 3 on the classpath since it comes in via pprint
302
327
303
328
def scala3SemanticdbDependency : ModuleID = withExcludes(
304
329
(" org.scalameta" % s " semanticdb-shared_ ${V .scala213}" % V .scalameta)
@@ -309,6 +334,10 @@ def scala3ScalametaDependency: ModuleID = withExcludes(
309
334
.cross(CrossVersion .for3Use2_13)
310
335
)
311
336
337
+ def scala3MetapDependency : ModuleID = withExcludes(
338
+ " org.scalameta" % s " semanticdb-metap_ ${V .scala213}" % V .scalameta
339
+ )
340
+
312
341
val mtagsSettings = List (
313
342
crossScalaVersions := V .supportedScalaVersions,
314
343
crossTarget := target.value / s " scala- ${scalaVersion.value}" ,
@@ -370,22 +399,22 @@ val mtagsSettings = List(
370
399
},
371
400
)
372
401
373
- lazy val mtags3 = project
402
+ lazy val mtags2 = project
374
403
.in(file(" .mtags" ))
375
404
.settings(
376
405
Compile / unmanagedSourceDirectories := Seq (),
377
406
sharedSettings,
378
407
mtagsSettings,
379
408
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags" / " src" / " main" / " scala" ,
380
409
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala" ,
381
- Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-3 " ,
382
- moduleName := " mtags3 " ,
383
- scalaVersion := V .scala3 ,
384
- target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target3 " ,
410
+ Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-2.13 " ,
411
+ moduleName := " mtags2 " ,
412
+ scalaVersion := V .scala213 ,
413
+ target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target2 " ,
385
414
publish / skip := true ,
386
415
libraryDependencies += V .guava,
387
416
scalafixConfig := Some (
388
- (ThisBuild / baseDirectory).value / " .scalafix3 .conf"
417
+ (ThisBuild / baseDirectory).value / " .scalafix2 .conf"
389
418
),
390
419
)
391
420
.dependsOn(interfaces)
@@ -433,26 +462,34 @@ lazy val metals = project
433
462
// for BSP
434
463
" org.scala-sbt.ipcsocket" % " ipcsocket" % " 1.6.2" ,
435
464
" ch.epfl.scala" % " bsp4j" % V .bsp,
436
- " ch.epfl.scala" %% " bloop-rifle" % V .bloop,
465
+ (" ch.epfl.scala" %% " bloop-rifle" % V .bloop)
466
+ .cross(CrossVersion .for3Use2_13),
437
467
// for LSP
438
468
V .lsp4j,
439
469
// for DAP
440
470
V .dap4j,
441
- " ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter,
471
+ (" ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter)
472
+ .cross(CrossVersion .for3Use2_13),
442
473
// for finding paths of global log/cache directories
443
474
" dev.dirs" % " directories" % " 26" ,
444
475
// ==================
445
476
// Scala dependencies
446
477
// ==================
447
478
" org.scalameta" % " mdoc-interfaces" % V .mdoc,
448
- " org.scalameta" %% " scalafmt-dynamic" % V .scalafmt,
479
+ (" org.scalameta" %% " scalafmt-dynamic" % V .scalafmt)
480
+ .cross(CrossVersion .for3Use2_13),
481
+ " com.googlecode.java-diff-utils" % " diffutils" % " 1.3.0" ,
449
482
" ch.epfl.scala" % " scalafix-interfaces" % V .scalafix,
450
483
// For reading classpaths.
451
484
// for fetching ch.epfl.scala:bloop-frontend and other library dependencies
452
485
" io.get-coursier" % " interface" % V .coursierInterfaces,
453
486
// for comparing versions && fetching from sbt maven repository
454
- " io.get-coursier" %% " coursier" % V .coursier,
455
- " io.get-coursier" %% " coursier-sbt-maven-repository" % V .coursier,
487
+ (" io.get-coursier" %% " versions" % " 0.3.2" )
488
+ .cross(CrossVersion .for3Use2_13),
489
+ (" io.get-coursier" %% " coursier-sbt-maven-repository" % V .coursier)
490
+ .cross(CrossVersion .for3Use2_13),
491
+ (" io.get-coursier" %% " coursier" % V .coursier)
492
+ .cross(CrossVersion .for3Use2_13),
456
493
// for logging
457
494
" com.outr" %% " scribe" % V .scribe,
458
495
" com.outr" %% " scribe-file" % V .scribe,
@@ -462,15 +499,12 @@ lazy val metals = project
462
499
// For fetching projects' templates
463
500
" com.lihaoyi" %% " requests" % " 0.9.0" ,
464
501
// for producing SemanticDB from Scala source files, to be sure we want the same version of scalameta
465
- " org.scalameta" %% " scalameta" % V .semanticdb(scalaVersion.value),
466
- " org.scalameta" %% " semanticdb-metap" % V .semanticdb(
467
- scalaVersion.value
468
- ) cross CrossVersion .full,
469
- " org.scalameta" % " semanticdb-shared" % V .semanticdb(
470
- scalaVersion.value
471
- ) cross CrossVersion .full,
502
+ scala3ScalametaDependency,
503
+ scala3MetapDependency,
504
+ scala3SemanticdbDependency,
472
505
// For starting Ammonite
473
- " io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" ,
506
+ (" io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" )
507
+ .cross(CrossVersion .for3Use2_13),
474
508
" org.scala-lang.modules" %% " scala-xml" % " 2.3.0" ,
475
509
" org.scala-lang.modules" %% " scala-parallel-collections" % " 1.0.4" ,
476
510
(" org.virtuslab.scala-cli" % " scala-cli-bsp" % V .scalaCli)
@@ -540,6 +574,7 @@ lazy val input = project
540
574
.in(file(" tests/input" ))
541
575
.settings(
542
576
sharedSettings,
577
+ scalaVersion := V .scala213,
543
578
scalacOptions -= " -Xsource:3" ,
544
579
publish / skip := true ,
545
580
libraryDependencies ++= List (
@@ -716,6 +751,7 @@ lazy val metalsDependencies = project
716
751
.in(file(" target/.dependencies" ))
717
752
.settings(
718
753
publish / skip := true ,
754
+ scalaVersion := V .scala213,
719
755
// silent the intransitive dependency warning
720
756
publishMavenStyle := false ,
721
757
libraryDependencies ++= List (
@@ -745,8 +781,10 @@ lazy val unit = project
745
781
sharedSettings,
746
782
Test / javaOptions += " -Xmx2G" ,
747
783
libraryDependencies ++= List (
748
- " io.get-coursier" %% " coursier" % V .coursier, // for jars
749
- " ch.epfl.scala" %% " bloop-config" % V .bloopConfig,
784
+ (" io.get-coursier" %% " coursier" % V .coursier)
785
+ .cross(CrossVersion .for3Use2_13), // for jars
786
+ (" ch.epfl.scala" %% " bloop-config" % V .bloopConfig)
787
+ .cross(CrossVersion .for3Use2_13),
750
788
" org.scalameta" %% " munit" % V .munit,
751
789
),
752
790
buildInfoPackage := " tests" ,
0 commit comments