Skip to content

Commit

Permalink
Support CLion 2024.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LeFrosch committed Jun 6, 2024
1 parent ff5d037 commit 422e2b4
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 42 deletions.
16 changes: 8 additions & 8 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,16 @@ http_archive(
url = CLION_241_URL,
)

# CLION_242_SHA = "35c1136b62f84c233b3e91a0fefa84f3da14a8b3939245fb373f728383aca1f0"
CLION_242_SHA = "35c1136b62f84c233b3e91a0fefa84f3da14a8b3939245fb373f728383aca1f0"

# CLION_242_URL = "https://www.jetbrains.com/intellij-repository/snapshots/com/jetbrains/intellij/clion/clion/242.12881.46-EAP-SNAPSHOT/clion-242.12881.46-EAP-SNAPSHOT.zip"
CLION_242_URL = "https://www.jetbrains.com/intellij-repository/snapshots/com/jetbrains/intellij/clion/clion/242.12881.46-EAP-SNAPSHOT/clion-242.12881.46-EAP-SNAPSHOT.zip"

# http_archive(
# name = "clion_2024_2",
# build_file = "@//intellij_platform_sdk:BUILD.clion242",
# sha256 = CLION_242_SHA,
# url = CLION_242_URL,
# )
http_archive(
name = "clion_2024_2",
build_file = "@//intellij_platform_sdk:BUILD.clion242",
sha256 = CLION_242_SHA,
url = CLION_242_URL,
)

DEVKIT_BUILD_FILE = """
java_import(
Expand Down
15 changes: 2 additions & 13 deletions clwb/src/com/google/idea/blaze/plugin/CMakeNotificationFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.sdkcompat.clion.CMakeNotificationProviderWrapper;
import com.google.idea.sdkcompat.general.EditorNotificationCompat;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.EditorNotifications;
import com.jetbrains.cidr.cpp.cmake.workspace.CMakeNotificationProvider;

import javax.annotation.Nullable;
import javax.swing.JComponent;
Expand Down Expand Up @@ -56,16 +54,7 @@ public JComponent createNotificationPanel(
}

public static void overrideProjectExtension(Project project) {
unregisterDelegateExtension(EditorNotificationCompat.getEp(project));
EditorNotificationCompat.getEp(project)
.registerExtension(new CMakeNotificationFilter(project));
}

private static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
CMakeNotificationProviderWrapper.unregisterDelegateExtension(EditorNotificationCompat.getEp(project));
EditorNotificationCompat.getEp(project).registerExtension(new CMakeNotificationFilter(project));
}
}
1 change: 1 addition & 0 deletions cpp/sdkcompat/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ java_library(
"clion-2023.2": ["//cpp/sdkcompat/v232"],
"clion-2023.3": ["//cpp/sdkcompat/v233"],
"clion-2024.1": ["//cpp/sdkcompat/v241"],
"clion-2024.2": ["//cpp/sdkcompat/v242"],
}),
visibility = ["//cpp:__pkg__"],
deps = ["//intellij_platform_sdk:plugin_api"],
Expand Down
19 changes: 19 additions & 0 deletions cpp/sdkcompat/v242/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.

filegroup(
name = "v242",
srcs = glob(["**/*.java"]),
visibility = ["//cpp/sdkcompat:__pkg__"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2023 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.cpp.qsync;

import com.intellij.openapi.util.Disposer;
import com.jetbrains.cidr.lang.workspace.OCWorkspace;

/** SDK compat class for {@link OCWorkspace.ModifiableModel} */
public class OCWorkspaceModifiableModelDisposer {

private OCWorkspaceModifiableModelDisposer() {}

public static void dispose(OCWorkspace.ModifiableModel modifiableModel) {
Disposer.dispose(modifiableModel);
}
}
6 changes: 4 additions & 2 deletions intellij_platform_sdk/BUILD.clion242
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ package(default_visibility = ["//visibility:public"])

java_import(
name = "sdk",
jars = glob(
["lib/*.jar"],
jars = glob([
"lib/*.jar",
"lib/modules/*.jar"
],
exclude = [
# mockito-extensions needs to be removed from this jar.
"lib/testFramework.jar",
Expand Down
2 changes: 1 addition & 1 deletion intellij_platform_sdk/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ INDIRECT_IJ_PRODUCTS = {
"android-studio-oss-under-dev": "android-studio-2023.2",
"clion-oss-oldest-stable": "clion-2023.3",
"clion-oss-latest-stable": "clion-2024.1",
"clion-oss-under-dev": "clion-2024.1",
"clion-oss-under-dev": "clion-2024.2",
# Indirect ij_product mapping for Cloud Code Plugin OSS
"intellij-cc-oldest-stable": "intellij-2022.3",
"intellij-cc-latest-stable": "intellij-2022.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.google.idea.sdkcompat.clion;

import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand All @@ -18,4 +19,12 @@ public CMakeNotificationProviderWrapper() {
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
return value.createNotificationPanel(virtualFile, fileEditor, project);
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.google.idea.sdkcompat.clion;

import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand All @@ -18,4 +19,12 @@ public CMakeNotificationProviderWrapper() {
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
return value.createNotificationPanel(virtualFile, fileEditor, project);
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.google.idea.sdkcompat.clion;

import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand All @@ -18,4 +19,12 @@ public CMakeNotificationProviderWrapper() {
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
return value.createNotificationPanel(virtualFile, fileEditor, project);
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.idea.sdkcompat.clion;


import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -29,4 +30,12 @@ public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fi

return null;
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.idea.sdkcompat.clion;


import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -29,4 +30,12 @@ public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fi

return null;
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.google.idea.sdkcompat.clion;


import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -29,4 +30,12 @@ public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fi

return null;
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.idea.sdkcompat.clion;


import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -45,4 +46,12 @@ public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fi

return null;
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {
for (T extension : extensionPoint.getExtensions()) {
if (extension instanceof CMakeNotificationProvider) {
extensionPoint.unregisterExtension(extension);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,20 @@
package com.google.idea.sdkcompat.clion;


import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.cpp.cmake.workspace.CMakeNotificationProvider;

import java.util.function.Function;
import javax.annotation.Nullable;
import javax.swing.*;
import javax.swing.JComponent;

// #api223
// #api224
public class CMakeNotificationProviderWrapper {
CMakeNotificationProvider value;

public CMakeNotificationProviderWrapper(){
this.value = new CMakeNotificationProvider();
}

@Nullable
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
Function<? super FileEditor, ? extends JComponent> notificationProducer =
this.value.collectNotificationData(project, virtualFile);

if (notificationProducer != null) {
return notificationProducer.apply(fileEditor);
}

return null;
}

public static <T> void unregisterDelegateExtension(ExtensionPoint<T> extensionPoint) {}
}
1 change: 0 additions & 1 deletion third_party/javascript/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ java_library(
"clion-2023.1": ["@intellij_ue_2023_1//:angular"],
"clion-2023.2": ["@intellij_ue_2023_2//:angular"],
"clion-2023.3": ["@intellij_ue_2023_3//:angular"],
"clion-2024.2": ["@clion_2024_2//:angular"],
"default": [],
}),
)
Expand Down

0 comments on commit 422e2b4

Please sign in to comment.