From 8be6e2256e859d3dfceb5a83a9f273a0de4222c5 Mon Sep 17 00:00:00 2001
From: Daniel Brauner <daniel.brauner@jetbrains.com>
Date: Tue, 21 Jan 2025 19:29:57 +0100
Subject: [PATCH] Remove BlazeTypeScriptConfigLibraryUpdater.java

Apparently, this service has not been used since 242 as it was not selected in
the BUILD file and was only enabled for CLion. However, in CLion the following
exception was raised because of this service:

InstanceNotRegisteredException:
com.intellij.lang.typescript.tsconfig.TypeScriptConfigLibraryUpdater ->
com.google.idea.blaze.typescript.BlazeTypeScriptConfigLibraryUpdater
---
 javascript/BUILD                              | 14 +---
 .../src/META-INF/javascript-contents-243.xml  | 23 ------
 .../BlazeTypeScriptConfigLibraryUpdater.java  | 74 -------------------
 ...TypeScriptConfigLibraryUpdaterAdapter.java | 28 -------
 ...TypeScriptConfigLibraryUpdaterAdapter.java | 31 --------
 ...TypeScriptConfigLibraryUpdaterAdapter.java | 31 --------
 6 files changed, 1 insertion(+), 200 deletions(-)
 delete mode 100644 javascript/src/META-INF/javascript-contents-243.xml
 delete mode 100644 javascript/src/com/google/idea/blaze/typescript/BlazeTypeScriptConfigLibraryUpdater.java
 delete mode 100644 sdkcompat/v242/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
 delete mode 100644 sdkcompat/v243/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
 delete mode 100644 sdkcompat/v251/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java

diff --git a/javascript/BUILD b/javascript/BUILD
index e37009eb4d1..8739b36c072 100644
--- a/javascript/BUILD
+++ b/javascript/BUILD
@@ -41,21 +41,9 @@ optional_plugin_xml(
     plugin_xml = "src/META-INF/javascript-contents.xml",
 )
 
