Giter Site home page Giter Site logo

bazelbuild / intellij Goto Github PK

View Code? Open in Web Editor NEW
749.0 40.0 292.0 159.88 MB

IntelliJ plugin for Bazel projects

Home Page: https://ij.bazel.build/

License: Apache License 2.0

Python 0.19% Java 96.01% C++ 0.01% C 0.01% Scala 0.01% Shell 0.06% HTML 0.01% Starlark 3.71% Kotlin 0.01% Go 0.01%
bazel intellij intellij-plugin ide build-tool

intellij's Introduction

An IntelliJ plugin for Bazel projects

This project uses binary bundles licensed under JetBrains User Agreement (https://www.jetbrains.com/legal/docs/toolbox/user/).

This is an early-access version of our Bazel plugins for IntelliJ, Android Studio, and CLion.

The Bazel plugin uploaded to the JetBrains Marketplace regularly from the state of this repository. See the releases tab for more information.

Please see our latest community update for Bazel IntelliJ plugin: Announcing Bazel & JetBrains co-maintenance of IntelliJ IDEA Bazel Plugin.

Community

The Bazel project is hosting a Special Interest Group (SIG) for Bazel IntelliJ IDE plug-in. Details about the SIG and how to join the discussion can be found in the SIG charter.

Support

See the documentation entry on the plugin support across JetBrains products, languages, and operating systems.

Installation

You can find our plugin in the JetBrains Marketplace or directly from the IDE by going to Settings -> Plugins -> Marketplace, and searching for Bazel.

Beta versions

Beta versions are usually uploaded to the Beta channel 2 weeks before they become full releases. Ways to install them:

  • download and install them manually from the Beta channel page on JetBrains Marketplace
  • add the Beta channel to the IDE under Settings -> Plugins -> Gear Icon -> Manage Plugin repositories and add one of the following URLs depending on your product. You can now find the latest Beta under Settings -> Plugins -> Marketplace or update the Bazel plugin to Beta if you already installed it.
    • IntelliJ IDEA -> https://plugins.jetbrains.com/plugins/beta/8609
    • CLion -> https://plugins.jetbrains.com/plugins/beta/9554
    • Android Studio -> https://plugins.jetbrains.com/plugins/beta/9185

Usage

To import an existing Bazel project, choose Import Bazel Project, and follow the instructions in the project import wizard.

Detailed docs are available here.

Known issues

Python debugging

Please read this comment #4745 (comment)

Mixed Python & Java projects

In order to get correct python highlighting, please try to open "Project Structure" window and set "Python facet" there

Remote Development

To properly set up Remote Development (https://www.jetbrains.com/remote-development/), follow these steps:

  1. Create an empty project on the remote machine (this can be just an empty directory).
  2. Import the project using Remote Development.
  3. Install the Bazel Plugin on the host machine.
  4. Close the project.
  5. Open the initially intended project.

Building the plugin

Install Bazel, then build the target *:*_bazel_zip for your desired product:

  • bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-ue-oss-latest-stable
  • bazel build //clwb:clwb_bazel_zip --define=ij_product=clion-oss-latest-stable
  • bazel build //aswb:aswb_bazel_zip --define=ij_product=android-studio-oss-latest-stable

from the project root. This will create a plugin zip file at bazel-bin/<PRODUCT>/<PRODUCT>_bazel.zip, which can be installed directly from the IDE. <PRODUCT> can be one of ijwb, clwb, aswb.

If the IDE refuses to load the plugin because of version issues, specify the correct ij_product. These are in the form <IDE>-oss-<VERSION> with

  • <IDE> being one of intellij-ue, intellij, clion, android-studio,
  • <VERSION> being one of oldest-stable, latest-stable, under-dev. Alternatevely, for you can set ij_product to direct IntelliJ or CLion versions, for example clion-2023.2, intellij-2023.2 or intellij-ue-2023.2

Note that there is a difference between intellij and intellij-ue. ue stands for IntelliJ Ultimate Edition and contains additional features for JavaScript as well as Go.

<IDE>-oss-oldest-stable and <IDE>-oss-latest-stable are aliases for the two IDE versions that the plugin is officially compatible with at a given time. <IDE>-oss-latest-stable usually maps to the last released IDE version while <IDE>-oss-oldest-stable maps to the one right before that, e.g. <IDE>-oss-oldest-stable=2022.1 and <IDE>-oss-latest-stable=2022.2. Additionally, <IDE>-oss-under-dev represents the upcoming version of the IDE that we are working towards supporting. A complete mapping of all currently defined versions can be found in intellij_platform_sdk/build_defs.bzl.

You can import the project into IntelliJ (with the Bazel plugin) via importing the ijwb/ijwb.bazelproject file.

Compatibility with IDE Versions

You can build the plugin for different IDE versions by adjusting the ij_product option either from command line or by updating the .bazelproject file to specify the desired value for ij_product under build_flags.

We have three aliases for product versions;

  • oldest-stable is the oldest IDE version supported by the Bazel plugin released to the JetBrains stable channel.
  • latest-stable is the latest IDE version supported by the Bazel plugin released to the JetBrains stable channel.
  • under-dev is the IDE version we are currently working towards supporting.

The current corresponding IDE versions of these aliases can be found here.

Contributions

We welcome contributions to support new IDE versions. However, to make the review process faster and easier, we recommend the following:

  • We can only accept small pull requests. Smaller pull requests tend to have fewer review comments and hence can get submitted much faster. They also tend to conflict less with our internal code base, simplifying the integration for us. For example, you should have separate pull requests each focusing on a certain incompatible change rather than having a large pull request fixing multiple ones.

  • Since we continue to support a number of IDE versions while working on a new one, you need to make sure that your proposed changes do not break older versions. Our presubmit pipeline will take care of testing your changes against all the supported versions and lets you know whether it broke anything.

  • To facilitate merging your changes into upstream, we recommend following our procedure for supporting SDK backward-compatibility.

    • First consider adjusting the plugin code so that it directly works with different IDE versions. Example strategies for this would be:

      • Switching to a (possibly newer) IntelliJ platform API which is available in all relevant IDE versions. Example: pr/2623
      • Switching to a raw class by removing a generic type parameter which differs across versions. Example: pr/2631
    • For non-trivial incompatible changes, the code for maintaining SDK compatibility lives in sdkcompat and testing/testcompat directories, where testing/testcompat holds test-only SDK compatibility changes. Each of the two directories contains a sub-folder per supported IDE version with version-specific implementations. The outside API of all classes must be the same across versions, just the implementation may differ. When introducing a new file in this directory, make sure to duplicate it appropriately across all versions.
      We follow these three techniques for non-trivial incompatible changes.

      • Compat
        Preferred to Adapter and Wrapper when applicable. We add a util-class with only static methods and a private constructor and wrap the changed method by one of the static methods. If the change is small enough, you do not need to create a new util-class and should add the change to BaseSdkCompat class instead. Example: pr/2345

      • Adapter
        Used when we extend a super class and its constructor is updated. We create a new class extending the changed super class then extend this new class from the plugin code. Example: pr/2352

      • Wrapper
        Created when a new interface is used in a super class constructor. We create a wrapper class that wraps and supplies the old or the new interface based on the SDK version and use this wrapper class in the plugin code. Example: pr/2166

  • All compat changes must be commented with #api{API_VERSION}, e.g. #api203. This represents the last API version that requires the code, i.e. the one before the version you aim to support. This is needed to make it easier to find and clean up this functionality when paving old versions.

  • Compat classes must never import plugin code and we try to keep the logic and code in them as minimal as possible.

We may also be able to accept contributions to fix general issues or adding new features with some caveats:

  • Before opening a pull request, first file an issue and discuss potential changes with the devs. This will often save you time you would otherwise have invested in a patch which can't be applied.
  • Improvements for old not supported IDE versions will not be accepted. Your changes should target the currently supported IDE versions. You can find a list of these versions here.
  • We can't accept stylistic, refactoring, or "cleanup" changes.
  • We have very limited bandwidth, and applying patches upstream is a time-consuming process. Large patches generally can't be accepted unless there's clear value for all our users.

intellij's People

Contributors

agluszak avatar alexeygy avatar alice-ks avatar blorente avatar brendandouglas avatar brian-mcnamara avatar chaoren avatar coeuvre avatar cushon avatar dkashyn-sfdc avatar fmeum avatar illicitonion avatar jin avatar keertk avatar larsrc-google avatar lefrosch avatar liucijus avatar mai93 avatar odisseus avatar pavank1992 avatar rakshitasingh05 avatar root-bee avatar satyanandak avatar sgowroji avatar shreem01 avatar stevebarrau avatar tjgq avatar tpasternak avatar ujohnny avatar yasminemaheeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intellij's Issues

Confusing error message when you right-click Run a class with no binary

Consider this repository. https://github.com/dfabulich/right-click-main

It contains a blank WORKSPACE and a single X.java source file with a main method:

public class X {
        public static void main(String[] args) {
                System.out.println("hello");
        }
}

The BUILD file declares only a java_library, not a java_binary.

java_library(
        name='x',
        srcs=['X.java'],
)

The .bazelproject file includes everything.

directories:
  .
targets:
  ...

Open this project in IntelliJ with the Bazel plugin. Now right-click on X in IntelliJ's "Project" Tool Window and click "Run."

Actual: The "Run" menu item is called "Run 'X.main()'" and makes no mention of Bazel. When you run it, IntelliJ creates a non-Bazel "Application" Run Configuration, which fails with this baffling error message:

Cannot start compilation: the output path is not specified for the module ".workspace". Specify the output path in Configure Project.

Expected: Don't allow IntelliJ to even try to run its own built-in compiler. If the user tries to "Run" something that doesn't have an associated java_binary, the Bazel plugin should intercept that and display a message like:

No runnable Bazel target could be found for 'X.java'. Please define a java_binary target in the BUILD file.

Problem with "New Bazel Package"

When trying to create a New Bazel Package the folder is created alongside an empty BUILD file but no rule is added and the following error is shown in the event log.

No BUILD file found at location: src/main/java/com/example/zzz2
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:127)
    at com.google.idea.blaze.base.lang.buildfile.actions.BuildFileModifierImpl.addRule(BuildFileModifierImpl.java:47)
    at com.google.idea.blaze.base.ide.NewBlazePackageAction.createPackageOnDisk(NewBlazePackageAction.java:154)
    at com.google.idea.blaze.base.ide.NewBlazePackageAction.access$200(NewBlazePackageAction.java:64)
    at com.google.idea.blaze.base.ide.NewBlazePackageAction$1.execute(NewBlazePackageAction.java:105)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:72)
    at com.google.idea.blaze.base.scope.Scope.root(Scope.java:61)
    at com.google.idea.blaze.base.ide.NewBlazePackageAction.actionPerformed(NewBlazePackageAction.java:77)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:191)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:311)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:958)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:281)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:109)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:513)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.g(IdeEventQueue.java:857)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Import project view should have the BUILD file first and default

