Skip to content

Commit 1fc97fa

Browse files
authored
Merge pull request scalacenter#1707 from tgodzik/remove-jvmopts
Remove the possibility to read proeprties from.jvmopts
2 parents 823cde4 + 4dc3143 commit 1fc97fa

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

bloopgun/src/main/scala/bloop/bloopgun/util/Environment.scala

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ object Environment {
5353
/**
5454
* Reads all jvm options required to start the Bloop server, in order of priority:
5555
*
56+
* Parses `-J` prefixed jvm options in the arguments passed to the server command.
57+
*
58+
* Prior to 1.5.0 it used to also:
5659
* 1. Read `$$HOME/.bloop/.jvmopts` file.
5760
* 2. Read `.jvmopts` file right next to the location of the bloop server jar.
58-
* 3. Parse `-J` prefixed jvm options in the arguments passed to the server command.
61+
* Now, it only logs a warning if the file detected.
5962
*
6063
* Returns a list of jvm options with no `-J` prefix.
6164
*/
@@ -64,27 +67,19 @@ object Environment {
6467
serverArgs: List[String],
6568
logger: Logger
6669
): List[String] = {
67-
def readJvmOptsFile(jvmOptsFile: Path): List[String] = {
68-
if (!Files.isReadable(jvmOptsFile)) {
69-
if (Files.exists(jvmOptsFile)) {
70-
logger.error(s"Ignored unreadable ${jvmOptsFile.toAbsolutePath()}")
71-
}
72-
73-
Nil
74-
} else {
75-
val contents = new String(Files.readAllBytes(jvmOptsFile), StandardCharsets.UTF_8)
76-
contents.linesIterator.toList
70+
def detectJvmOptsFile(jvmOptsFile: Path): Unit = {
71+
if (Files.exists(jvmOptsFile)) {
72+
logger.warn(s"Since Bloop 1.5.0 ${jvmOptsFile.toAbsolutePath()} is ignored.")
7773
}
7874
}
79-
8075
val jvmServerArgs = serverArgs.filter(_.startsWith("-J"))
81-
val jvmOptionsFromHome = readJvmOptsFile(Environment.defaultBloopDirectory.resolve(".jvmopts"))
82-
val jvmOptionsFromPathNextToBinary = server match {
83-
case AvailableAtPath(binary) => readJvmOptsFile(binary.getParent.resolve(".jvmopts"))
76+
detectJvmOptsFile(Environment.defaultBloopDirectory.resolve(".jvmopts"))
77+
server match {
78+
case AvailableAtPath(binary) => detectJvmOptsFile(binary.getParent.resolve(".jvmopts"))
8479
case _ => Nil
8580
}
8681

87-
(jvmOptionsFromHome ++ jvmOptionsFromPathNextToBinary ++ jvmServerArgs).map(_.stripPrefix("-J"))
82+
jvmServerArgs.map(_.stripPrefix("-J"))
8883
}
8984

9085
// TODO: Add more options to better tweak GC based on benchmarks

0 commit comments

Comments
 (0)