-optional_plugin_xml(
-    name = "optional_xml_243",
-    module = ["JavaScript"],
-    plugin_xml = "src/META-INF/javascript-contents-243.xml",
-)
-
 intellij_plugin_library(
     name = "plugin_library",
-    optional_plugin_xmls = [":optional_xml"] + select_for_plugin_api({
-        "intellij-2024.3": [],
-        "intellij-ue-2024.3": [],
-        "intellij-2025.1": [],
-        "intellij-ue-2025.1": [],
-        "default": [":optional_xml_243"],
-    }),
+    optional_plugin_xmls = [":optional_xml"],
     plugin_xmls = ["src/META-INF/blaze-javascript.xml"],
     visibility = PLUGIN_PACKAGES_VISIBILITY,
     deps = [":javascript"],
diff --git a/javascript/src/META-INF/javascript-contents-243.xml b/javascript/src/META-INF/javascript-contents-243.xml
deleted file mode 100644
index 8e98bd7ebba..00000000000
--- a/javascript/src/META-INF/javascript-contents-243.xml
+++ /dev/null
@@ -1,23 +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.
-  -->
-<idea-plugin>
-    <extensions defaultExtensionNs="com.intellij">
-        <projectService
-                serviceInterface="com.intellij.lang.typescript.tsconfig.TypeScriptConfigLibraryUpdater"
-                serviceImplementation="com.google.idea.blaze.typescript.BlazeTypeScriptConfigLibraryUpdater"
-                overrides="true"/>
-    </extensions>
-</idea-plugin>
diff --git a/javascript/src/com/google/idea/blaze/typescript/BlazeTypeScriptConfigLibraryUpdater.java b/javascript/src/com/google/idea/blaze/typescript/BlazeTypeScriptConfigLibraryUpdater.java
deleted file mode 100644
index ca0f05cbb2d..00000000000
--- a/javascript/src/com/google/idea/blaze/typescript/BlazeTypeScriptConfigLibraryUpdater.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2019 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.typescript;
-
-import com.google.idea.blaze.base.settings.Blaze;
-import com.google.idea.sdkcompat.javascript.TypeScriptConfigLibraryUpdaterAdapter;
-import com.intellij.lang.javascript.library.JSLibraryMappings;
-import com.intellij.lang.typescript.TypeScriptSettings;
-import com.intellij.lang.typescript.tsconfig.TypeScriptConfigLibraryUpdater;
-import com.intellij.openapi.project.Project;
-
-/**
- * Dummy {@link TypeScriptConfigLibraryUpdater} that does nothing, to prevent tsconfig$paths from
- * being created.
- */
-class BlazeTypeScriptConfigLibraryUpdater extends TypeScriptConfigLibraryUpdaterAdapter {
-  private final Project project;
-  private final boolean isBlaze;
-  private boolean initialized;
-
-  public BlazeTypeScriptConfigLibraryUpdater(Project project) {
-    super(project);
-    this.project = project;
-    this.isBlaze = Blaze.isBlazeProject(project);
-    this.initialized = false;
-  }
-
-  @Override
-  public void queueToUpdate() {
-    if (isBlaze
-        && BlazeTypeScriptAdditionalLibraryRootsProvider.useTypeScriptAdditionalLibraryRootsProvider
-            .getValue()) {
-      if (initialized) {
-        return;
-      }
-      initialized = true;
-      JSLibraryMappings mappings = JSLibraryMappings.getInstance(project);
-      if (BlazeTypeScriptAdditionalLibraryRootsProvider.moveTsconfigFilesToAdditionalLibrary
-          .getValue()) {
-        if (mappings.isAssociatedWithProject(
-            TypeScriptConfigLibraryUpdater.TSCONFIG_PATHS_LIBRARY)) {
-          mappings.disassociateWithProject(TypeScriptConfigLibraryUpdater.TSCONFIG_PATHS_LIBRARY);
-        }
-      } else {
-        if (!mappings.isAssociatedWithProject(
-            TypeScriptConfigLibraryUpdater.TSCONFIG_PATHS_LIBRARY)) {
-          mappings.associate(null, TypeScriptConfigLibraryUpdater.TSCONFIG_PATHS_LIBRARY, true);
-        }
-
-        TypeScriptSettings settings = TypeScriptSettings.getSettings(project);
-        if (settings != null) {
-          settings.setAutoIncludeConfigPaths(true);
-          super.queueToUpdate();
-          settings.setAutoIncludeConfigPaths(false);
-        }
-      }
-    } else {
-      super.queueToUpdate();
-    }
-  }
-}
diff --git a/sdkcompat/v242/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java b/sdkcompat/v242/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
deleted file mode 100644
index ef7321e3d31..00000000000
--- a/sdkcompat/v242/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
+++ /dev/null
@@ -1,28 +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.sdkcompat.javascript;
-
-import com.intellij.lang.typescript.tsconfig.TypeScriptConfigLibraryUpdater;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-// #api242
-public class TypeScriptConfigLibraryUpdaterAdapter extends TypeScriptConfigLibraryUpdater {
-    public TypeScriptConfigLibraryUpdaterAdapter(@NotNull Project project) {
-        super(project);
-    }
-}
diff --git a/sdkcompat/v243/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java b/sdkcompat/v243/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
deleted file mode 100644
index 107b7736ec8..00000000000
--- a/sdkcompat/v243/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
+++ /dev/null
@@ -1,31 +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.sdkcompat.javascript;
-
-import com.intellij.openapi.project.Project;
-
-// #api242
-// Temporary empty implementation as 243 made this class sealed
-public class TypeScriptConfigLibraryUpdaterAdapter {
-    public TypeScriptConfigLibraryUpdaterAdapter(Project project) {
-
-    }
-
-    public void queueToUpdate() {
-
-    };
-}
diff --git a/sdkcompat/v251/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java b/sdkcompat/v251/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
deleted file mode 100644
index 107b7736ec8..00000000000
--- a/sdkcompat/v251/com/google/idea/sdkcompat/javascript/TypeScriptConfigLibraryUpdaterAdapter.java
+++ /dev/null
@@ -1,31 +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.sdkcompat.javascript;
-
-import com.intellij.openapi.project.Project;
-
-// #api242
-// Temporary empty implementation as 243 made this class sealed
-public class TypeScriptConfigLibraryUpdaterAdapter {
-    public TypeScriptConfigLibraryUpdaterAdapter(Project project) {
-
-    }
-
-    public void queueToUpdate() {
-
-    };
-}