I started out with the plugin by trying to import bazel (had problems which I might open a different ticket for) and during the course of that I somehow chose "from scratch" in the import. I don't remember if the plugin defaulted to it or I chose it but I think that even if I chose it then it's related to the order of options.
I want to suggest making the import from BUILD file the first option and be it checked by default since it sounds to me like that is the main use-case of importing. I'd also move the from scratch option to the bottom of the list since that sounds the most advanced.

Additionally the plugin remembers what you chose last and will default to that, maybe it shouldn't and should default to BUILD file anytime so that even if you make a mistake one time you aren't pushed to it over and over

Scala support

We're in the early stages of adopting Bazel and Scala support in the IDE is a must for us.
It's not a blocker now since we have bigger blockers but it's something we will have to have.
I'm very much willing to take on the development if that will be the missing piece.

plugin not shown in settings.

I can only find the BUILD formatter.

I have no repostories configured, so I assume I get the default JetBrains one.

i'm running 2016.1.3, build 145.1617

Bazel plugin throws NPE when Java files appear in the WORKSPACE root

Consider this sample project https://github.com/dfabulich/bazel-intellij-sync-failed

It has a blank WORKSPACE and a BUILD file containing just one target, //:x.

java_binary(
	name='x',
	srcs=['X.java'],
	main_class='X',
)

