@@ -1967,13 +1967,42 @@ abstract class RunTestDefinitions
1967
1967
}
1968
1968
}
1969
1969
1970
- if (! actualScalaVersion.contains(" RC" ))
1971
- test(" offline mode should fail on missing artifacts" ) {
1970
+ if (! actualScalaVersion.contains(" RC" )) {
1971
+ val actualAnnouncedScalaVersion = actualScalaVersion match {
1972
+ case _
1973
+ if actualScalaVersion == Constants .scala3Next &&
1974
+ Constants .scala3Next != Constants .scala3NextAnnounced =>
1975
+ // if the version isn't public yet, Coursier won't be able to install it
1976
+ Constants .scala3NextAnnounced
1977
+ case s => s
1978
+ }
1979
+
1980
+ test(
1981
+ s " offline mode should fail on missing artifacts (with Scala $actualAnnouncedScalaVersion) "
1982
+ ) {
1972
1983
// Kill bloop deamon to test scalac fallback
1973
1984
os.proc(TestUtil .cli, " --power" , " bloop" , " exit" )
1974
1985
.call(cwd = os.pwd)
1975
1986
1976
- val depScalaVersion = actualScalaVersion match {
1987
+ // ensure extra options use an announced Scala version
1988
+ val customExtraOptions : Seq [String ] =
1989
+ if (
1990
+ scalaVersionOpt.isEmpty &&
1991
+ Constants .scala3Next != Constants .scala3NextAnnounced
1992
+ )
1993
+ extraOptions ++ Seq (" --scala" , actualAnnouncedScalaVersion)
1994
+ else if (
1995
+ actualScalaVersion == Constants .scala3Next &&
1996
+ actualScalaVersion != actualAnnouncedScalaVersion
1997
+ )
1998
+ extraOptions
1999
+ .map {
2000
+ case opt if opt == Constants .scala3Next => actualAnnouncedScalaVersion
2001
+ case opt => opt
2002
+ }
2003
+ else extraOptions
2004
+
2005
+ val depScalaVersion = actualAnnouncedScalaVersion match {
1977
2006
case sv if sv.startsWith(" 2.12" ) => " 2.12"
1978
2007
case sv if sv.startsWith(" 2.13" ) => " 2.13"
1979
2008
case _ => " 3"
@@ -2008,7 +2037,7 @@ abstract class RunTestDefinitions
2008
2037
TestUtil .cli,
2009
2038
" --power" ,
2010
2039
" NoDeps.scala" ,
2011
- extraOptions ,
2040
+ customExtraOptions ,
2012
2041
" --offline" ,
2013
2042
" --cache" ,
2014
2043
cachePath.toString
@@ -2020,19 +2049,23 @@ abstract class RunTestDefinitions
2020
2049
expect(emptyCacheWalkSize == os.walk(cachePath).size)
2021
2050
2022
2051
// Download the artifacts for scala
2023
- os.proc(TestUtil .cs, " install" , s " scala: $actualScalaVersion " )
2052
+ os.proc(TestUtil .cs, " install" , s " scala: $actualAnnouncedScalaVersion " )
2024
2053
.call(cwd = root, env = extraEnv)
2025
- os.proc(TestUtil .cs, " install" , s " scalac: $actualScalaVersion " )
2054
+ os.proc(TestUtil .cs, " install" , s " scalac: $actualAnnouncedScalaVersion " )
2026
2055
.call(cwd = root, env = extraEnv)
2027
- (if (actualScalaVersion .startsWith(" 3" )) Some (" scala3-sbt-bridge" )
2056
+ (if (actualAnnouncedScalaVersion .startsWith(" 3" )) Some (" scala3-sbt-bridge" )
2028
2057
else if (
2029
- actualScalaVersion .startsWith(" 2.13." ) &&
2030
- actualScalaVersion .coursierVersion >= " 2.13.12" .coursierVersion
2058
+ actualAnnouncedScalaVersion .startsWith(" 2.13." ) &&
2059
+ actualAnnouncedScalaVersion .coursierVersion >= " 2.13.12" .coursierVersion
2031
2060
)
2032
2061
Some (" scala2-sbt-bridge" )
2033
2062
else None )
2034
2063
.foreach { bridgeArtifactName =>
2035
- os.proc(TestUtil .cs, " fetch" , s " org.scala-lang: $bridgeArtifactName: $actualScalaVersion" )
2064
+ os.proc(
2065
+ TestUtil .cs,
2066
+ " fetch" ,
2067
+ s " org.scala-lang: $bridgeArtifactName: $actualAnnouncedScalaVersion"
2068
+ )
2036
2069
.call(cwd = root, env = extraEnv)
2037
2070
}
2038
2071
@@ -2046,7 +2079,7 @@ abstract class RunTestDefinitions
2046
2079
TestUtil .cli,
2047
2080
" --power" ,
2048
2081
" NoDeps.scala" ,
2049
- extraOptions ,
2082
+ customExtraOptions ,
2050
2083
" --offline" ,
2051
2084
" --cache" ,
2052
2085
cachePath.toString,
@@ -2076,7 +2109,7 @@ abstract class RunTestDefinitions
2076
2109
" --power" ,
2077
2110
cliOption,
2078
2111
" WithDeps.scala" ,
2079
- extraOptions ,
2112
+ customExtraOptions ,
2080
2113
" --cache" ,
2081
2114
cachePath.toString
2082
2115
)
@@ -2098,7 +2131,7 @@ abstract class RunTestDefinitions
2098
2131
TestUtil .cli,
2099
2132
" --power" ,
2100
2133
" WithDeps.scala" ,
2101
- extraOptions ,
2134
+ customExtraOptions ,
2102
2135
" --offline" ,
2103
2136
" --cache" ,
2104
2137
cachePath.toString,
@@ -2118,6 +2151,7 @@ abstract class RunTestDefinitions
2118
2151
expect(withDependencyCacheWalkSize == os.walk(cachePath).size)
2119
2152
}
2120
2153
}
2154
+ }
2121
2155
2122
2156
test(" JVM id is printed with compilation info correctly" ) {
2123
2157
val msg = " Hello"
0 commit comments