Add logging for deploy jar library files
We warn users if a deploy jar file is detected as a blaze library since it slows down indexing performance. This CL logs this warning for gathering metrics around it. See b/235274613.
@@ -58,6 +58,7 @@ import com.google.idea.blaze.java.sync.projectstructure.JavaSourceFolderProvider
import com.google.idea.blaze.java.sync.projectstructure.Jdks;
import com.google.idea.blaze.java.sync.workingset.JavaWorkingSet;
import com.google.idea.common.util.Transactions;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.project.Project;
@@ -73,6 +74,7 @@ import javax.annotation.Nullable;
/** Sync support for Java. */
public class BlazeJavaSyncPlugin implements BlazeSyncPlugin {
private final JdepsFileReader jdepsFileReader = new JdepsFileReader();
+ private static final Logger logger = Logger.getInstance(BlazeJavaSyncPlugin.class);
@Override
public ImmutableList<WorkspaceType> getSupportedWorkspaceTypes() {
@@ -277,15 +279,16 @@ public class BlazeJavaSyncPlugin implements BlazeSyncPlugin {
if (artifactLocation.getRelativePath().endsWith("deploy.jar")
|| artifactLocation.getRelativePath().endsWith("deploy-ijar.jar")
|| artifactLocation.getRelativePath().endsWith("deploy-hjar.jar")) {
- context.output(
- new PerformanceWarning(
+ String warningMessage =
"Performance warning: You have added a deploy jar as a library. "
+ "This can lead to poor indexing performance, and the debugger may "
+ "become confused and step into the deploy jar instead of your code. "
+ "Consider redoing the rule to not use deploy jars, exclude the target "
+ "from your .blazeproject, or exclude the library.\n"
+ "Library path: "
- + artifactLocation.getRelativePath()));
+ + artifactLocation.getRelativePath();
+ logger.warn(warningMessage);
+ context.output(new PerformanceWarning(warningMessage));
}
}
}