X.java is directly in the root directory; it's hello world.

public class X {
	public static void main(String[] args) throws Exception {
		System.out.println("hello");
	}
}

When I attempt to build and sync this project, the plugin throws a NullPointerException in SourceDirectoryCalculator.

stacktrace
java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:476)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:435)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.calculateJavaSourceDirectories(SourceDirectoryCalculator.java:247)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.calculateSourceDirectoriesForContentRoot(SourceDirectoryCalculator.java:211)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.lambda$calculateContentEntries$2(SourceDirectoryCalculator.java:124)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.calculateContentEntries(SourceDirectoryCalculator.java:117)
	at com.google.idea.blaze.java.sync.importer.BlazeJavaWorkspaceImporter.importWorkspace(BlazeJavaWorkspaceImporter.java:112)
	at com.google.idea.blaze.java.sync.BlazeJavaSyncPlugin.lambda$updateSyncState$0(BlazeJavaSyncPlugin.java:157)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:36)
	at com.google.idea.blaze.java.sync.BlazeJavaSyncPlugin.updateSyncState(BlazeJavaSyncPlugin.java:153)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$doSyncProject$2(BlazeSyncTask.java:349)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:344)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:178)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:157)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.base.scope.Scope.root(Scope.java:48)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:135)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$2.run(BlazeExecutor.java:99)
	at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:179)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:568)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:519)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:164)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:108)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:105)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at com.google.idea.blaze.base.model.primitives.WorkspacePath.validate(WorkspacePath.java:70)
	at com.google.idea.blaze.base.model.primitives.WorkspacePath.validate(WorkspacePath.java:65)
	at com.google.idea.blaze.base.model.primitives.WorkspacePath.<init>(WorkspacePath.java:54)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.sourceRootForJavaSource(SourceDirectoryCalculator.java:468)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.lambda$calculateJavaSourceDirectories$5(SourceDirectoryCalculator.java:242)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:310)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
	at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:61)
	at com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator.calculateJavaSourceDirectories(SourceDirectoryCalculator.java:240)
	... 30 more

Moving X.java into a subdirectory fixes the problem.

clion Sync failed

I follow these step to install bazel in clion:

To use CLion with Bazel, we require an experimental plugin that the Bazel team supplies in source form only.
1. Download and install CLion 2016.2.3 from the CLion previous releases. No other version of CLion is compatible with the Bazel plugin.
2. Adjust your JVM options to increase CLion’s memory limits so that -Xms is 1024m and -Xmx is 8196m. The JVM options file location is platform-dependent:
    1. Linux: bin/clion64.vmoptions, in the CLion tarball.
    2. OS X: Contents/bin/clion.vmoptions, in the CLion app package.
3. Clone the bazelbuild/intellij project from GitHub, and build the CLion plugin with bazel build --define=ij_product=clion-latest //clwb:clwb_bazel.
4. Launch CLion, and install the Bazel plugin from disk. Open File > Settings. Select Plugins, then Install plugin fromdisk.... In the file browser, select bazel-genfiles/clwb/clwb_bazel.jar. Click “OK”.

Sync failed
screenshot

why bazel run these command line:

 /Users/liyanan/dev/clion/BUILD info --tool_tag=ijwb:CLion --

clion plugin - unable to specify GDB

I am unable to setup a debugger with the clion plugin. I get an error in the console: Error running Bazel run my_project:example: GDB executable not specified

I have tried to use --run_under, as well as setup gdb remote debugger, with no luck.
Perhaps I just need better docs?

Are there release notes?

Hi,
I just got a notification in intellij that I can update the plugin but I can't find any release notes to explain what this upgrade offers. I tried looking in the intellij popup, the intellij plugin repository and here.
If there aren't any I strongly recommend adding it for every release.

ASwB import: "Project view validation failed, but we couldn't find an error message."

Attempting to import a project gives me the following request:
"Project view validation failed, but we couldn't find an error message. Please report a bug."

I can find the following exception in the terminal Android Studio was started in:

[  45762]  ERROR - plication.impl.ApplicationImpl - Expected static method com.android.tools.idea.sdk.IdeSdks.getAndroidSdkPath()Ljava/io/File; 
java.lang.IncompatibleClassChangeError: Expected static method com.android.tools.idea.sdk.IdeSdks.getAndroidSdkPath()Ljava/io/File;
        at com.google.idea.blaze.android.compatibility.Compatibility$IdeSdks.getAndroidSdkPath(Compatibility.java:69)
        at com.google.idea.blaze.android.sync.BlazeAndroidSyncPlugin.installSdks(BlazeAndroidSyncPlugin.java:113)
        at com.google.idea.blaze.base.wizard2.ui.BlazeEditProjectViewControl$ProjectViewValidator.validateProjectView(BlazeEditProjectViewControl.java:381)
        at com.google.idea.blaze.base.scope.Scope.push(Scope.java:36)
        at com.google.idea.blaze.base.scope.Scope.root(Scope.java:28)
        at com.google.idea.blaze.base.wizard2.ui.BlazeEditProjectViewControl$ProjectViewValidator.run(BlazeEditProjectViewControl.java:367)
        at com.intellij.openapi.progress.impl.CoreProgressManager$6.run(CoreProgressManager.java:256)
        at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:635)
        at com.intellij.openapi.progress.impl.CoreProgressManager$9.run(CoreProgressManager.java:384)
        at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
        at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
        at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
        at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
        at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$9(ApplicationImpl.java:548)
        at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[  45771]  ERROR - plication.impl.ApplicationImpl - Android Studio 2.3 Beta 2  Build #AI-162.3616766 
[  45772]  ERROR - plication.impl.ApplicationImpl - JDK: 1.8.0_112-release 
[  45772]  ERROR - plication.impl.ApplicationImpl - VM: OpenJDK 64-Bit Server VM 
[  45772]  ERROR - plication.impl.ApplicationImpl - Vendor: JetBrains s.r.o 
[  45772]  ERROR - plication.impl.ApplicationImpl - OS: Linux 
[  45772]  ERROR - plication.impl.ApplicationImpl - Last Action: EditorBackSpace 

This is on Android Studio 2.3b2 (162.3616766), after updating the plugin to version 2017.01.09.1.

