Tracking bug for 2020.1 support
Note - I realize 2019.3 is only stabilizing and not yet formally supported - but let's make it so we can at least manually build the plugin for 2020.1 to start hashing out early problems. 2020.1 EAP is now available. In order to let infrastructure teams get ahead of release, and identify issues, it would be great to get at least buildable support for 2020.1 EAP
Tried to build it with bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-ue-2020.1
and got the following error
ERROR: /Users/cromwellian/intellij/ijwb/BUILD:41:1: in cmd attribute of genrule rule //ijwb:stamped_plugin_xml_api_version: label '//intellij_platform_sdk:application_info_jar' in $(location) expression expands to no files. Since this rule was created by the macro 'stamped_plugin_xml', the error might have been caused by the macro implementation
ERROR: Analysis of target '//ijwb:ijwb_bazel_zip' failed; build aborted: Analysis of target '//ijwb:stamped_plugin_xml_api_version' failed; build aborted
I saw it successfully fetch intellij-ce-2020.1 from some repo during the build.
I got it to build and install with this:
diff --git a/WORKSPACE b/WORKSPACE
index a2f1d6ab..fbba1b3b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -56,6 +56,7 @@ http_archive(
name = "intellij_ue_2020_1",
build_file = "@//intellij_platform_sdk:BUILD.ue201",
sha256 = "0944d1b15e6d8d8c13e33ed0bb43773bf7a2cd2100a679c2a668d543a7931de8",
+ strip_prefix = "idea-IU-201.4515.24",
url = "https://download-cf.jetbrains.com/idea/ideaIU-201.4515.24.tar.gz",
)
I've tried it a bit and it looks ok, I haven't tested it much because we're still using 2019.3.4, and the plugin built off master doesn't support that.
That worked for me, and my project synced properly, and the Bazel icons are there, Run configurations work, but the top level Bazel menubar item disappeared. :(
It appears there were quite a few breaking changes with the stable release 201.6668.121. Mainly a bunch of internal things have been removed. I managed to get it working with the following changes (with no exceptions in the logs), although this hasn't been extensively tested, or checked for backward compatibility.
https://github.com/bazelbuild/intellij/compare/v2020.04.07...dillon-giacoppo:master.
The main tradeoff is that it does not seem possible to have a conditionally rendered Bazel menu in the menubar. isBlazeProject returns False when the menu bar is rendered and it appears it does not ever get updated again. I worked around this by moving to the tools menu which is updated on every click.
The IJWB build of the patch can be tried here 馃憠 https://github.com/dillon-giacoppo/intellij/releases/download/v201/ijwb_bazel.zip. It would be great to get this tested and merged upstream, even as a prerelease branch.
It appears there were quite a few breaking changes with the stable release
201.6668.121. Mainly a bunch of internal things have been removed. I managed to get it working with the following changes (with no exceptions in the logs), although this hasn't been extensively tested, or checked for backward compatibility.
v2020.04.07...dillon-giacoppo:master.The main tradeoff is that it does not seem possible to have a conditionally rendered Bazel menu in the menubar.
isBlazeProjectreturns False when the menu bar is rendered and it appears it does not ever get updated again. I worked around this by moving to the tools menu which is updated on every click.The IJWB build of the patch can be tried here https://github.com/dillon-giacoppo/intellij/releases/download/v201/ijwb_bazel.zip. It would be great to get this tested and merged upstream, even as a prerelease branch.
@dillon-giacoppo
maybe you can give me a hint
i tried installing your build but CLion 2020.1 still complains it is missing plugin when reopening my project




@zhuker The above patch is for ijwb (IntelliJ) as a proof of concept for the changes to common/ and to unblock my work. CLion uses clwb. This looks more involved as not even the 2020.1 EAP was added for CLion. You can try to patch it. Ultimately you will need to build:
bazel build //clwb:clwb_bazel_zip --define=ij_product=clion-2020.1
There is a feature request to support Bazel as a first class citizen. for which you can vote by clicking :+1:.
@dillon-giacoppo
ERROR: Analysis of target '//clwb:clwb_bazel_zip' failed; build aborted:
/home/alex.zhukov/git/intellij/third_party/python/BUILD:7:1: Configurable attribute "exports" doesn't match this configuration: define an intellij product version, e.g. --define=ij_product=intellij-latest
INFO: Elapsed time: 12.015s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (41 packages loaded, 317 targets configured)
@dillon-giacoppo Just curious how did you work on this plugin? With Gradle, there is runIde which is very handy to build and install plugin in Intellij. I'm wondering if there is a similar way to do it with Bazel?
@dillon-giacoppo Just curious how did you work on this plugin? With Gradle, there is
runIdewhich is very handy to build and install plugin in Intellij. I'm wondering if there is a similar way to do it with Bazel?
The Bazel plugin has built-in support for developing and running IntelliJ plugins that use Bazel for building.
I guess it's not very well documented, but the plugin looks for targets of type intellij_plugin_debug_target. You can see an example here, and see the actual target definition here.
@jvolkman Great thanks! I ran bazel build for target ijwb_bazel_dev but it doesn't seem like run Intellij at all? Did I miss something?
@dillon-giacoppo I applied your patches. But Clion 2020.1 didn't build successfully.
Some of the logs are
bazel build //clwb:clwb_bazel_zip --define=ij_product=clion-2020.1
$TEST_TMPDIR defined: output root default is '/run/media/tx/1ADC3E81DC3E56EB/.cache' and max_idle_secs default is '15'.
INFO: Analyzed target //clwb:clwb_bazel_zip (1 packages loaded, 305 targets configured).
INFO: Found 1 target...
ERROR: /home/tx/Downloads/intellij/sdkcompat/v201/BUILD:7:1: Compiling Java headers sdkcompat/v201/libv201-hjar.jar (24 source files) failed (Exit 1) java failed: error executing command external/remotejdk11_linux/bin/java -Xverify:none -XX:+UseParallelOldGC -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' ... (remaining 14 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
sdkcompat/v201/com/google/idea/sdkcompat/typescript/TypeScriptConfigServiceCompat.java:22: error: symbol not found com.intellij.lang.typescript.tsconfig.TypeScriptConfigService
import com.intellij.lang.typescript.tsconfig.TypeScriptConfigService;
^
sdkcompat/v201/com/google/idea/sdkcompat/typescript/TypeScriptConfigServiceCompat.java:35: error: could not resolve TypeScriptConfigService
public interface TypeScriptConfigServiceCompat extends TypeScriptConfigService {
^
sdkcompat/v201/com/google/idea/sdkcompat/typescript/TypeScriptConfigServiceCompat.java:36: error: could not resolve TypeScriptConfigService
It would be great if the bazel plugin could work with Intellij 2020.1. There is apparently a bug that prevents debugging a bazel run configuration using LLDB from CLion, and apparently it is possible that CLion 2020.1.2 will address this bug. (Is there currently any combination of (a) version of the Bazel plugin and (b) version of CLion that permits debugging of c++ Bazel projects?)
Is there a time-frame to getting this wokring with 2020 versions of IntelliJ?
I saw a release yesterday, did it include any fixes related to this? @oleg-semenov
https://github.com/bazelbuild/intellij/releases/tag/v2020.06.15
It didn't, according to the compatibility table at https://plugins.jetbrains.com/plugin/8609-bazel/versions
I patched current master branch to work with IDEA 2020.2 EAP if anyone needs it. Compiled binary: http://u.pc.cd/Lrg7
Index: WORKSPACE
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- WORKSPACE (revision 0177f4613f309dced62cd1d08f4cbe3b1728f01a)
+++ WORKSPACE (date 1593971329843)
@@ -37,8 +37,9 @@
http_archive(
name = "intellij_ue_2020_1",
build_file = "@//intellij_platform_sdk:BUILD.ue201",
- sha256 = "ba02e8dc63114062fa4f648e65adf9318f6c0248274bac1ad757aa44eccbd5e4",
- url = "https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/ideaIU/2020.1.2/ideaIU-2020.1.2.zip",
+ sha256 = "9dc1b7637f22ff9fb7fde05bc183aceff2ea2db163d50799688f841c16aa5525",
+ strip_prefix = "idea-IU-202.6250.13",
+ url = "https://download.jetbrains.com/idea/ideaIU-202.6250.13.tar.gz",
)
# The plugin api for CLion 2019.3. This is required to build CLwB,
Index: sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java (revision 0177f4613f309dced62cd1d08f4cbe3b1728f01a)
+++ sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java (date 1593971012512)
@@ -134,7 +134,7 @@
/** #api193: project opening requirements changed in 2020.1. */
public static void openProject(Project project, Path projectFile) {
PlatformProjectOpenProcessor.openExistingProject(
- /* file= */ projectFile, /* projectDir= */ projectFile, new OpenProjectTask(project));
+ /* file= */ projectFile, /* projectDir= */ projectFile, OpenProjectTask.withCreatedProject(project));
}
/** #api193: auto-disposed with UI component in 2020.1+ */
Index: plugin_dev/src/com/google/idea/blaze/plugin/run/BlazeIntellijPluginDeployer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- plugin_dev/src/com/google/idea/blaze/plugin/run/BlazeIntellijPluginDeployer.java (revision 0177f4613f309dced62cd1d08f4cbe3b1728f01a)
+++ plugin_dev/src/com/google/idea/blaze/plugin/run/BlazeIntellijPluginDeployer.java (date 1593970265750)
@@ -36,6 +36,7 @@
import com.intellij.execution.ExecutionException;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManagerCore;
+import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.util.BuildNumber;
import com.intellij.openapi.util.Key;
import java.io.BufferedInputStream;
@@ -210,7 +211,7 @@
@Nullable
private static String readPluginIdFromJar(String buildNumber, File jar)
throws ExecutionException {
- IdeaPluginDescriptor pluginDescriptor = PluginManagerCore.loadDescriptor(jar, "plugin.xml");
+ IdeaPluginDescriptor pluginDescriptor = PluginManager.loadDescriptor(jar.toPath(), PluginManagerCore.PLUGIN_XML);
if (pluginDescriptor == null) {
return null;
}
Index: base/src/com/google/idea/blaze/base/query/MacroLineMarkerProvider.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- base/src/com/google/idea/blaze/base/query/MacroLineMarkerProvider.java (revision 0177f4613f309dced62cd1d08f4cbe3b1728f01a)
+++ base/src/com/google/idea/blaze/base/query/MacroLineMarkerProvider.java (date 1593970079106)
@@ -69,7 +69,7 @@
@Override
@SuppressWarnings("rawtypes")
- public void collectSlowLineMarkers(List<PsiElement> elements, Collection<LineMarkerInfo> result) {
+ public void collectSlowLineMarkers(List<? extends PsiElement> elements, Collection<? super LineMarkerInfo<?>> result) {
if (!enabled.getValue()) {
return;
}
@@ -155,7 +155,7 @@
}
@Nullable
- private static BuildFile getContainingFile(List<PsiElement> elements) {
+ private static BuildFile getContainingFile(List<? extends PsiElement> elements) {
PsiFile file = elements.isEmpty() ? null : elements.get(0).getContainingFile();
return file instanceof BuildFile ? (BuildFile) file : null;
}
Sweet - Although I tried the binary with Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
but its not compatible, is there something I need to do or can you rebuild the plugin marked for compatibility with AS? I'm happy to test this in Studio, would be great to get this merged in!
Another release https://github.com/bazelbuild/intellij/releases/tag/v2020.07.13 wondering if it's going to support new AS/Intellij.
https://plugins.jetbrains.com/plugin/8609-bazel/versions It鈥檚 marked as supported for IntelliJ. I will check this out ! :)
https://plugins.jetbrains.com/plugin/8609-bazel/versions It鈥檚 marked as supported for IntelliJ. I will check this out ! :)
I'm on 2020.1.3 and form a first glance it seems to work.
https://plugins.jetbrains.com/plugin/8609-bazel/versions It鈥檚 marked as supported for IntelliJ. I will check this out ! :)
Looks like AS is not explicitly listed as supported just yet. That said, they don't list the latest version of the plugin on that page
Just tested with a project on mine in Goland and have no issues to report :) 馃殌
Out of curiosity: Why is the plugin compatibilty of the clion flavour still limited to 2019.3.6?
Maybe off the topic. Why no results shown in CLion's plugins search result?
Anyone knows what exactly is missing from this plugin to make Android Studio v4.0 officially supported? I can see if we can contribute the missing functionality
Anyone knows what exactly is missing from this plugin to make Android Studio v4.0 officially supported? I can see if we can contribute the missing functionality
It is already supported: https://plugins.jetbrains.com/plugin/9185-bazel/versions - Android Studio 4.0 is still based on a 193.something. I'm using it just fine as we speak.
I get this error trying to build with this patch (on top of d294f401):
File "/home/vps/.cache/bazel/_bazel_vps/9226f72e17f622828abd6594b7014ba4/sandbox/linux-sandbox/548/execroot/intellij_with_bazel/./bazel-out/host/bin/build_defs/api_version_txt.runfiles/intellij_with_bazel/build_defs/api_version_txt.py", line 63, in main
data = zf.read(application_info_name)
File "/usr/lib64/python3.7/zipfile.py", line 1464, in read
with self.open(name, "r", pwd) as fp:
File "/usr/lib64/python3.7/zipfile.py", line 1503, in open
zinfo = self.getinfo(name)
File "/usr/lib64/python3.7/zipfile.py", line 1431, in getinfo
'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'idea/IdeaApplicationInfo.xml' in the archive"
Just tested with a project on mine in Goland and have no issues to report :) 馃殌
which specific GoLand version works with which specific Bazel plugin?
For me "Bazel" menu disappears with GoLand version 2020.1 and Bazel plugin version 2020.07.13.0.2
By now, the plugin supports running in 2020.1. Please reopen if there's something we missed.
Most helpful comment
There is a feature request to support Bazel as a first class citizen. for which you can vote by clicking :+1:.