Skip to content

Commit 72cca0b

Browse files
authored
Fix logging malformed JVM id when compiling (#2487)
1 parent 201a46e commit 72cca0b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,4 +2021,17 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
20212021
expect(withDependencyCacheWalkSize == os.walk(cachePath).size)
20222022
}
20232023
}
2024+
2025+
test("JVM id is printed with compilation info correctly") {
2026+
val msg = "Hello"
2027+
val input = "jvm.sc"
2028+
TestInputs(os.rel / input ->
2029+
s"""//> using jvm 11
2030+
|println("$msg")
2031+
|""".stripMargin).fromRoot { root =>
2032+
val res = os.proc(TestUtil.cli, "run", extraOptions, input).call(cwd = root, stderr = os.Pipe)
2033+
expect(res.out.trim() == msg)
2034+
expect(res.err.trim().contains("JVM (11)"))
2035+
}
2036+
}
20242037
}

modules/options/src/main/scala/scala/build/options/BuildOptions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ final case class BuildOptions(
5858
val platform0 = platform.value match {
5959
case Platform.JVM =>
6060
val jvmIdSuffix =
61-
javaOptions.jvmIdOpt
61+
javaOptions.jvmIdOpt.map(_.value)
6262
.orElse(Some(javaHome().value.version.toString))
6363
.map(" (" + _ + ")").getOrElse("")
6464
s"JVM$jvmIdSuffix"

0 commit comments

Comments
 (0)