Preceding problems:

  • Latest stable Android Studio 2.2 + an earlier Bazel plugin (not sure which, but not a date-based version number) was working fine.
  • After plugin update to 2017.01.09.1, external dependencies in the workspace stopped resolving in Android Studio. (E.g. all Guava class imports complained about "com.google" package not existing.)
  • After updating Android Studio to 2.3b2, Android resource references ("R.id.foo") stopped resolving as well.
  • Attempting to re-import the project is giving the above error.

I will try to prune down my project to a standalone test case and put it up as a Gist or something. Filing this early in case that makes things start working again, since the error message explicitly requested a bug.

FWIW, dumping my Android Studio plugins/android/lib/android.jar:com/android/tools/idea/sdk/IdeSdks.class indeed shows it has no static getAndroidSdkPath() method -- looks like it's getInstance().getAndroidSdkPath() now. I can see that the plugin's aswb/2.3/src/com/google/idea/blaze/android/compatibility/Compatibility.java file has what looks like correct code for AS 2.3, while that in aswb/2.2/ contains a call to the static version. (So maybe it's using the wrong one?)

3rdparty is an invalid package name

Our 3rdparty libraries are located under //3rparty/java/com/... and //3rdparty/:* (for external jars) rather than Bazel's standard third_party. The Intellij plugin doesn't seem to be happy with that and spits out an error from

I'm curious why the plugin considers it an invalid package path? The 3rdparty isn't actually part of the java package name.

Run configurations not auto generated

Consider this repository. https://github.com/dfabulich/intellij-auto-run-config

It has a blank WORKSPACE and a very simple BUILD file.

java_binary(
  name='x',
  srcs=['x/src/main/java/X.java'],
  main_class='X',
)

X.java just prints hello world.

public class X {
  public static void main(String[] args) {
    System.out.println("hello world");
  }
}

If you bazel run x it prints "hello world."

There's a checked-in .bazelproject file that explicitly names x as a target:

directories:
  .

targets:
  x

Now use the IntelliJ plugin to import the project.

Expected: https://ij.bazel.io/docs/run-configurations.html says:

The IDE automatically creates run configurations for supported targets explicitly listed in your project view

So there should be an x run configuration autogenerated.

Actual: No run configurations were autogenerated

I'm on Ubuntu 16.04.1 64-bit, IntelliJ IDEA CE 2016.3.

external dependencies broken on mac OSX

I used the plugin with the closest version of IntelliJ I could find (see my pull request) and I tried to load the bazel view provided in /ijwb. While the bazel UI seems to work, all the external dependencies such as google commons are shown as missing:

screen shot 2016-08-31 at 5 11 08 pm

It seems so obviously broken that I am wondering if something could be wrong on mac. Do you have some suggestion on where to look in the code?

Setup:
OSX 10.11 (El Cap)
bazel 0.3.1
intellij idea: 2016.1.4 and 2016.2.3 (latest)
I tried with both the official and locally build version of the plugin

Fail to import projects

When trying to import ijwb/.bazelproject or a simple project + creating .bazelproject from scratch (1 source file + 1 "java_library" target), in intellij idea ultimate 2016.2.3 and plugin version 1.8.3,
I get the error "Error:Could not get Bazel roots". Here's the stacktrace. What should I check? Running bazel info from the CLI works flawlessly

    com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: 37 and error stream: .
    Server finished RPC without an explicit exit code
    java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: 37 and error stream: Server finished RPC without an explicit exit code
        at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
        at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
        at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:89)
        at com.google.idea.blaze.base.scope.Scope.push(Scope.java:44)
        at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:81)
        at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:206)
        at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:157)
        at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:144)
        at com.google.idea.blaze.base.scope.Scope.push(Scope.java:72)
        at com.google.idea.blaze.base.scope.Scope.root(Scope.java:61)
        at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:117)
        at com.google.idea.blaze.base.async.executor.BlazeExecutor$2.run(BlazeExecutor.java:109)
        at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
        at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:494)
        at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
        at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
        at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:115)
        at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:112)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: 37 and error stream: .
    Server finished RPC without an explicit exit code
        at com.google.idea.blaze.base.command.info.BlazeInfoImpl.runBlazeInfo(BlazeInfoImpl.java:85)
        at com.google.idea.blaze.base.command.info.BlazeInfoImpl.lambda$runBlazeInfo$2(BlazeInfoImpl.java:60)
        ... 4 more

Support “regular” import

Support importing via “regular” import and choosing a folder and have intellij show you bazel as an option. Currently you have blaze as an option and once that is chosen a runtime exception is thrown saying: Build system 'Blaze' not supported by this plugin

Auto sync (auto import in intellij slang)

Allow setting auto-sync when importing a project.
This is very helpful in maven, exists in pants and I think that given your support of BUILD files editing will be helpful here

Discover test targets when right-clicking on a folder

This relates to #4 but I think is somewhat different. If it duplicates please feel free to close.
The use-case is right clicking on a test folder and getting the option from the "run" sub menu to choose to run all targets in this package (sub packages also?) and a specific target from the list of targets the plugin identifies that exist in this package.

What is the state of skylark support?

I've tried importing a small scala project (built with skylark of course) and it seems it's not supported. The source code appears greyed out and labeled (unsynced).
Interested in learning what's the state of skylark support and what are the thoughts?
This is an area I'm very interested in and if applicable I'd be happy to contribute in a few weeks time once I make some progress on other parts of our bazel setup.
project I tried to import for reference.

Support for external dependencies in CLion

I know CLion plugin is not yet officially released but I was wondering whether there are any plans to support //external dependencies. For instance, it appears that the current version of the plugin cannot locate the source files for modules imported into the workspace via Bazel's new_http_archive or new_git_repo.

Support IntelliJ 2016.3

As soon as I imported my first Bazel project, I got an "IDE Fatal Errors" popup with this exception:

Write access is allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality state (not "any"). See TransactionGuard documentation for details.
  current modality=ModalityState.NON_MODAL
  known modalities={ModalityState.NON_MODAL=true, ModalityState:Loading Project 2012642121: running=false; canceled=false=true, ModalityState:com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog[dialog0,475,229,1024x728,invalid,hidden,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Import Project from Bazel,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=,rootPaneCheckingEnabled=true]=true}
