@@ -1967,156 +1967,157 @@ abstract class RunTestDefinitions
1967
1967
}
1968
1968
}
1969
1969
1970
- test(" offline mode should fail on missing artifacts" ) {
1971
- // Kill bloop deamon to test scalac fallback
1972
- os.proc(TestUtil .cli, " --power" , " bloop" , " exit" )
1973
- .call(cwd = os.pwd)
1974
-
1975
- val depScalaVersion = actualScalaVersion match {
1976
- case sv if sv.startsWith(" 2.12" ) => " 2.12"
1977
- case sv if sv.startsWith(" 2.13" ) => " 2.13"
1978
- case _ => " 3"
1979
- }
1970
+ if (! actualScalaVersion.contains(" RC" ))
1971
+ test(" offline mode should fail on missing artifacts" ) {
1972
+ // Kill bloop deamon to test scalac fallback
1973
+ os.proc(TestUtil .cli, " --power" , " bloop" , " exit" )
1974
+ .call(cwd = os.pwd)
1975
+
1976
+ val depScalaVersion = actualScalaVersion match {
1977
+ case sv if sv.startsWith(" 2.12" ) => " 2.12"
1978
+ case sv if sv.startsWith(" 2.13" ) => " 2.13"
1979
+ case _ => " 3"
1980
+ }
1980
1981
1981
- val dep = s " com.lihaoyi:os-lib_ $depScalaVersion:0.10.2 "
1982
- val inputs = TestInputs (
1983
- os.rel / " NoDeps.scala" ->
1984
- """ //> using jvm zulu:11
1985
- |object NoDeps extends App {
1986
- | println("Hello from NoDeps")
1987
- |}
1988
- |""" .stripMargin,
1989
- os.rel / " WithDeps.scala" ->
1990
- s """ //> using jvm zulu:11
1991
- |//> using dep $dep
1992
- |
1993
- |object WithDeps extends App {
1994
- | println("Hello from WithDeps")
1995
- |}
1996
- | """ .stripMargin
1997
- )
1998
- inputs.fromRoot { root =>
1999
- val cachePath = root / " .cache"
2000
- os.makeDir(cachePath)
1982
+ val dep = s " com.lihaoyi:os-lib_ $depScalaVersion:0.10.2 "
1983
+ val inputs = TestInputs (
1984
+ os.rel / " NoDeps.scala" ->
1985
+ """ //> using jvm zulu:11
1986
+ |object NoDeps extends App {
1987
+ | println("Hello from NoDeps")
1988
+ |}
1989
+ |""" .stripMargin,
1990
+ os.rel / " WithDeps.scala" ->
1991
+ s """ //> using jvm zulu:11
1992
+ |//> using dep $dep
1993
+ |
1994
+ |object WithDeps extends App {
1995
+ | println("Hello from WithDeps")
1996
+ |}
1997
+ | """ .stripMargin
1998
+ )
1999
+ inputs.fromRoot { root =>
2000
+ val cachePath = root / " .cache"
2001
+ os.makeDir(cachePath)
2001
2002
2002
- val extraEnv = Map (" COURSIER_CACHE" -> cachePath.toString)
2003
+ val extraEnv = Map (" COURSIER_CACHE" -> cachePath.toString)
2003
2004
2004
- val emptyCacheWalkSize = os.walk(cachePath).size
2005
+ val emptyCacheWalkSize = os.walk(cachePath).size
2005
2006
2006
- val noArtifactsRes = os.proc(
2007
- TestUtil .cli,
2008
- " --power" ,
2009
- " NoDeps.scala" ,
2010
- extraOptions,
2011
- " --offline" ,
2012
- " --cache" ,
2013
- cachePath.toString
2014
- )
2015
- .call(cwd = root, check = false , mergeErrIntoOut = true )
2016
- expect(noArtifactsRes.exitCode == 1 )
2017
-
2018
- // Cache unchanged
2019
- expect(emptyCacheWalkSize == os.walk(cachePath).size)
2020
-
2021
- // Download the artifacts for scala
2022
- os.proc(TestUtil .cs, " install" , s " scala: $actualScalaVersion" )
2023
- .call(cwd = root, env = extraEnv)
2024
- os.proc(TestUtil .cs, " install" , s " scalac: $actualScalaVersion" )
2025
- .call(cwd = root, env = extraEnv)
2026
- (if (actualScalaVersion.startsWith(" 3" )) Some (" scala3-sbt-bridge" )
2027
- else if (
2028
- actualScalaVersion.startsWith(" 2.13." ) &&
2029
- actualScalaVersion.coursierVersion >= " 2.13.12" .coursierVersion
2030
- )
2031
- Some (" scala2-sbt-bridge" )
2032
- else None )
2033
- .foreach { bridgeArtifactName =>
2034
- os.proc(TestUtil .cs, " fetch" , s " org.scala-lang: $bridgeArtifactName: $actualScalaVersion" )
2035
- .call(cwd = root, env = extraEnv)
2036
- }
2037
-
2038
- // Download JVM that won't suit Bloop, also no Bloop artifacts are present
2039
- os.proc(TestUtil .cs, " java-home" , " --jvm" , " zulu:11" )
2040
- .call(cwd = root, env = extraEnv)
2007
+ val noArtifactsRes = os.proc(
2008
+ TestUtil .cli,
2009
+ " --power" ,
2010
+ " NoDeps.scala" ,
2011
+ extraOptions,
2012
+ " --offline" ,
2013
+ " --cache" ,
2014
+ cachePath.toString
2015
+ )
2016
+ .call(cwd = root, check = false , mergeErrIntoOut = true )
2017
+ expect(noArtifactsRes.exitCode == 1 )
2041
2018
2042
- val scalaJvmCacheWalkSize = os.walk(cachePath).size
2019
+ // Cache unchanged
2020
+ expect(emptyCacheWalkSize == os.walk(cachePath).size)
2021
+
2022
+ // Download the artifacts for scala
2023
+ os.proc(TestUtil .cs, " install" , s " scala: $actualScalaVersion" )
2024
+ .call(cwd = root, env = extraEnv)
2025
+ os.proc(TestUtil .cs, " install" , s " scalac: $actualScalaVersion" )
2026
+ .call(cwd = root, env = extraEnv)
2027
+ (if (actualScalaVersion.startsWith(" 3" )) Some (" scala3-sbt-bridge" )
2028
+ else if (
2029
+ actualScalaVersion.startsWith(" 2.13." ) &&
2030
+ actualScalaVersion.coursierVersion >= " 2.13.12" .coursierVersion
2031
+ )
2032
+ Some (" scala2-sbt-bridge" )
2033
+ else None )
2034
+ .foreach { bridgeArtifactName =>
2035
+ os.proc(TestUtil .cs, " fetch" , s " org.scala-lang: $bridgeArtifactName: $actualScalaVersion" )
2036
+ .call(cwd = root, env = extraEnv)
2037
+ }
2043
2038
2044
- val scalaAndJvmRes = os.proc(
2045
- TestUtil .cli,
2046
- " --power" ,
2047
- " NoDeps.scala" ,
2048
- extraOptions,
2049
- " --offline" ,
2050
- " --cache" ,
2051
- cachePath.toString,
2052
- " -v" ,
2053
- " -v"
2054
- )
2055
- .call(cwd = root, mergeErrIntoOut = true )
2056
- expect(scalaAndJvmRes.exitCode == 0 )
2057
- expect(scalaAndJvmRes.out.trim().contains(
2058
- " Offline mode is ON and Bloop could not be fetched from the local cache, using scalac as fallback"
2059
- ))
2060
- expect(scalaAndJvmRes.out.trim().contains(" Hello from NoDeps" ))
2039
+ // Download JVM that won't suit Bloop, also no Bloop artifacts are present
2040
+ os.proc(TestUtil .cs, " java-home" , " --jvm" , " zulu:11" )
2041
+ .call(cwd = root, env = extraEnv)
2061
2042
2062
- // Cache unchanged
2063
- expect(scalaJvmCacheWalkSize == os.walk(cachePath).size)
2043
+ val scalaJvmCacheWalkSize = os.walk(cachePath).size
2064
2044
2065
- // Missing dependencies
2066
- for {
2067
- (cliOption, extraEnvMode) <- Seq (
2068
- " --offline" -> Map .empty[String , String ],
2069
- " -Dcoursier.mode=offline" -> Map .empty[String , String ],
2070
- " " -> Map (" COURSIER_MODE" -> " offline" )
2071
- )
2072
- } {
2073
- val missingDepsRes = os.proc(
2045
+ val scalaAndJvmRes = os.proc(
2074
2046
TestUtil .cli,
2075
2047
" --power" ,
2076
- cliOption,
2077
- " WithDeps.scala" ,
2048
+ " NoDeps.scala" ,
2078
2049
extraOptions,
2050
+ " --offline" ,
2079
2051
" --cache" ,
2080
- cachePath.toString
2052
+ cachePath.toString,
2053
+ " -v" ,
2054
+ " -v"
2081
2055
)
2082
- .call(cwd = root, check = false , mergeErrIntoOut = true , env = extraEnvMode)
2083
- expect(missingDepsRes.exitCode == 1 )
2084
- expect(missingDepsRes.out.trim().contains(" Error downloading com.lihaoyi:os-lib" ))
2056
+ .call(cwd = root, mergeErrIntoOut = true )
2057
+ expect(scalaAndJvmRes.exitCode == 0 )
2058
+ expect(scalaAndJvmRes.out.trim().contains(
2059
+ " Offline mode is ON and Bloop could not be fetched from the local cache, using scalac as fallback"
2060
+ ))
2061
+ expect(scalaAndJvmRes.out.trim().contains(" Hello from NoDeps" ))
2085
2062
2086
2063
// Cache unchanged
2087
2064
expect(scalaJvmCacheWalkSize == os.walk(cachePath).size)
2088
- }
2089
2065
2090
- // Download dependencies
2091
- os.proc(TestUtil .cs, " fetch" , dep)
2092
- .call(cwd = root, env = extraEnv)
2066
+ // Missing dependencies
2067
+ for {
2068
+ (cliOption, extraEnvMode) <- Seq (
2069
+ " --offline" -> Map .empty[String , String ],
2070
+ " -Dcoursier.mode=offline" -> Map .empty[String , String ],
2071
+ " " -> Map (" COURSIER_MODE" -> " offline" )
2072
+ )
2073
+ } {
2074
+ val missingDepsRes = os.proc(
2075
+ TestUtil .cli,
2076
+ " --power" ,
2077
+ cliOption,
2078
+ " WithDeps.scala" ,
2079
+ extraOptions,
2080
+ " --cache" ,
2081
+ cachePath.toString
2082
+ )
2083
+ .call(cwd = root, check = false , mergeErrIntoOut = true , env = extraEnvMode)
2084
+ expect(missingDepsRes.exitCode == 1 )
2085
+ expect(missingDepsRes.out.trim().contains(" Error downloading com.lihaoyi:os-lib" ))
2093
2086
2094
- val withDependencyCacheWalkSize = os.walk(cachePath).size
2087
+ // Cache unchanged
2088
+ expect(scalaJvmCacheWalkSize == os.walk(cachePath).size)
2089
+ }
2095
2090
2096
- val depsRes = os.proc(
2097
- TestUtil .cli,
2098
- " --power " ,
2099
- " WithDeps.scala " ,
2100
- extraOptions,
2101
- " --offline " ,
2102
- " --cache " ,
2103
- cachePath.toString ,
2104
- " -v " ,
2105
- " -v "
2106
- )
2107
- .call(cwd = root, mergeErrIntoOut = true )
2108
- expect(depsRes.exitCode == 0 )
2109
- expect(
2110
- depsRes.out.trim().contains(
2111
- " Offline mode is ON and Bloop could not be fetched from the local cache, using scalac as fallback "
2091
+ // Download dependencies
2092
+ os.proc( TestUtil .cs, " fetch " , dep)
2093
+ .call(cwd = root, env = extraEnv)
2094
+
2095
+ val withDependencyCacheWalkSize = os.walk(cachePath).size
2096
+
2097
+ val depsRes = os.proc(
2098
+ TestUtil .cli ,
2099
+ " --power " ,
2100
+ " WithDeps.scala " ,
2101
+ extraOptions,
2102
+ " --offline " ,
2103
+ " --cache " ,
2104
+ cachePath.toString,
2105
+ " -v " ,
2106
+ " -v "
2112
2107
)
2113
- )
2114
- expect(depsRes.out.trim().contains(" Hello from WithDeps" ))
2108
+ .call(cwd = root, mergeErrIntoOut = true )
2109
+ expect(depsRes.exitCode == 0 )
2110
+ expect(
2111
+ depsRes.out.trim().contains(
2112
+ " Offline mode is ON and Bloop could not be fetched from the local cache, using scalac as fallback"
2113
+ )
2114
+ )
2115
+ expect(depsRes.out.trim().contains(" Hello from WithDeps" ))
2115
2116
2116
- // Cache changed
2117
- expect(withDependencyCacheWalkSize == os.walk(cachePath).size)
2117
+ // Cache changed
2118
+ expect(withDependencyCacheWalkSize == os.walk(cachePath).size)
2119
+ }
2118
2120
}
2119
- }
2120
2121
2121
2122
test(" JVM id is printed with compilation info correctly" ) {
2122
2123
val msg = " Hello"
0 commit comments