Skip to content

Commit

Permalink
Merged branch idea243.release into idea243.x
Browse files Browse the repository at this point in the history
  • Loading branch information
builduser committed Dec 10, 2024
2 parents acaefb2 + c0c18d7 commit 3ac1ba1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,9 @@ object SbtProcessManager {

private[shell]
def buildVMParameters(sbtSettings: SbtExecutionSettings, workingDir: File, sbtOpts: Seq[String]): Seq[String] = {
val hardcoded = List("-Dsbt.supershell=false")
//TODO #SCL-22878 "-Djdk.console=java.base" is needed due to modifications made to the System.console() after JDK 21,
// which are not yet fully supported in sbt
val hardcoded = List("-Dsbt.supershell=false", "-Djdk.console=java.base")
val jvmOpts = hardcoded ++
SbtUtil.collectAllOptionsFromJava(workingDir, sbtSettings.vmOptions, sbtSettings.passParentEnvironment, sbtSettings.userSetEnvironment) ++
sbtOpts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MaxJvmHeapParameterTest {

val hiddenDefaultSize = JvmMemorySize.Megabytes(1500)
val hiddenDefaultParam = "-Xmx" + hiddenDefaultSize
val superShellDisabled = "-Dsbt.supershell=false"
val hardcoded = List("-Dsbt.supershell=false", "-Djdk.console=java.base")

def buildParamSeq(userOpts: String*)(jvmOpts: String*)(implicit testInfo: TestInfo): Seq[String] = {
val workingDir = FileUtil.createTempDirectory("maxHeapJvmParamTest", testInfo.getDisplayName, true)
Expand Down Expand Up @@ -55,39 +55,39 @@ class MaxJvmHeapParameterTest {
@Test
def userSettingsSmallerThanHiddenDefault(implicit testInfo: TestInfo): Unit = {
assertEquals(
Seq(superShellDisabled,"-Xmx4g", "-Xms4g", "-Xmx1g"),
hardcoded ++ Seq("-Xmx4g", "-Xms4g", "-Xmx1g"),
buildParamSeq("-Xmx1g")("-Xmx4g", "-Xms4g")
)
}

@Test
def userSettingsGreaterThanHiddenDefault(implicit testInfo: TestInfo): Unit = {
assertEquals(
Seq(superShellDisabled,"-Xmx4g", "-Xms4g", "-Xmx2g"),
hardcoded ++ Seq("-Xmx4g", "-Xms4g", "-Xmx2g"),
buildParamSeq("-Xmx2g")("-Xmx4g", "-Xms4g")
)
}

@Test
def noSettings(implicit testInfo: TestInfo): Unit = {
assertEquals(
Seq(hiddenDefaultParam, superShellDisabled),
hiddenDefaultParam +: hardcoded,
buildParamSeq()()
)
}

@Test
def noSettingsWithXmsSmallerThanDefaultParam(implicit testInfo: TestInfo): Unit = {
assertEquals(
Seq(hiddenDefaultParam, superShellDisabled, "-Xms1g"),
hiddenDefaultParam +: hardcoded :+ "-Xms1g",
buildParamSeq("-Xms1g")()
)
}

@Test
def noSettingsWithXmsGreaterThanDefaultParam(implicit testInfo: TestInfo): Unit = {
assertEquals(
Seq(superShellDisabled, "-Xms2g"),
hardcoded :+ "-Xms2g",
buildParamSeq("-Xms2g")()
)
}
Expand Down

0 comments on commit 3ac1ba1

Please sign in to comment.