Skip to content

Commit 13197da

Browse files
committed
Add documentation for InjectSemanticdbOptions
1 parent 100a91d commit 13197da

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/InjectSemanticdbOptions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@
77
import java.util.List;
88

99
public class InjectSemanticdbOptions {
10+
/**
11+
* Updates a list of Java compiler arguments to include -Xplugin:semanticdb.
12+
*
13+
* This main method should be used by a `javac` wrapper script like this:
14+
*
15+
* <pre>
16+
* NEW_OPTIONS_PATH=$(mktemp)
17+
* java -cp semanticdb.jar \
18+
* -Dsemanticdb.output=NEW_OPTIONS_PATH \
19+
* com.sourcegraph.semanticdb_javac.InjectSemanticdbOptions $@
20+
* javac @$NEW_OPTIONS_PATH
21+
* </pre>
22+
*
23+
* Requires the following system properties:
24+
*
25+
* <ul>
26+
* <li>-Dsemanticdb.output=PATH: the file to write the updated compiler options</li>
27+
* <li>-Dsemanticdb.old-output=PATH: the file to write the original compiler options. Only used for debugging purposes.</li>
28+
* <li>-Dsemanticdb.pluginpath=PATH: the path to the SemanticDB compiler plugin jar</li>
29+
* <li>-Dsemanticdb.sourceroot=PATH: the path to use in -Xplugin:semanticdb -sourceroot:PATH</li>
30+
* <li>-Dsemanticdb.targetroot=PATH: the path to use in -Xplugin:semanticdb -targetroot:PATH</li>
31+
* </ul>
32+
*
33+
* @param args the Java compiler arguments to update.
34+
*/
1035
public static void main(String[] args) throws IOException {
1136
SemanticdbOptionBuilder newArgs = new SemanticdbOptionBuilder();
1237
for (String arg : args) {

0 commit comments

Comments
 (0)