diff options
author | George Fraser <george@fivetran.com> | 2019-04-01 19:31:33 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-04-01 19:31:33 -0700 |
commit | 525b9cf04a32540bf70928da767dd6d4d7dbb5ef (patch) | |
tree | 8996f69496484edf0bc5174f5e45ff46bea25098 /src/main | |
parent | 484fa8f8ed2e460bb8e100d7587a8f3e1e661bfd (diff) | |
download | java-language-server-525b9cf04a32540bf70928da767dd6d4d7dbb5ef.zip |
Don't include outputs in classpath
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/javacs/InferConfig.java | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/src/main/java/org/javacs/InferConfig.java b/src/main/java/org/javacs/InferConfig.java index 2e8f82c..f52884b 100644 --- a/src/main/java/org/javacs/InferConfig.java +++ b/src/main/java/org/javacs/InferConfig.java @@ -19,7 +19,6 @@ import java.util.Set; import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.stream.Collectors; -import java.util.stream.Stream; class InferConfig { private static final Logger LOG = Logger.getLogger("main"); @@ -56,15 +55,8 @@ class InferConfig { return Paths.get(System.getProperty("user.home")).resolve(".gradle"); } - Set<Path> classPath() { - var result = new HashSet<Path>(); - result.addAll(buildClassPath()); - result.addAll(workspaceClassPath()); - return result; - } - /** Find .jar files for external dependencies, for examples maven dependencies in ~/.m2 or jars in bazel-genfiles */ - Set<Path> buildClassPath() { + Set<Path> classPath() { // externalDependencies if (!externalDependencies.isEmpty()) { var result = new HashSet<Path>(); @@ -100,52 +92,6 @@ class InferConfig { return Collections.emptySet(); } - /** - * Find directories that contain java .class files in the workspace, for example files generated by maven in - * target/classes - */ - Set<Path> workspaceClassPath() { - // externalDependencies - if (!externalDependencies.isEmpty()) { - return Collections.emptySet(); - } - - // Maven - if (Files.exists(workspaceRoot.resolve("pom.xml"))) { - try { - return Files.walk(workspaceRoot).flatMap(this::outputDirectory).collect(Collectors.toSet()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // Bazel - if (Files.exists(workspaceRoot.resolve("WORKSPACE"))) { - var bazelBin = workspaceRoot.resolve("bazel-bin"); - - if (Files.exists(bazelBin) && Files.isSymbolicLink(bazelBin)) { - return bazelOutputDirectories(bazelBin); - } - } - - return Collections.emptySet(); - } - - /** Recognize build root files like pom.xml and return compiler output directories */ - private Stream<Path> outputDirectory(Path file) { - if (file.getFileName().toString().equals("pom.xml")) { - var target = file.resolveSibling("target"); - - if (Files.exists(target) && Files.isDirectory(target)) { - return Stream.of(target.resolve("classes"), target.resolve("test-classes")); - } - } - - // TODO gradle - - return Stream.empty(); - } - private void findBazelJavac(File bazelRoot, File workspaceRoot, Set<Path> acc) { // If _javac directory exists, search it for dirs with names like lib*_classes var javac = new File(bazelRoot, "_javac"); |