-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make //clwb(plugin) and //cpp(plugin) dependency on cidr.lang optiona…
…l: plugin xmls split (#5473) # Discussion thread for this change Issue number: #5472 # Description of this change Long story short: `com.intellij.modules.cidr.lang` is going to become optional in CLion at some point. All the usages of code exported from `com.intellij.modules.cidr.lang` are moved to optional plugin xmls, so plugin won't emit lots of exceptions and break the IDE if the mentioned module is not available. A little bit more detailed here. The CLion team are working on deprecation of the old language engine. Parts of it which are not going to be deprecated are moved to `cidr-base-plugin` library, which is a part of `CIDR Base (com.intellij.cidr.base)` essential CLion plugin, so any symbol from `cidr-base-plugin` will always be available. Though that does not apply to `c-plugin` library which is a part of `com.intellij.modules.cidr.lang` module. At this point the goal of this change is to make Bazel for CLion tolerant to disabled `com.intellij.modules.cidr.lang`. We're going to contribute further to adjust existing code which is moved to `*.oclang(.*)?` packages in the review to preserve the features when only the new language engine is available. # Individual changes * Replace cidr.lang code with cidr.lang.base code * Extract cidr.lang dependent code in //cpp to optional runtime dep * Extract cidr.lang dependent code in //clwb to optional runtime dep * Extract cidr.lang dependent code in //clwb to optional runtime dep
- Loading branch information
Showing
25 changed files
with
231 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
~ 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. | ||
--> | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="cidr.debugger"> | ||
<languageSupport language="" implementationClass="com.google.idea.blaze.clwb.oclang.run.BlazeCidrDebuggerSupportFactory"/> | ||
</extensions> | ||
|
||
<extensions defaultExtensionNs="com.google.idea.blaze"> | ||
<clwb.googleTestUtilAdapter implementation="com.google.idea.blaze.clwb.oclang.run.CidrGoogleTestUtilAdapter"/> | ||
<TestContextProvider implementation="com.google.idea.blaze.clwb.oclang.run.producers.CppTestContextProvider"/> | ||
</extensions> | ||
</idea-plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
clwb/src/com/google/idea/blaze/clwb/run/GoogleTestUtilAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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.clwb.run; | ||
|
||
import com.intellij.openapi.extensions.ExtensionPointName; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.psi.PsiElement; | ||
import com.jetbrains.cidr.execution.testing.CidrTestScopeElement; | ||
import java.util.function.Predicate; | ||
import javax.annotation.Nullable; | ||
|
||
public interface GoogleTestUtilAdapter { | ||
ExtensionPointName<GoogleTestUtilAdapter> EP_NAME = | ||
ExtensionPointName.create("com.google.idea.blaze.clwb.googleTestUtilAdapter"); | ||
|
||
@Nullable | ||
static PsiElement findGoogleTestSymbol(Project project) { | ||
if (EP_NAME.getExtensionList().size() > 1) { | ||
throw new IllegalStateException("More than 1 extension for " + EP_NAME.getName() + " is not supported"); | ||
} | ||
|
||
GoogleTestUtilAdapter adapter = EP_NAME.getPoint().extensions().findFirst().orElse(null); | ||
if (adapter != null) { | ||
return adapter.findGoogleTestSymbol(project, testScopeElement -> true); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
PsiElement findGoogleTestSymbol( | ||
Project project, Predicate<CidrTestScopeElement> predicate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
~ 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. | ||
--> | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="cidr.lang"> | ||
<autoImportHelper implementation="com.google.idea.blaze.cpp.oclang.BlazeCppAutoImportHelper"/> | ||
<customHeaderProvider implementation="com.google.idea.blaze.cpp.oclang.BlazeCustomHeaderProvider"/> | ||
<includeHelper implementation="com.google.idea.blaze.cpp.oclang.BlazeIncludeHelper"/> | ||
</extensions> | ||
|
||
<extensions defaultExtensionNs="com.google.idea.blaze"> | ||
<SyncStatusContributor implementation="com.google.idea.blaze.cpp.oclang.CppSyncStatusContributor"/> | ||
<cpp.SourceFileFinder implementation="com.google.idea.blaze.cpp.oclang.OCSourceFileFinder"/> | ||
</extensions> | ||
</idea-plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.