bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
763 stars 305 forks source link

Error import Bazel Project #5940

Closed CarlosGamezF closed 1 month ago

CarlosGamezF commented 10 months ago

Description of the issue. Please be specific.

I am trying import a new Bazel project with the following .bazelproject file

directories:
  pkg/

java_language_level: JDK_11
workspace_type: java

build_flags:
  --javacopt=-g

# Automatically includes all relevant targets under the 'directories' above
derive_targets_from_directories: true

targets:
  //pkg/

test_sources:
  src/test/java/*

The Sync operation raises the error

command: bazel query --tool_tag=ijwb:IDEA:community --output=streamed_proto --relative_locations=true --keep_going () --
WARNING: Option 'java_toolchain' is deprecated
Loading:
WARNING: Option 'java_toolchain' is deprecated
ERROR: Error while parsing '()': syntax error at ')'
Error: bazel exited with exit code: 2
Build command failed with 2.
Command: aspect query --tool_tag=ijwb:IDEA:community --output=streamed_proto --relative_locations=true --keep_going () --

What's the simplest set of steps to reproduce this issue? Please provide an example project, if possible.

In Intelj File > Import Bazel Project -> Create from scratch

Version information

IdeaCommunity: 2023.3.2 Platform: Mac OS X 14.2.1 Bazel for IntelliJ plugin: 2023.12.19.0.1-api-version-233 Bazel: Blaze CL: null, Client CL: null

mai93 commented 10 months ago

Can you provide a simple project that shows this issue? I was not able to reproduce it with an empty project or the example java project: https://github.com/bazelbuild/intellij/tree/master/examples/java/greetings_project

malkia commented 9 months ago

I'm running into the same issue, but with C++ project https://github.com/malkia/arrow/tree/bazel

silverAndroid commented 9 months ago

Running into the same issue with https://github.com/bazelbuild/examples/tree/main/android/jetpack-compose

Android Studio version:

Android Studio Hedgehog | 2023.1.1 Patch 2
Build #AI-231.9392.1.2311.11330709, built on January 18, 2024
Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.1.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    external.system.auto.import.disabled=true
    debugger.new.tool.window.layout=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.experimental.ui=true

Non-Bundled Plugins:
    com.delicacy.SQLFormatter (1.5.10-SNAPSHOT)
    com.facebook.ktfmt_idea_plugin (1.1.0.47)
    com.squareup.sqldelight (2.0.1)
    com.google.idea.bazel.aswb (2024.01.16-aswb.0.1-api-version-231)
tpasternak commented 9 months ago

so this is a query sync error, empty expression here https://github.com/bazelbuild/intellij/blob/d7fa9fed2835c4fcf710ce8ac3d0bc7689d1a778/querysync/java/com/google/idea/blaze/qsync/query/QuerySpec.java#L52-L55

tpasternak commented 9 months ago

As a workaround, please disable query sync