@@ -53,9 +53,12 @@ object Environment {
53
53
/**
54
54
* Reads all jvm options required to start the Bloop server, in order of priority:
55
55
*
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:
56
59
* 1. Read `$$HOME/.bloop/.jvmopts` file.
57
60
* 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 .
59
62
*
60
63
* Returns a list of jvm options with no `-J` prefix.
61
64
*/
@@ -64,27 +67,19 @@ object Environment {
64
67
serverArgs : List [String ],
65
68
logger : Logger
66
69
): 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. " )
77
73
}
78
74
}
79
-
80
75
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" ))
84
79
case _ => Nil
85
80
}
86
81
87
- (jvmOptionsFromHome ++ jvmOptionsFromPathNextToBinary ++ jvmServerArgs) .map(_.stripPrefix(" -J" ))
82
+ jvmServerArgs.map(_.stripPrefix(" -J" ))
88
83
}
89
84
90
85
// TODO: Add more options to better tweak GC based on benchmarks
0 commit comments