Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if jvm api cannot be used #447

Merged

Conversation

tpasternak
Copy link
Contributor

No description provided.

@tpasternak tpasternak force-pushed the warn-if-jvm-api-cannot-be-used branch 2 times, most recently from 7f9b56d to 482a670 Compare December 3, 2021 14:54
If a JVM is requested via `--jvm` command, or via `using java-home`
directive, the code is still compiled against Bloop's host jvm. If
it's too old, the user should be warned.
@tpasternak tpasternak force-pushed the warn-if-jvm-api-cannot-be-used branch from 482a670 to a5534e9 Compare December 3, 2021 15:12
@tpasternak tpasternak force-pushed the warn-if-jvm-api-cannot-be-used branch from e67dcbf to 9f43d15 Compare December 6, 2021 12:34
@tpasternak tpasternak marked this pull request as ready for review December 6, 2021 14:54
val bloopJvmV = options.javaOptions.bloopJvmVersion
val javaHome = options.javaHome()
if (bloopJvmV.exists(javaHome.value.version > _.value)) {
logger.log(List(scala.build.errors.Diagnostic(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT

Suggested change
logger.log(List(scala.build.errors.Diagnostic(
logger.log(List(Diagnostic(

Comment on lines 216 to 221
val red = Console.RED
val yellow = Console.YELLOW
val reset = Console.RESET
val prefix =
if (severity == Severity.Error) s"[${red}error$reset] "
else s"[${yellow}warn$reset] "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT Factor those as private fields in object ConsoleBloopBuildClient?

if (severity == Severity.Error) s"[${red}error$reset] "
else s"[${yellow}warn$reset] "
val msgIt = message.linesIterator
out.println(s"${prefix}bloop:" + (if (msgIt.hasNext) " " + msgIt.next() else ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a "bloop" here?

for (line <- msgIt)
out.println(prefix + line)

for { pos <- positions } pos match {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT Syntax

Suggested change
for { pos <- positions } pos match {
positions.foreach {

scalaOptions = ScalaOptions(scalacOptions = scalacOptions)
)

val inputs = new Inputs(Nil, None, os.pwd, "project", false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT

Suggested change
val inputs = new Inputs(Nil, None, os.pwd, "project", false)
val inputs = Inputs(Nil, None, os.pwd, "project", false)

(scalaCompilerOptions, res.right.get.javacOptions, logger.diagnostics)
}

def jvm(v: Int) = os.proc("cs", "java-home", "--jvm", s"zulu:$v").call().out.text().trim()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should use the same value as in the ITs (just "cs" is a problem when the launcher is cs.bat on Windows, but not when it's cs.exe, IIRC).

Copy link
Contributor

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Only left minor NIT comments.

Co-authored-by: Alexandre Archambault <alexarchambault@users.noreply.github.com>
@tpasternak tpasternak merged commit 5b396be into VirtusLab:master Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants