From b937d56f854d8f8f4e507a4a422549bf1d707c5b Mon Sep 17 00:00:00 2001 From: Tomasz Pasternak Date: Wed, 7 Aug 2024 18:48:59 +0200 Subject: [PATCH] Revert "Temporarily log regurgitator and vfs related events" (#6617) This reverts commit 8100a67c40ba855d2ca8df97c1379a4e740068d3. Reason: The change resulted in an excessive number of log entries. --- base/src/META-INF/blaze-base.xml | 7 -- .../base/actions/internal/AswbDumpVfs.java | 109 ------------------ .../FileWatcherNotificationSinkCompat.java | 17 --- .../FileWatcherNotificationSinkCompat.java | 17 --- .../FileWatcherNotificationSinkCompat.java | 17 --- .../FileWatcherNotificationSinkCompat.java | 17 --- 6 files changed, 184 deletions(-) delete mode 100644 base/src/com/google/idea/blaze/base/actions/internal/AswbDumpVfs.java delete mode 100644 sdkcompat/v223/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java delete mode 100644 sdkcompat/v231/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java delete mode 100644 sdkcompat/v232/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java delete mode 100644 sdkcompat/v233/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java diff --git a/base/src/META-INF/blaze-base.xml b/base/src/META-INF/blaze-base.xml index 388d5f716d8..83ee2c42292 100644 --- a/base/src/META-INF/blaze-base.xml +++ b/base/src/META-INF/blaze-base.xml @@ -212,17 +212,10 @@ - - - - - diff --git a/base/src/com/google/idea/blaze/base/actions/internal/AswbDumpVfs.java b/base/src/com/google/idea/blaze/base/actions/internal/AswbDumpVfs.java deleted file mode 100644 index 3ca7fc544bd..00000000000 --- a/base/src/com/google/idea/blaze/base/actions/internal/AswbDumpVfs.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2024 The Bazel Authors. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.idea.blaze.base.actions.internal; - -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.Task; -import com.intellij.openapi.project.DumbAwareAction; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.newvfs.BulkFileListener; -import com.intellij.openapi.vfs.newvfs.NewVirtualFile; -import com.intellij.openapi.vfs.newvfs.events.VFileEvent; -import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; -import java.io.BufferedOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.io.UncheckedIOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import org.jetbrains.annotations.NotNull; - -class AswbDumpVfs extends DumbAwareAction { - - @Override - public void actionPerformed(@NotNull AnActionEvent anActionEvent) { - new Task.Backgroundable(anActionEvent.getProject(), "Enumerating the VFS...") { - @Override - public void run(@NotNull ProgressIndicator progressIndicator) { - try { - dumpChildrenInDbRecursively(VfsUtil.findFile(Path.of("/"), false)); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - }.queue(); - } - - private static void dumpChildrenInDbRecursively(VirtualFile dir) throws IOException { - try (PrintStream out = - new PrintStream( - new BufferedOutputStream( - Files.newOutputStream(PathManager.getLogDir().resolve("vfs.txt"))), - false)) { - if (!(dir instanceof NewVirtualFile)) { - out.println(dir.getPresentableUrl() + ": not in db (" + dir.getClass().getName() + ")"); - return; - } - - PersistentFS pfs = PersistentFS.getInstance(); - List dirs = new ArrayList<>(); - dirs.add(dir); - while (!dirs.isEmpty()) { - ProgressManager.checkCanceled(); - dir = dirs.remove(0); - if (pfs.wereChildrenAccessed(dir)) { - out.println(dir.getPath()); - for (String name : pfs.listPersisted(dir)) { - NewVirtualFile child = ((NewVirtualFile) dir).findChildIfCached(name); - if (child == null) { - out.println(dir.getPath() + "/" + name + " - ?? (not found in db)"); - continue; - } - if (child.isDirectory()) { - dirs.add(child); - } - } - } - } - } - } - - static class BulkListener implements BulkFileListener { - private static final Logger vfsDiagLogger = - Logger.getInstance("#" + BulkListener.class.getName() + "_vfs_diag"); - - @Override - public void before(List events) { - vfsDiagLogger.info(String.format("VFS Events: (%d)", events.size())); - for (int i = 0; i < events.size(); i++) { - VFileEvent event = events.get(i); - vfsDiagLogger.info(" " + event); - if (i > 1000) { - vfsDiagLogger.info(" ...more"); - break; - } - } - vfsDiagLogger.info(" end."); - } - } -} diff --git a/sdkcompat/v223/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java b/sdkcompat/v223/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java deleted file mode 100644 index 3ff8a2a8e14..00000000000 --- a/sdkcompat/v223/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.google.idea.sdkcompat.platform; - -import com.google.common.collect.ImmutableList; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; -import java.util.Collection; -import org.jetbrains.annotations.NotNull; - -/** A compatibility wrapper for {@link FileWatcherNotificationSink}. */ -public interface FileWatcherNotificationSinkCompat extends FileWatcherNotificationSink { - void notifyMappingCompat(Collection> collection); - - @Override - default void notifyMapping(@NotNull Collection> collection) { - notifyMappingCompat(ImmutableList.copyOf(collection)); - } -} diff --git a/sdkcompat/v231/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java b/sdkcompat/v231/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java deleted file mode 100644 index a6f29c6fbf9..00000000000 --- a/sdkcompat/v231/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.google.idea.sdkcompat.platform; - -import com.google.common.collect.ImmutableList; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; -import java.util.Collection; -import org.jetbrains.annotations.NotNull; - -/** A compatibility wrapper for {@link FileWatcherNotificationSink}. */ -public interface FileWatcherNotificationSinkCompat extends FileWatcherNotificationSink { - void notifyMappingCompat(Collection> collection); - - @Override - default void notifyMapping(@NotNull Collection> collection) { - notifyMappingCompat(ImmutableList.copyOf(collection)); - } -} diff --git a/sdkcompat/v232/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java b/sdkcompat/v232/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java deleted file mode 100644 index a6f29c6fbf9..00000000000 --- a/sdkcompat/v232/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.google.idea.sdkcompat.platform; - -import com.google.common.collect.ImmutableList; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; -import java.util.Collection; -import org.jetbrains.annotations.NotNull; - -/** A compatibility wrapper for {@link FileWatcherNotificationSink}. */ -public interface FileWatcherNotificationSinkCompat extends FileWatcherNotificationSink { - void notifyMappingCompat(Collection> collection); - - @Override - default void notifyMapping(@NotNull Collection> collection) { - notifyMappingCompat(ImmutableList.copyOf(collection)); - } -} diff --git a/sdkcompat/v233/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java b/sdkcompat/v233/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java deleted file mode 100644 index a6f29c6fbf9..00000000000 --- a/sdkcompat/v233/com/google/idea/sdkcompat/platform/FileWatcherNotificationSinkCompat.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.google.idea.sdkcompat.platform; - -import com.google.common.collect.ImmutableList; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; -import java.util.Collection; -import org.jetbrains.annotations.NotNull; - -/** A compatibility wrapper for {@link FileWatcherNotificationSink}. */ -public interface FileWatcherNotificationSinkCompat extends FileWatcherNotificationSink { - void notifyMappingCompat(Collection> collection); - - @Override - default void notifyMapping(@NotNull Collection> collection) { - notifyMappingCompat(ImmutableList.copyOf(collection)); - } -}