java.lang.Throwable
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
	at com.intellij.openapi.application.TransactionGuardImpl.assertWriteActionAllowed(TransactionGuardImpl.java:246)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:296)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:288)
	at com.google.idea.blaze.base.util.SaveUtil$1.run(SaveUtil.java:28)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:843)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:679)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I'm on Ubuntu 16.04.1 64-bit, IntelliJ IDEA CE 2016.3.

Not clear if plugin also works for Android Studio

I know Android Studio is based on IntelliJ, but it is not clear if this plugin will help me build my Android applications and is designed to work in Android Studio.

The landing page and README should clarify this.

Error when importing Copybara into intellij

Hi,
Trying to import copybara into intellij and getting an error in the second screen of the wizard. Tried to specify both a workspace and a BUILD file and no luck.

IntelliJ IDEA 2016.2.5
Build #IU-162.2228.15, built on October 14, 2016
JRE: 1.8.0_112-release-287-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Plugin version 1.10.2

Invalid workspace path: /Users/ittaiz/workspace/copybara/WORKSPACE
java.lang.IllegalArgumentException: Invalid workspace path: /Users/ittaiz/workspace/copybara/WORKSPACE
    at com.google.idea.blaze.base.model.primitives.WorkspacePath.<init>(WorkspacePath.java:55)
    at com.google.idea.blaze.base.wizard2.ImportFromWorkspaceProjectViewOption.getSharedProjectView(ImportFromWorkspaceProjectViewOption.java:98)
    at com.google.idea.blaze.base.wizard2.ImportFromWorkspaceProjectViewOption.validate(ImportFromWorkspaceProjectViewOption.java:87)
    at com.google.idea.blaze.base.wizard2.ui.BlazeSelectOptionControl.validate(BlazeSelectOptionControl.java:134)
    at com.google.idea.blaze.base.wizard2.ui.BlazeSelectProjectViewControl.validate(BlazeSelectProjectViewControl.java:58)
    at com.google.idea.blaze.java.wizard2.BlazeSelectProjectViewImportWizardStep.validate(BlazeSelectProjectViewImportWizardStep.java:62)
    at com.intellij.ide.util.newProjectWizard.AbstractProjectWizard.commitStepData(AbstractProjectWizard.java:231)
    at com.intellij.ide.util.newProjectWizard.AbstractProjectWizard.doNextAction(AbstractProjectWizard.java:250)
    at com.intellij.ide.wizard.AbstractWizard$5.actionPerformed(AbstractWizard.java:198)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:795)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
    at java.awt.Dialog.show(Dialog.java:1084)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:778)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:455)
    at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1665)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1607)
    at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1622)
    at com.google.idea.blaze.java.wizard2.BlazeImportProjectAction.actionPerformed(BlazeImportProjectAction.java:29)
    at com.intellij.ui.components.labels.ActionLink$1.linkSelected(ActionLink.java:66)
    at com.intellij.ui.components.labels.LinkLabel.doClick(LinkLabel.java:145)
    at com.intellij.ui.components.labels.ActionLink.doClick(ActionLink.java:79)
    at com.intellij.ui.components.labels.LinkLabel$MyMouseHandler.mouseReleased(LinkLabel.java:328)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:795)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


java.lang.IllegalArgumentException: Invalid workspace path: /Users/ittaiz/workspace/copybara/WORKSPACE
    at com.google.idea.blaze.base.model.primitives.WorkspacePath.<init>(WorkspacePath.java:55)
    at com.google.idea.blaze.base.wizard2.ImportFromWorkspaceProjectViewOption.getSharedProjectView(ImportFromWorkspaceProjectViewOption.java:98)
    at com.google.idea.blaze.base.wizard2.ImportFromWorkspaceProjectViewOption.validate(ImportFromWorkspaceProjectViewOption.java:87)
    at com.google.idea.blaze.base.wizard2.ui.BlazeSelectOptionControl.validate(BlazeSelectOptionControl.java:134)
    at com.google.idea.blaze.base.wizard2.ui.BlazeSelectProjectViewControl.validate(BlazeSelectProjectViewControl.java:58)
    at com.google.idea.blaze.java.wizard2.BlazeSelectProjectViewImportWizardStep.validate(BlazeSelectProjectViewImportWizardStep.java:62)
    at com.intellij.ide.util.newProjectWizard.AbstractProjectWizard.commitStepData(AbstractProjectWizard.java:231)
    at com.intellij.ide.util.newProjectWizard.AbstractProjectWizard.doNextAction(AbstractProjectWizard.java:250)
    at com.intellij.ide.wizard.AbstractWizard$5.actionPerformed(AbstractWizard.java:198)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:795)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
    at java.awt.Dialog.show(Dialog.java:1084)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:778)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:455)
    at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1665)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1607)
    at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1622)
    at com.google.idea.blaze.java.wizard2.BlazeImportProjectAction.actionPerformed(BlazeImportProjectAction.java:29)
    at com.intellij.ui.components.labels.ActionLink$1.linkSelected(ActionLink.java:66)
    at com.intellij.ui.components.labels.LinkLabel.doClick(LinkLabel.java:145)
    at com.intellij.ui.components.labels.ActionLink.doClick(ActionLink.java:79)
    at com.intellij.ui.components.labels.LinkLabel$MyMouseHandler.mouseReleased(LinkLabel.java:328)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:795)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


Automatically identify targets on import

Currently when importing a project the plugin suggests //...:all or manually specifying the targets. Pants intellij plugin automatically identifies the targets and enables you to checkbox which of the existing targets you want to be added to your project view.

import_file2

I think this can be a great feature (just give a bit more real-estate for selecting the targets 😉)

Blaze references within the bazel plugin

While using the:
Intellij with Bazel plugin v 1.10.2
image

I noticed that there were some small references to Blaze within the configuration settings in Intellij. I know this isn't a pressing issue but I would just like to point it out.
image

Java: download sources for external dependencies

Let's say I have used maven_jar() in my WORKSPACE to make apache httpclient available to declare as a dependency, and that I am able to build my project without any problems with code using this external dependency.

