Skip to content

Commit 4dc3143

Browse files
committed
Remove the possibility to read proeprties from.jvmopts
This is no longer a supported method of specifying the server properties. Users should instead us `$HOME/.bloop/bloop.json`
1 parent 3cdfa19 commit 4dc3143

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
@@ -51,9 +51,12 @@ object Environment {
5151
/**
5252
* Reads all jvm options required to start the Bloop server, in order of priority:
5353
*
54+
* Parses `-J` prefixed jvm options in the arguments passed to the server command.
55+
*
56+
* Prior to 1.5.0 it used to also:
5457
* 1. Read `$$HOME/.bloop/.jvmopts` file.
5558
* 2. Read `.jvmopts` file right next to the location of the bloop server jar.
56-
* 3. Parse `-J` prefixed jvm options in the arguments passed to the server command.
59+
* Now, it only logs a warning if the file detected.
5760
*
5861
* Returns a list of jvm options with no `-J` prefix.
5962
*/
@@ -62,27 +65,19 @@ object Environment {
6265
serverArgs: List[String],
6366
logger: Logger
6467
): List[String] = {
65-
def readJvmOptsFile(jvmOptsFile: Path): List[String] = {
66-
if (!Files.isReadable(jvmOptsFile)) {
67-
if (Files.exists(jvmOptsFile)) {
68-
logger.error(s"Ignored unreadable ${jvmOptsFile.toAbsolutePath()}")
69-
}
70-
71-
Nil
72-
} else {
73-
val contents = new String(Files.readAllBytes(jvmOptsFile), StandardCharsets.UTF_8)
74-
contents.linesIterator.toList
68+
def detectJvmOptsFile(jvmOptsFile: Path): Unit = {
69+
if (Files.exists(jvmOptsFile)) {
70+
logger.warn(s"Since Bloop 1.5.0 ${jvmOptsFile.toAbsolutePath()} is ignored.")
7571
}
7672
}
77-
7873
val jvmServerArgs = serverArgs.filter(_.startsWith("-J"))
79-
val jvmOptionsFromHome = readJvmOptsFile(Environment.defaultBloopDirectory.resolve(".jvmopts"))
80-
val jvmOptionsFromPathNextToBinary = server match {
81-
case AvailableAtPath(binary) => readJvmOptsFile(binary.getParent.resolve(".jvmopts"))
74+
detectJvmOptsFile(Environment.defaultBloopDirectory.resolve(".jvmopts"))
75+
server match {
76+
case AvailableAtPath(binary) => detectJvmOptsFile(binary.getParent.resolve(".jvmopts"))
8277
case _ => Nil
8378
}
8479

85-
(jvmOptionsFromHome ++ jvmOptionsFromPathNextToBinary ++ jvmServerArgs).map(_.stripPrefix("-J"))
80+
jvmServerArgs.map(_.stripPrefix("-J"))
8681
}
8782

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

0 commit comments

Comments
 (0)