@@ -1907,74 +1907,78 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
1907
1907
}
1908
1908
1909
1909
test(" BSP respects JAVA_HOME" ) {
1910
- val javaVersion = " 22"
1911
- val inputs = TestInputs (os.rel / " check-java.sc" ->
1912
- s """ assert(System.getProperty("java.version").startsWith(" $javaVersion"))
1913
- |println(System.getProperty("java.home")) """ .stripMargin)
1914
- inputs.fromRoot { root =>
1915
- os.proc(TestUtil .cli, " bloop" , " exit" , " --power" ).call(cwd = root)
1916
- val java22Home =
1917
- os.Path (
1918
- os.proc(TestUtil .cs, " java-home" , " --jvm" , s " zulu: $javaVersion" ).call().out.trim(),
1919
- os.pwd
1920
- )
1921
- os.proc(TestUtil .cli, " setup-ide" , " check-java.sc" )
1922
- .call(cwd = root, env = Map (" JAVA_HOME" -> java22Home.toString()))
1923
- val ideOptionsPath = root / Constants .workspaceDirName / " ide-options-v2.json"
1924
- expect(ideOptionsPath.toNIO.toFile.exists())
1925
- val ideEnvsPath = root / Constants .workspaceDirName / " ide-envs.json"
1926
- expect(ideEnvsPath.toNIO.toFile.exists())
1927
- val jsonOptions = List (" --json-options" , ideOptionsPath.toString)
1928
- val envOptions = List (" --envs-file" , ideEnvsPath.toString)
1929
- withBsp(inputs, Seq (" ." ), bspOptions = jsonOptions ++ envOptions, reuseRoot = Some (root)) {
1930
- (_, _, remoteServer) =>
1931
- async {
1932
- val targets = await(remoteServer.workspaceBuildTargets().asScala)
1933
- .getTargets.asScala
1934
- .filter(! _.getId.getUri.contains(" -test" ))
1935
- .map(_.getId())
1936
- val compileResult =
1937
- await(remoteServer.buildTargetCompile(new b.CompileParams (targets.asJava)).asScala)
1938
- expect(compileResult.getStatusCode == b.StatusCode .OK )
1939
- val runResult =
1940
- await(remoteServer.buildTargetRun(new b.RunParams (targets.head)).asScala)
1941
- expect(runResult.getStatusCode == b.StatusCode .OK )
1942
- }
1910
+ TestUtil .retryOnCi() {
1911
+ val javaVersion = " 22"
1912
+ val inputs = TestInputs (os.rel / " check-java.sc" ->
1913
+ s """ assert(System.getProperty("java.version").startsWith(" $javaVersion"))
1914
+ |println(System.getProperty("java.home")) """ .stripMargin)
1915
+ inputs.fromRoot { root =>
1916
+ os.proc(TestUtil .cli, " bloop" , " exit" , " --power" ).call(cwd = root)
1917
+ val java22Home =
1918
+ os.Path (
1919
+ os.proc(TestUtil .cs, " java-home" , " --jvm" , s " zulu: $javaVersion" ).call().out.trim(),
1920
+ os.pwd
1921
+ )
1922
+ os.proc(TestUtil .cli, " setup-ide" , " check-java.sc" )
1923
+ .call(cwd = root, env = Map (" JAVA_HOME" -> java22Home.toString()))
1924
+ val ideOptionsPath = root / Constants .workspaceDirName / " ide-options-v2.json"
1925
+ expect(ideOptionsPath.toNIO.toFile.exists())
1926
+ val ideEnvsPath = root / Constants .workspaceDirName / " ide-envs.json"
1927
+ expect(ideEnvsPath.toNIO.toFile.exists())
1928
+ val jsonOptions = List (" --json-options" , ideOptionsPath.toString)
1929
+ val envOptions = List (" --envs-file" , ideEnvsPath.toString)
1930
+ withBsp(inputs, Seq (" ." ), bspOptions = jsonOptions ++ envOptions, reuseRoot = Some (root)) {
1931
+ (_, _, remoteServer) =>
1932
+ async {
1933
+ val targets = await(remoteServer.workspaceBuildTargets().asScala)
1934
+ .getTargets.asScala
1935
+ .filter(! _.getId.getUri.contains(" -test" ))
1936
+ .map(_.getId())
1937
+ val compileResult =
1938
+ await(remoteServer.buildTargetCompile(new b.CompileParams (targets.asJava)).asScala)
1939
+ expect(compileResult.getStatusCode == b.StatusCode .OK )
1940
+ val runResult =
1941
+ await(remoteServer.buildTargetRun(new b.RunParams (targets.head)).asScala)
1942
+ expect(runResult.getStatusCode == b.StatusCode .OK )
1943
+ }
1944
+ }
1943
1945
}
1944
1946
}
1945
1947
}
1946
1948
1947
1949
test(" BSP respects --java-home" ) {
1948
- val javaVersion = " 22"
1949
- val inputs = TestInputs (os.rel / " check-java.sc" ->
1950
- s """ assert(System.getProperty("java.version").startsWith(" $javaVersion"))
1951
- |println(System.getProperty("java.home")) """ .stripMargin)
1952
- inputs.fromRoot { root =>
1953
- os.proc(TestUtil .cli, " bloop" , " exit" , " --power" ).call(cwd = root)
1954
- val java22Home =
1955
- os.Path (
1956
- os.proc(TestUtil .cs, " java-home" , " --jvm" , s " zulu: $javaVersion" ).call().out.trim(),
1957
- os.pwd
1958
- )
1959
- os.proc(TestUtil .cli, " setup-ide" , " check-java.sc" , " --java-home" , java22Home.toString())
1960
- .call(cwd = root)
1961
- val ideOptionsPath = root / Constants .workspaceDirName / " ide-options-v2.json"
1962
- expect(ideOptionsPath.toNIO.toFile.exists())
1963
- val jsonOptions = List (" --json-options" , ideOptionsPath.toString)
1964
- withBsp(inputs, Seq (" ." ), bspOptions = jsonOptions, reuseRoot = Some (root)) {
1965
- (_, _, remoteServer) =>
1966
- async {
1967
- val targets = await(remoteServer.workspaceBuildTargets().asScala)
1968
- .getTargets.asScala
1969
- .filter(! _.getId.getUri.contains(" -test" ))
1970
- .map(_.getId())
1971
- val compileResult =
1972
- await(remoteServer.buildTargetCompile(new b.CompileParams (targets.asJava)).asScala)
1973
- expect(compileResult.getStatusCode == b.StatusCode .OK )
1974
- val runResult =
1975
- await(remoteServer.buildTargetRun(new b.RunParams (targets.head)).asScala)
1976
- expect(runResult.getStatusCode == b.StatusCode .OK )
1977
- }
1950
+ TestUtil .retryOnCi() {
1951
+ val javaVersion = " 22"
1952
+ val inputs = TestInputs (os.rel / " check-java.sc" ->
1953
+ s """ assert(System.getProperty("java.version").startsWith(" $javaVersion"))
1954
+ |println(System.getProperty("java.home")) """ .stripMargin)
1955
+ inputs.fromRoot { root =>
1956
+ os.proc(TestUtil .cli, " bloop" , " exit" , " --power" ).call(cwd = root)
1957
+ val java22Home =
1958
+ os.Path (
1959
+ os.proc(TestUtil .cs, " java-home" , " --jvm" , s " zulu: $javaVersion" ).call().out.trim(),
1960
+ os.pwd
1961
+ )
1962
+ os.proc(TestUtil .cli, " setup-ide" , " check-java.sc" , " --java-home" , java22Home.toString())
1963
+ .call(cwd = root)
1964
+ val ideOptionsPath = root / Constants .workspaceDirName / " ide-options-v2.json"
1965
+ expect(ideOptionsPath.toNIO.toFile.exists())
1966
+ val jsonOptions = List (" --json-options" , ideOptionsPath.toString)
1967
+ withBsp(inputs, Seq (" ." ), bspOptions = jsonOptions, reuseRoot = Some (root)) {
1968
+ (_, _, remoteServer) =>
1969
+ async {
1970
+ val targets = await(remoteServer.workspaceBuildTargets().asScala)
1971
+ .getTargets.asScala
1972
+ .filter(! _.getId.getUri.contains(" -test" ))
1973
+ .map(_.getId())
1974
+ val compileResult =
1975
+ await(remoteServer.buildTargetCompile(new b.CompileParams (targets.asJava)).asScala)
1976
+ expect(compileResult.getStatusCode == b.StatusCode .OK )
1977
+ val runResult =
1978
+ await(remoteServer.buildTargetRun(new b.RunParams (targets.head)).asScala)
1979
+ expect(runResult.getStatusCode == b.StatusCode .OK )
1980
+ }
1981
+ }
1978
1982
}
1979
1983
}
1980
1984
}
0 commit comments