@@ -46,16 +46,16 @@ def crossSetting[A](
46
46
logo := Welcome .logo
47
47
usefulTasks := Welcome .tasks
48
48
49
- ThisBuild / scalafixScalaBinaryVersion := scalaBinaryVersion.value
49
+ ThisBuild / scalafixScalaBinaryVersion := " 2.13 "
50
50
51
51
inThisBuild(
52
52
List (
53
53
version ~= { dynVer =>
54
54
if (isCI) dynVer
55
55
else localSnapshotVersion // only for local publishing
56
56
},
57
- scalaVersion := V .scala213 ,
58
- crossScalaVersions := List (V .scala213 ),
57
+ scalaVersion := V .scala3 ,
58
+ crossScalaVersions := List (V .scala3 ),
59
59
organization := " org.scalameta" ,
60
60
licenses := Seq (
61
61
" Apache-2.0" -> url(" http://www.apache.org/licenses/LICENSE-2.0" )
@@ -138,7 +138,7 @@ commands ++= Seq(
138
138
runMtagsPublishLocal(st, v, localSnapshotVersion)
139
139
}
140
140
" interfaces/publishLocal" ::
141
- s " ++ ${V .scala213 } metals/publishLocal " ::
141
+ s " ++ ${V .scala3 } metals/publishLocal " ::
142
142
" mtags-java/publishLocal" ::
143
143
publishMtags
144
144
},
@@ -226,6 +226,27 @@ val sharedSettings = sharedJavacOptions ++ sharedScalacOptions ++ List(
226
226
)
227
227
),
228
228
),
229
+ excludeDependencies ++= crossSetting(
230
+ scalaVersion.value,
231
+ if3 = {
232
+ // Exclude cross published version dependencies leading to conflicts in Scala 3 vs 2.13
233
+ // When using Scala 3 exclude Scala 2.13 standard native libraries,
234
+ // when using Scala 2.13 exclude Scala 3 standard native libraries
235
+ // Use full name, Maven style published artifacts cannot use artifact/cross version for exclusion rules
236
+ List (
237
+ ExclusionRule ()
238
+ .withOrganization(" org.scala-lang.modules" )
239
+ .withName(
240
+ " scala-collection-compat_2.13"
241
+ ),
242
+ ExclusionRule ()
243
+ .withOrganization(" org.scala-lang.modules" )
244
+ .withName(
245
+ " scala-xml_2.13"
246
+ ),
247
+ )
248
+ },
249
+ ),
229
250
scalacOptions ++= lintingOptions(scalaVersion.value),
230
251
)
231
252
@@ -293,21 +314,19 @@ def multiScalaDirectories(root: File, scalaVersion: String) = {
293
314
result.toList
294
315
}
295
316
296
- def scala3ScalametaDependency =
297
- (" org.scalameta" %% " scalameta" % V .scalameta)
298
- .cross(CrossVersion .for3Use2_13)
299
- .exclude(" org.scala-lang" , " scala-reflect" )
300
- .exclude(" org.scala-lang" , " scala-compiler" )
301
- // the correct one should be brought in by the scala 3 compiler
302
- .exclude(" org.scala-lang" , " scala-library" )
303
- .exclude(
304
- " com.lihaoyi" ,
305
- " geny_2.13" ,
306
- ) // avoid 2.13 and 3 on the classpath since we rely on it directly
307
- .exclude(
308
- " com.lihaoyi" ,
309
- " sourcecode_2.13" ,
310
- ) // avoid 2.13 and 3 on the classpath since it comes in via pprint
317
+ def scalametaDependency = (" org.scalameta" %% " scalameta" % V .scalameta)
318
+ .cross(CrossVersion .for3Use2_13)
319
+ .exclude(" org.scala-lang" , " scala-reflect" )
320
+ .exclude(" org.scala-lang" , " scala-compiler" )
321
+ .exclude(" org.scala-lang.modules" , " scala-collection-compat" )
322
+ .exclude(
323
+ " com.lihaoyi" ,
324
+ " geny_2.13" ,
325
+ ) // avoid 2.13 and 3 on the classpath since we rely on it directly
326
+ .exclude(
327
+ " com.lihaoyi" ,
328
+ " sourcecode_2.13" ,
329
+ )
311
330
312
331
val mtagsSettings = List (
313
332
crossScalaVersions := V .supportedScalaVersions ++ V .nightlyScala3Versions,
@@ -340,7 +359,7 @@ val mtagsSettings = List(
340
359
),
341
360
if3 = List (
342
361
" org.scala-lang" %% " scala3-compiler" % scalaVersion.value,
343
- scala3ScalametaDependency ,
362
+ scalametaDependency ,
344
363
),
345
364
if3WithPresentationCompiler = List (
346
365
" org.scala-lang" %% " scala3-presentation-compiler" % scalaVersion.value
@@ -374,21 +393,21 @@ val mtagsSettings = List(
374
393
},
375
394
)
376
395
377
- lazy val mtags3 = project
396
+ lazy val mtags2 = project
378
397
.in(file(" .mtags" ))
379
398
.settings(
380
399
Compile / unmanagedSourceDirectories := Seq (),
381
400
sharedSettings,
382
401
mtagsSettings,
383
402
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags" / " src" / " main" / " scala" ,
384
403
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala" ,
385
- Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-3 " ,
386
- moduleName := " mtags3 " ,
387
- scalaVersion := V .scala3 ,
388
- target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target3 " ,
404
+ Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / " mtags-shared" / " src" / " main" / " scala-2.13 " ,
405
+ moduleName := " mtags2 " ,
406
+ scalaVersion := V .scala213 ,
407
+ target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target2 " ,
389
408
publish / skip := true ,
390
409
scalafixConfig := Some (
391
- (ThisBuild / baseDirectory).value / " .scalafix3 .conf"
410
+ (ThisBuild / baseDirectory).value / " .scalafix2 .conf"
392
411
),
393
412
)
394
413
.dependsOn(interfaces)
@@ -405,9 +424,6 @@ lazy val mtags3WithPresentationCompiler = project
405
424
scalaVersion := V .wrapperMetalsVersion,
406
425
target := (ThisBuild / baseDirectory).value / " mtags" / " target" / " target3-wrapper" ,
407
426
publish / skip := true ,
408
- scalafixConfig := Some (
409
- (ThisBuild / baseDirectory).value / " .scalafix3.conf"
410
- ),
411
427
)
412
428
.dependsOn(interfaces)
413
429
.enablePlugins(BuildInfoPlugin )
@@ -457,7 +473,8 @@ lazy val metals = project
457
473
// for BSP
458
474
" org.scala-sbt.ipcsocket" % " ipcsocket" % " 1.6.2" ,
459
475
" ch.epfl.scala" % " bsp4j" % V .bsp,
460
- " ch.epfl.scala" %% " bloop-launcher-core" % V .bloop,
476
+ (" ch.epfl.scala" %% " bloop-launcher-core" % V .bloop)
477
+ .cross(CrossVersion .for3Use2_13),
461
478
// for LSP
462
479
V .lsp4j,
463
480
// for DAP
@@ -487,14 +504,20 @@ lazy val metals = project
487
504
// Scala dependencies
488
505
// ==================
489
506
" org.scalameta" % " mdoc-interfaces" % V .mdoc,
490
- " org.scalameta" %% " scalafmt-dynamic" % V .scalafmt,
507
+ (" org.scalameta" %% " scalafmt-dynamic" % V .scalafmt)
508
+ .cross(CrossVersion .for3Use2_13),
509
+ " com.googlecode.java-diff-utils" % " diffutils" % " 1.3.0" ,
491
510
" ch.epfl.scala" % " scalafix-interfaces" % V .scalafix,
492
511
// For reading classpaths.
493
512
// for fetching ch.epfl.scala:bloop-frontend and other library dependencies
494
513
" io.get-coursier" % " interface" % V .coursierInterfaces,
495
- // for comparing versions && fetching from sbt maven repository
496
- " io.get-coursier" %% " coursier" % V .coursier,
497
- " io.get-coursier" %% " coursier-sbt-maven-repository" % V .coursier,
514
+ // for comparing versions
515
+ (" io.get-coursier" %% " versions" % " 0.3.2" )
516
+ .cross(CrossVersion .for3Use2_13),
517
+ (" io.get-coursier" %% " coursier-sbt-maven-repository" % V .coursier)
518
+ .cross(CrossVersion .for3Use2_13),
519
+ (" io.get-coursier" %% " coursier" % V .coursier)
520
+ .cross(CrossVersion .for3Use2_13),
498
521
// for logging
499
522
" com.outr" %% " scribe" % V .scribe,
500
523
" com.outr" %% " scribe-file" % V .scribe,
@@ -503,13 +526,12 @@ lazy val metals = project
503
526
" com.lihaoyi" %% " ujson" % " 3.1.3" ,
504
527
// For remote language server
505
528
" com.lihaoyi" %% " requests" % " 0.8.0" ,
506
- // for producing SemanticDB from Scala source files, to be sure we want the same version of scalameta
507
- " org.scalameta" %% " scalameta" % V .semanticdb(scalaVersion.value),
508
- " org.scalameta" % " semanticdb-scalac-core" % V .semanticdb(
509
- scalaVersion.value
510
- ) cross CrossVersion .full,
529
+ // for producing SemanticDB from Scala source files
530
+ scalametaDependency,
531
+ // "org.scalameta" % "semanticdb-scalac-core" % V.scalameta cross CrossVersion.full,
511
532
// For starting Ammonite
512
- " io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" ,
533
+ (" io.github.alexarchambault.ammonite" %% " ammonite-runner" % " 0.4.0" )
534
+ .cross(CrossVersion .for3Use2_13),
513
535
" org.scala-lang.modules" %% " scala-xml" % " 2.2.0" ,
514
536
" org.scala-lang.modules" %% " scala-parallel-collections" % " 1.0.4" ,
515
537
(" org.virtuslab.scala-cli" % " scala-cli-bsp" % V .scalaCli)
@@ -577,6 +599,7 @@ lazy val `sbt-metals` = project
577
599
lazy val input = project
578
600
.in(file(" tests/input" ))
579
601
.settings(
602
+ scalaVersion := V .scala213,
580
603
sharedSettings,
581
604
publish / skip := true ,
582
605
libraryDependencies ++= List (
@@ -710,7 +733,7 @@ lazy val mtest = project
710
733
),
711
734
libraryDependencies ++= {
712
735
if (isScala3WithPresentationCompiler(scalaVersion.value))
713
- List (scala3ScalametaDependency )
736
+ List (scalametaDependency )
714
737
else Nil
715
738
},
716
739
Compile / unmanagedSourceDirectories ++= {
@@ -762,6 +785,7 @@ def isInTestShard(name: String, logger: Logger): Boolean = {
762
785
lazy val metalsDependencies = project
763
786
.in(file(" target/.dependencies" ))
764
787
.settings(
788
+ scalaVersion := V .scala213,
765
789
publish / skip := true ,
766
790
// silent the intransitive dependency warning
767
791
publishMavenStyle := false ,
@@ -770,13 +794,13 @@ lazy val metalsDependencies = project
770
794
// will pick them up and update them. They aren't actually used.
771
795
" com.lihaoyi" %% " ammonite-util" % V .ammonite,
772
796
" org.typelevel" % " kind-projector" % V .kindProjector cross CrossVersion .full,
773
- " com.olegpy" %% " better-monadic-for" % V .betterMonadicFor,
797
+ ( " com.olegpy" %% " better-monadic-for" % V .betterMonadicFor) ,
774
798
" com.lihaoyi" % " mill-contrib-testng" % V .mill,
775
799
" org.virtuslab.scala-cli" % " cli_3" % V .scalaCli intransitive (),
776
800
" ch.epfl.scala" % " bloop-maven-plugin" % V .mavenBloop,
777
801
" ch.epfl.scala" %% " gradle-bloop" % V .gradleBloop,
778
802
" com.sourcegraph" % " semanticdb-java" % V .javaSemanticdb,
779
- " ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter intransitive (),
803
+ ( " ch.epfl.scala" %% " scala-debug-adapter" % V .debugAdapter) intransitive (),
780
804
),
781
805
)
782
806
.disablePlugins(ScalafixPlugin )
@@ -791,9 +815,16 @@ lazy val unit = project
791
815
sharedSettings,
792
816
Test / javaOptions += " -Xmx2G" ,
793
817
libraryDependencies ++= List (
794
- " io.get-coursier" %% " coursier" % V .coursier, // for jars
795
- " ch.epfl.scala" %% " bloop-config" % V .bloopConfig,
818
+ (" io.get-coursier" %% " coursier" % V .coursier)
819
+ .cross(CrossVersion .for3Use2_13), // for jars
820
+ (" ch.epfl.scala" %% " bloop-config" % V .bloopConfig)
821
+ .cross(CrossVersion .for3Use2_13),
796
822
" org.scalameta" %% " munit" % V .munit,
823
+ // The dependencies listed below are only listed so Scala Steward
824
+ // will pick them up and update them. They aren't actually used.
825
+ (" com.lihaoyi" %% " ammonite-util" % V .ammonite intransitive ())
826
+ .cross(CrossVersion .for3Use2_13),
827
+ " com.lihaoyi" % " mill-contrib-testng" % V .mill intransitive (),
797
828
),
798
829
buildInfoPackage := " tests" ,
799
830
Compile / resourceGenerators += InputProperties
0 commit comments