@@ -8,27 +8,46 @@ object ScalaArtifacts {
8
8
val ActorsID = " scala-actors"
9
9
val ScalapID = " scalap"
10
10
val Artifacts = Vector (LibraryID , CompilerID , ReflectID , ActorsID , ScalapID )
11
- val DottyIDPrefix = " dotty"
12
11
13
- def dottyID (binaryVersion : String ): String = s " ${DottyIDPrefix }_ ${binaryVersion}"
12
+ val Scala3LibraryID = " scala3-library"
13
+ val Scala3CompilerID = " scala3-compiler"
14
14
15
- def libraryDependency (version : String ): ModuleID = ModuleID (Organization , LibraryID , version)
15
+ def isScala3 (scalaVersion : String ): Boolean = scalaVersion.startsWith(" 3." )
16
+
17
+ def libraryIds (version : String ): Array [String ] = {
18
+ if (isScala3(version))
19
+ Array (Scala3LibraryID , LibraryID )
20
+ else Array (LibraryID )
21
+ }
22
+
23
+ def compilerId (version : String ): String = {
24
+ if (isScala3(version)) Scala3CompilerID
25
+ else CompilerID
26
+ }
27
+
28
+ def libraryDependency (version : String ): ModuleID = libraryDependency(Organization , version)
29
+
30
+ def libraryDependency (org : String , version : String ): ModuleID = {
31
+ if (isScala3(version))
32
+ ModuleID (org, Scala3LibraryID , version).withCrossVersion(CrossVersion .binary)
33
+ else
34
+ ModuleID (org, LibraryID , version)
35
+ }
16
36
17
37
private [sbt] def toolDependencies (
18
38
org : String ,
19
- version : String ,
20
- isDotty : Boolean = false
39
+ version : String
21
40
): Seq [ModuleID ] =
22
- if (isDotty )
41
+ if (isScala3(version) )
23
42
Seq (
24
- ModuleID (org, DottyIDPrefix , version)
43
+ ModuleID (org, Scala3CompilerID , version)
25
44
.withConfigurations(Some (Configurations .ScalaTool .name + " ->default(compile)" ))
26
45
.withCrossVersion(CrossVersion .binary)
27
46
)
28
47
else
29
48
Seq (
30
- scalaToolDependency(org, ScalaArtifacts . CompilerID , version),
31
- scalaToolDependency(org, ScalaArtifacts . LibraryID , version)
49
+ scalaToolDependency(org, CompilerID , version),
50
+ scalaToolDependency(org, LibraryID , version)
32
51
)
33
52
34
53
private [this ] def scalaToolDependency (org : String , id : String , version : String ): ModuleID =
0 commit comments