Skip to content

Commit 5dd2c0f

Browse files
committed
feat: account for -build-tool:mill
Without this if you're using Mill and you don't pass in -build-tool:sbt this will blow up because it doesn't recognize vf: as a uri scheme when default is choses. This introduces a new UriScheme.ZINC that both Mill and sbt can use since as far as I know, this is a Zinc abstraction not an sbt one. I then deprecated the UriScheme.SBT
1 parent 5a49a8b commit 5dd2c0f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public static SemanticdbJavacOptions parse(String[] args, Context ctx) {
5555
}
5656
} else if (arg.startsWith("-sourceroot:")) {
5757
result.sourceroot = Paths.get(arg.substring("-sourceroot:".length())).normalize();
58-
} else if (arg.equals("-build-tool:sbt")) {
59-
result.uriScheme = UriScheme.SBT;
58+
} else if (arg.equals("-build-tool:sbt") || args.equals("-build-tool:mill")) {
59+
result.uriScheme = UriScheme.ZINC;
6060
} else if (arg.equals("-build-tool:bazel")) {
6161
result.uriScheme = UriScheme.BAZEL;
6262
useJavacClassesDir = true;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private void writeSemanticdb(TaskEvent event, Path output, Semanticdb.TextDocume
102102

103103
public static Path absolutePathFromUri(SemanticdbJavacOptions options, JavaFileObject file) {
104104
URI uri = file.toUri();
105-
if (options.uriScheme == UriScheme.SBT
105+
if ((options.uriScheme == UriScheme.SBT || options.uriScheme == UriScheme.ZINC)
106106
&& uri.getScheme().equals("vf")
107107
&& uri.toString().startsWith("vf://tmp/")) {
108108
String[] parts = uri.toString().split("/", 5);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
public enum UriScheme {
44
DEFAULT,
5+
/** @deprecated Use ZINC instead */
6+
@Deprecated
57
SBT,
6-
BAZEL
8+
BAZEL,
9+
ZINC
710
}

0 commit comments

Comments
 (0)