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