When I in IntelliJ try to Go to → Implementation on a class from the dependency and click on "Download" in the bar at the top of the opened class file, I get an error Sources not found: Sources for 'httpclient-4.5.2-ijar.jar' not found.

I suspect this is due to the ijar trick bazel is doing?https://github.com/bazelbuild/bazel/tree/master/third_party/ijar

The functionality to easy download sources for external dependencies is a great feature, and I miss it very much.

Should this be working? Am I missing something?

Bazel version: 0.4.3

Cannot resolve some symbols

I've tried to create a project for Bazel itself and got the plug-in to sync successfully. However, some symbols coming from JARs in third_party, e.g. com.google.common.eventbus.EventBus cannot be resolved, so I get an error for example in j/c/g/devtools/build/lib/actions/Executor.java looking like this:

    EventBus getEventBus();
    Cannot resolve symbol 'EventBus'

Bazel -> Make Project works and Bazel -> Sync Project also works, it's just the IDE that can't find the things.

My project view looks like this:

directories:
  src
  third_party
  tools

targets:
  //src/...:all

test_sources:
  src/test/*
  src/tools/generate_workspace/src/test/*
  third_party/ijar/test/*

Any idea? Am I doing something wrong here?

"This function should be called while holding treeLock" (MAC OS)

While testing the IntelliJ plugin today, I got this error on first sync of a new project. I can't seem to reproduce it reliably, but the stacktrace looks useful.

This function should be called while holding treeLock
java.lang.IllegalStateException: This function should be called while holding treeLock
	at java.awt.Component.checkTreeLock(Component.java:1201)
	at java.awt.Container.validateTree(Container.java:1689)
	at com.intellij.openapi.actionSystem.impl.ActionMenu.access$900(ActionMenu.java:51)
	at com.intellij.openapi.actionSystem.impl.ActionMenu$MenuItemSynchronizer.propertyChange(ActionMenu.java:334)
	at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:303)
	at com.intellij.openapi.actionSystem.Presentation.firePropertyChange(Presentation.java:297)
	at com.intellij.openapi.actionSystem.Presentation.setVisible(Presentation.java:265)
	at com.intellij.openapi.actionSystem.Presentation.setEnabledAndVisible(Presentation.java:292)
	at com.google.idea.blaze.base.actions.BlazeMenuGroup.update(BlazeMenuGroup.java:29)
	at com.intellij.openapi.wm.impl.IdeMenuBar.expandActionGroup(IdeMenuBar.java:428)
	at com.intellij.openapi.wm.impl.IdeMenuBar.updateMenuActions(IdeMenuBar.java:338)
	at com.intellij.openapi.wm.impl.IdeMenuBar$MyTimerListener.run(IdeMenuBar.java:488)
	at com.intellij.openapi.actionSystem.impl.WeakTimerListener.run(WeakTimerListener.java:54)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.runListenerAction(ActionManagerImpl.java:1414)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.notifyListeners(ActionManagerImpl.java:1404)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.actionPerformed(ActionManagerImpl.java:1394)
	at javax.swing.Timer.fireActionPerformed(Timer.java:313)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:843)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:679)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

support Golang

Is there any interest in support Golang with the IntelliJ plugin? It would be nice to open a Bazel project with Gogland and have everything work.

Allow importing a project using multiple BUILD files

Given a large codebase I might want to import only a subset of it into intellij. That is currently supported with the ability to import from a BUILD file IIUC.
I want to suggest allowing to import using multiple BUILD files.
The use-case is working on a change in a core-library and on one leaf service to get feedback on how the API looks or on an edge case in it. I can choose both BUILD files and load the targets from them.

blaze plugin implicated in IDE crash.

on starting up:

Internal error. Please report to http://jb.gg/ide/critical-startup-errors

java.lang.RuntimeException: java.lang.RuntimeException: Duplicate registration for EP: com.google.idea.blaze.base.lang.buildfile.DumbAnnotator
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:200)
at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:47)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:358)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: Duplicate registration for EP: com.google.idea.blaze.base.lang.buildfile.DumbAnnotator
at com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoint(ExtensionsAreaImpl.java:282)
at com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoint(ExtensionsAreaImpl.java:128)
at com.intellij.ide.plugins.IdeaPluginDescriptorImpl.registerExtensionPoints(IdeaPluginDescriptorImpl.java:330)
at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointsAndExtensions(PluginManagerCore.java:1309)
at com.intellij.ide.plugins.PluginManagerCore.initializePlugins(PluginManagerCore.java:1221)
at com.intellij.ide.plugins.PluginManagerCore.initPlugins(PluginManagerCore.java:1350)
at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:115)
at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:109)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponentConfigs(ComponentManagerImpl.java:328)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:94)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:392)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:384)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:193)
... 16 more

[ 20124] ERROR - #com.intellij.util.Alarm - IntelliJ IDEA 2016.2.4 Build #IC-162.2032.8
[ 20124] ERROR - #com.intellij.util.Alarm - JDK: 1.8.0_112-google-v7
[ 20124] ERROR - #com.intellij.util.Alarm - VM: OpenJDK 64-Bit Server VM
[ 20125] ERROR - #com.intellij.util.Alarm - Vendor: Google Inc.
[ 20125] ERROR - #com.intellij.util.Alarm - OS: Linux

$ bazel version
..........
Build label: 0.4.0
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Nov 2 17:54:14 2016 (1478109254)
Build timestamp: 1478109254
Build timestamp as int: 1478109254

sha1sum ~/.IdeaIC2016.2/config/plugins/ijwb_bazel.jar
fbb7a66b56680bb52e6b48f7d39571d5a02136e4 /home/hanwen/.IdeaIC2016.2/config/plugins/ijwb_bazel.jar

Enhance "Test Runner Tab" view

Hi,
Just tried the new "Test Runner Tab" and it's a huge improvement so thank you!
There are two issues which I think are still substantially off with respect to the current view:

  1. Console log of tests- When one goes into a specific test class you can't see any of the console log. You can see the exception message if the test failed but that's it. The entire log is on the root.
  2. Incrementally add test names as they pass/fail- Not sure if this is related to the streaming part of the experimental UI in Bazle but maybe.

Bazel plugin throws in CLion on OS X

On OS X only, after building the plugin from 4894694, and importing RobotLocomotion/drake into CLion 2016.2.3 as documented here, I get the following exception from inside the plugin.

If more details would be useful, please let me know!

Write access is allowed from event dispatch thread only
 EventQueue.isDispatchThread()=false isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@40c8bff8 Current thread: Thread[pool-2-thread-1,5,main] 397385620 SystemEventQueueThread: Thread[AWT-EventQueue-0 2016.2.3#CL-162.2228.26 CLion, eap:false, os:Mac OS X 10.11.6, java-version:JetBrains s.r.o 1.8.0_112-release-287-b2,6,main] 1567327220

java.lang.Throwable
	at com.intellij.psi.impl.DebugUtil.currentStackTrace(DebugUtil.java:501)
	at com.intellij.diagnostic.LogEventException.<init>(LogEventException.java:29)
	at com.intellij.openapi.application.impl.ApplicationImpl.b(ApplicationImpl.java:981)
	at com.intellij.openapi.application.impl.ApplicationImpl.d(ApplicationImpl.java:1068)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:896)
	at com.google.idea.blaze.cpp.BlazeCWorkspace.refreshExecRoot(BlazeCWorkspace.java:107)
	at com.google.idea.blaze.cpp.BlazeCWorkspace.update(BlazeCWorkspace.java:75)
	at com.google.idea.blaze.cpp.BlazeCSyncPlugin.lambda$updateInMemoryState$0(BlazeCSyncPlugin.java:63)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.cpp.BlazeCSyncPlugin.updateInMemoryState(BlazeCSyncPlugin.java:55)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$null$12(BlazeSyncTask.java:771)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$updateInMemoryState$13(BlazeSyncTask.java:764)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.updateInMemoryState(BlazeSyncTask.java:758)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:190)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:160)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:56)
	at com.google.idea.blaze.base.scope.Scope.root(Scope.java:48)
	at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:138)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$2.run(BlazeExecutor.java:99)
	at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:494)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:108)
	at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:105)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Present Bazel test results in 'Test Runner Tab' style

Hi,
First and foremost I want to say thank you and kudos for your work on the plugin and OSSing it.
I think it's an important piece in the Bazel eco-system.
I wanted to know what you think about extending the plugin so that it will integrate into the Test Runner Tab.
That is one of the substantial changes one experiences when switching from a "regular" maven intellij project to its bazel equivalent.

Additionally I have some other thoughts on improvements but I don't want to pile on if you're not ready yet so if you'd rather I wait, before opening a few additional issues, so that you can get your ducks in a row that's totally fine.

Again, thank you!

Support HotSwap / Reloading Classes

IntelliJ supports "hotswapping" (reloading) classes while debugging a process. https://www.jetbrains.com/help/idea/2016.3/reloading-classes.html

For example, open this sample project https://github.com/dfabulich/bazel-intellij-hotswap

Import it as a Bazel project, open X.java, and set a breakpoint on line 14.

System.out.println("hello");

Run //:x in Debug mode so you hit the breakpoint. Now replace the word "hello" with the word "goodbye"

Expected: Build and hotswap the class
Actual: Nothing happens at first, because you have to Make the project by hand. But, of course, you can't, because of issue #34. "Another command (pid=####) is running. Waiting for it to complete..."

Network shouldn't be accessed in EDT or inside read action

Here's an exception I got when using the IntelliJ plugin with 2016.3 EAP.

Assertion failed: Network shouldn't be accessed in EDT or inside read action
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:168)
    at com.intellij.util.io.HttpRequests.process(HttpRequests.java:372)
    at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:56)
    at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:246)
    at com.intellij.util.io.RequestBuilder.readString(RequestBuilder.java:74)
    at com.google.idea.blaze.base.experiments.WebExperimentSyncer$WebExperimentsDownloader.call(WebExperimentSyncer.java:130)
    at com.google.idea.blaze.base.experiments.WebExperimentSyncer$WebExperimentsDownloader.call(WebExperimentSyncer.java:123)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:310)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:61)
    at com.google.idea.blaze.base.experiments.WebExperimentSyncer.initialize(WebExperimentSyncer.java:99)
    at com.google.idea.blaze.base.experiments.WebExperimentSyncer.getExperimentValues(WebExperimentSyncer.java:83)
    at com.google.idea.blaze.base.experiments.WebExperimentLoader.getExperiments(WebExperimentLoader.java:26)
    at com.google.idea.blaze.base.experiments.ExperimentServiceImpl.reloadExperiments(ExperimentServiceImpl.java:69)
    at com.google.idea.blaze.base.experiments.ExperimentServiceImpl.getExperiment(ExperimentServiceImpl.java:110)
    at com.google.idea.blaze.base.experiments.ExperimentServiceImpl.getExperiment(ExperimentServiceImpl.java:87)
    at com.google.idea.blaze.base.experiments.BoolExperiment.getValue(BoolExperiment.java:32)
    at com.google.idea.blaze.base.lang.buildfile.parser.BuildParserDefinition$BuildParser.parse(BuildParserDefinition.java:108)
    at com.intellij.psi.tree.ILazyParseableElementType.doParseContents(ILazyParseableElementType.java:88)
    at com.intellij.psi.tree.IFileElementType.parseContents(IFileElementType.java:49)
    at com.intellij.psi.impl.source.tree.LazyParseableElement.ensureParsed(LazyParseableElement.java:192)
    at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:240)
    at com.intellij.psi.impl.source.tree.CompositeElement.findLeafElementAt(CompositeElement.java:169)
    at com.intellij.psi.impl.source.text.BlockSupportImpl.findReparseableRoots(BlockSupportImpl.java:114)
    at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockSupportImpl.java:89)
    at com.intellij.psi.impl.DocumentCommitThread.doCommit(DocumentCommitThread.java:802)
    at com.intellij.psi.impl.DocumentCommitThread$6.run(DocumentCommitThread.java:569)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1040)
    at com.intellij.psi.impl.DocumentCommitThread.commitUnderProgress(DocumentCommitThread.java:597)
    at com.intellij.psi.impl.DocumentCommitThread.access$300(DocumentCommitThread.java:77)
    at com.intellij.psi.impl.DocumentCommitThread$2.run(DocumentCommitThread.java:398)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:568)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:519)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.psi.impl.DocumentCommitThread.pollQueue(DocumentCommitThread.java:395)
    at com.intellij.psi.impl.DocumentCommitThread.run(DocumentCommitThread.java:346)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:210)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

clion support

I'm sure CLion support is ongoing (I see code in the repo). Just wanted to make this ticket to track when it might show up.

Wrong java root src dir in IDEA

Hi
I tried different configurations, IDEA shows instead of java dir the directory right beneath it i.e. the domain name, thus wrong package naming etc.

like: main -> java -> org
should be: main -> java -> org

My setup:

idea 163.12024
plugin 02.13.01

andy@laptop:~/repo/someapp$ bazel version
Build label: 0.4.4
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Feb 1 18:54:21 2017 (1485975261)
Build timestamp: 1485975261
Build timestamp as int: 1485975261

Go (Gogland) support

We're currently moving our monorepo to Bazel, and the last dangling bit is:
https://github.com/bazelbuild/rules_go
We really enjoy Gogland and would love to have it nicely integrated with Bazel.

Is the custom skylark rule support in? If so, how would it work with the current Go plugin? @ignatov and @zolotov for context, as they're the main Golang Plugin developer.

Cannot build //clwb:clwb_bazel

Yesterday, I was able to build //clwb:clwb_bazel from the HEAD of master. Today, even though there have been no new commits, I get the following:

$ git clone [email protected]:bazelbuild/intellij.git
$ cd intellij/
$ bazel build //clwb:clwb_bazel
.........
ERROR: /home/dgerman/bazel_intellij/intellij/intellij_platform_sdk/BUILD:128:1: no such package 'intellij_platform_sdk/IC_162_2032_8': BUILD file not found on package path and referenced by '//intellij_platform_sdk:plugin_api_for_grammar_kit'.
ERROR: Analysis of target '//intellij_platform_sdk:plugin_api_for_grammar_kit' failed; build aborted.
INFO: Elapsed time: 1.568s
dgerman@dgerman-HP-Z640-Workstation:~/bazel_intellij/intellij$ bazel build //clwb:clwb_bazel
INFO: Found 1 target...
INFO: From Building common/formatter/libformatter.jar (2 source files):
Note: common/formatter/src/com/google/idea/common/formatter/DelegatingCodeStyleManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
INFO: From Building base/libbase.jar (464 source files, 13 resources):
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
ERROR: /home/dgerman/bazel_intellij/intellij/cpp/BUILD:5:1: Java compilation in rule '//cpp:cpp' failed: Worker process sent response with exit code: 1.
cpp/src/com/google/idea/blaze/cpp/BlazeCSyncPlugin.java:31: error: package com.jetbrains.cidr.lang.workspace does not exist
import com.jetbrains.cidr.lang.workspace.OCWorkspace;

Followed by 100 more errors about packages that don't exist. Speculation: Maybe the contents of a new_http_archive URL in the WORKSPACE file changed? They do not appear to be SHA-checked as recommended here.

HEAD (1.9.4) causes non-bazel java projects to go "(unsynced)"

I loaded up github.com/google/closure-templates with Intellij with Bazel built from master and all of the java code says is marked as "(unsynced)" and the tabs show up red.

That closure-templates has no bazel BUILD files in it, so IJWB should probably not even matter. But we did the debugging work in https://intellij-support.jetbrains.com/hc/en-us/requests/787044?page=1 and only disabling ijwb fixed the problem.

Think ijwb got a little greedy with what java files it thinks it should own.

Also, unclear what "(unsynced)" means in this context!

"Attach Blaze Source Jars" links sources with wrong path

Our project uses Maven artifacts via Bazel to reference other libraries. The jar-files of those libraries are downloaded to a subdirectory of the Bazel cache directory. The same holds for the source files.

When I navigate to a class of such a library, "Attach Blaze Source Jars" shows up. After triggering it, it simply vanishes and the standard IntelliJ Options "Download..." and "Choose Sources..." are displayed. The source code isn't displayed, though.
After these steps, there seems to be an additional entry for the sources which is shown when going to "Project Settings > Libraries > specific library". However, the path points to a non-existent source jar. Instead of referencing the subdirectory of the Bazel cache directory, the path consists of the directory containing the code of the project followed by the correct subdirectory structure.

Make command also under “Build” menu

Currently the "Make project" command is under the "Bazel" menu.
I looked for it and didn't even notice a "Bazel" menu for the first few hours but luckily just noticed that the keyboard shortcut works and I used it. I looked for this command under the "Build" menu where it usually resides and I think adding it to there also can be great to lower surprises for new-comers.

Can't run two Bazel processes at once

Consider this repository. https://github.com/dfabulich/two-processes

It has an empty WORKSPACE and two simple targets, //x:x and //y:y.

The x BUILD file declares a java_binary.

java_binary(
  name='x',
  main_class='X',
  srcs=['X.java'],
)

X.java just sleeps for 30 seconds.

public class X {
  public static void main(String[] args) throws Exception {
    Thread.sleep(30000L);
  }
}

The y target is identical to the x target, replacing x with y.

It's a well-established problem that you can't bazel run two processes at the same time, e.g. if you bazel run x in one tab and bazel run y in another tab, the y process will wait until x is finished. https://groups.google.com/forum/#!searchin/bazel-discuss/fabulich$20bazel$20run%7Csort:relevance/bazel-discuss/mS98nXz9PbY/Kcuhn0VEIQAJ

EDIT: Filed on the Bazel side as bazelbuild/bazel#2337

The workaround recommended in that thread is to use --script-path to generate a script; you can use a bazel-run.sh wrapper script to reduce boilerplate.

Now, load up this workspace with the IntelliJ Bazel plugin, using the included .bazelproject.

directories:
  .
targets:
  //x:x
  //y:y

Run x and, while it's sleeping, run y.

Actual: y refuses to start, because x has a lock. Since the IDE plugin is running Bazel, there's no visible way to use the --script-path workaround.

Expected: The IDE should use the --script-path workaround for me, automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.