Skip to content

Commit

Permalink
limit the times diagnostics will be reported for #113
Browse files Browse the repository at this point in the history
  • Loading branch information
plaird committed Apr 30, 2020
1 parent 70cb0a7 commit dcf62f2
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,16 @@ private IPath getJarPathOnDisk(File bazelOutputBase, File bazelExecRoot, String
// resolving the link will fail if the symlink does not a point to a real file
path = Files.readSymbolicLink(path);
} catch (IOException ex) {
// TODO this can happen if someone does a 'bazel clean' using the command line #113
// https://github.com/salesforce/bazel-eclipse/issues/113
BazelPluginActivator.error("Problem adding jar to project ["+eclipseProjectName+"] because it does not exist on the filesystem: "+path);
printDirectoryDiagnostics(path.toFile().getParentFile().getParentFile(), " ");
}
} else {
// it is a normal path, check for existence
if (!Files.exists(path)) {
// TODO this can happen if someone does a 'bazel clean' using the command line #113
// https://github.com/salesforce/bazel-eclipse/issues/113
BazelPluginActivator.error("Problem adding jar to project ["+eclipseProjectName+"] because it does not exist on the filesystem: "+path);
printDirectoryDiagnostics(path.toFile().getParentFile().getParentFile(), " ");
}
Expand Down Expand Up @@ -528,8 +532,15 @@ private void addProjectReference(IProject thisProject, IProject thatProject) {

}


private static int diagnosticsCount = 0;
private static void printDirectoryDiagnostics(File path, String indent) {
if (diagnosticsCount > 3) {
// only do this a few times so we know there are problems but then be silent,
// otherwise a shutdown with lots of projects open can take forever
return;
}
diagnosticsCount++;

File[] children = path.listFiles();
System.out.println(indent+BazelProjectHelper.getCanonicalPathStringSafely(path));
if (children != null) {
Expand Down

0 comments on commit dcf62f2

Please sign in to comment.