Skip to content

Commit 5dfd2fb

Browse files
committed
Make SemanticdbAgent consistent with InjectSemanticdbOptions
Also improves the formatting of the `--verbose` option.
1 parent 94ff365 commit 5dfd2fb

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

semanticdb-agent/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbAgent.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,18 @@ public static void build(
135135
switch (previousOption) {
136136
case "-processorpath":
137137
case "-processor-path":
138+
case "-cp":
138139
case "-classpath":
139140
case "-class-path":
140141
isProcessorpathUpdated = true;
141142
newOptions.add(PLUGINPATH + File.pathSeparator + option);
142143
break;
144+
case "-Xlint":
145+
break;
143146
default:
147+
if (option.startsWith("-Xplugin:ErrorProne")) {
148+
break;
149+
}
144150
newOptions.add(option);
145151
break;
146152
}
@@ -155,13 +161,19 @@ public static void build(
155161
"-Xplugin:semanticdb -sourceroot:%s -targetroot:%s", SOURCEROOT, TARGETROOT));
156162

157163
if (DEBUGPATH != null) {
158-
try (PrintStream fos =
159-
new PrintStream(
160-
Files.newOutputStream(
161-
Paths.get(DEBUGPATH), StandardOpenOption.APPEND, StandardOpenOption.CREATE))) {
162-
fos.println("Java Home: " + System.getProperty("java.home"));
163-
fos.println("Old Options: " + arguments);
164-
fos.println("New Options: " + newOptions);
164+
ArrayList<String> debuglines = new ArrayList<>();
165+
debuglines.add("============== Java Home: " + System.getProperty("java.home"));
166+
debuglines.add("============== Old Options");
167+
debuglines.addAll(arguments);
168+
debuglines.add("============== New Options");
169+
debuglines.addAll(newOptions);
170+
171+
try {
172+
Files.write(
173+
Paths.get(DEBUGPATH),
174+
debuglines,
175+
StandardOpenOption.CREATE,
176+
StandardOpenOption.APPEND);
165177
} catch (IOException e) {
166178
}
167179
}

0 commit comments

Comments
 (0)