Skip to content

object of type 'File' has no field 'class_jar'. error from intellij plugin when syncing scala targets #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevingessner opened this issue Sep 13, 2017 · 16 comments · Fixed by #278

Comments

@kevingessner
Copy link
Contributor

I see this error in the Intellij Bazel console for every scala_library target in my project, during Sync:

ERROR: /REDACTED/common/BUILD.bazel:3:1: in @intellij_aspect//:intellij_info.bzl%intellij_info_aspect aspect on scala_library rule //REDACTED/common:common: 
Traceback (most recent call last):
	File "/REDACTED/common/BUILD.bazel", line 3
		@intellij_aspect//:intellij_info.bzl%intellij_info_aspect(...)
	File "/private/var/tmp/_bazel_kgessner/a607cbff8886d2ecb81399f157ed2535/external/intellij_aspect/intellij_info.bzl", line 18, in _aspect_impl
		intellij_info_aspect_impl(target, ctx, semantics)
	File "/private/var/tmp/_bazel_kgessner/a607cbff8886d2ecb81399f157ed2535/external/intellij_aspect/intellij_info_impl.bzl", line 691, in intellij_info_aspect_impl
		collect_java_info(target, ctx, semantics, ide_info, <2 more arguments>)
	File "/private/var/tmp/_bazel_kgessner/a607cbff8886d2ecb81399f157ed2535/external/intellij_aspect/intellij_info_impl.bzl", line 386, in collect_java_info
		library_artifact(output)
	File "/private/var/tmp/_bazel_kgessner/a607cbff8886d2ecb81399f157ed2535/external/intellij_aspect/intellij_info_impl.bzl", line 130, in library_artifact
		java_output.class_jar
object of type 'File' has no field 'class_jar'.

It prevents intellij from analyzing the scala targets, and breaks most code analysis -- e.g. intellij can't find any of the imports. The symptoms look like bazelbuild/intellij#96, but I'm running versions of everything that should include those fixes:

  • bazel version: 0.5.4-homebrew (I'm on OS X)
  • rules_scala: 23d94ae
  • intellij: IntelliJ IDEA 2017.2.4
  • bazel for intellij plugin: 2017.08.29.0.2

I've traced the problem as far as the jars value exported to intellij being incorrect -- it should be a list of structs like [outputs], not a list of files.

I'll try to put together a small test project I can share. Let me know if you need anything else, or if I should report this to bazelbuild/intellij instead. Thanks!

@ittaiz
Copy link
Contributor

ittaiz commented Sep 13, 2017

Thanks! I've been investigating a different problem with the intellij plugin and I don't have the errors you're showing but it makes sense. I'll try to come up with a fix tomorrow and see how it effects my repo

@kevingessner
Copy link
Contributor Author

Here's a small project that shows the error in intellij: https://github.com/kevingessner/scala-intellij-test -- let me know if that doesn't work for you.

@ittaiz I saw a different error with older versions of the plugin; something about NoneType is not iterable, IIRC.

@ittaiz
Copy link
Contributor

ittaiz commented Sep 14, 2017 via email

@greggdonovan
Copy link
Contributor

greggdonovan commented Sep 15, 2017

Thanks for the help @ittaiz!

@ittaiz @kevingessner @brendandouglas

How could we best go about setting up a sample rules_scala project like @kevingessner setup to run as an end-to-end test on changes to rules_scala, intellij, or bazel-deps?

I see tests of scala_library in the intellij plugin code, but I'm unsure how they work, as the intellij plugin doesn't import rules_scala.

@ittaiz
Copy link
Contributor

ittaiz commented Sep 15, 2017 via email

@brendandouglas
Copy link

We do have internal integration tests of our skylark aspect, including scala-specific tests. I haven't yet given any thought to open sourcing these, but it's something we'll eventually do.

We're also currently working on setting up end-to-end plugin sync tests, including bazel invocations (our current sync tests mock out the bazel invocations). This integration testing framework may not support external workspaces though.

@greggdonovan
Copy link
Contributor

@brendandouglas End-to-end plugin sync tests sound like exactly what we need. By "external workspaces" do you mean projects in Git repos other than bazelbuild/intellij?

@brendandouglas
Copy link

By external workspaces, I mean bazel workspaces other than the primary one being tested (e.g. any external libraries referenced in the bazel WORKSPACE file).

@brendandouglas
Copy link

I've added some aspect tests to the IntelliJ GitHub project (https://github.com/bazelbuild/intellij/tree/master/aspect/testing/tests/src/com/google/idea/blaze/aspect/scala).

These scala tests are running against the old version of rules_scala we're using internally (and are currently broken when run against rules_scala HEAD).

@ittaiz
Copy link
Contributor

ittaiz commented Oct 10, 2017 via email

@greggdonovan
Copy link
Contributor

greggdonovan commented Oct 14, 2017

(Sorry for the slow response.)

@brendandouglas Thanks for adding these! Should we be running anything other than bazel test --incompatible_disallow_set_constructor=false //aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/...? I tried bazel test 'scala/...' but couldn't get it to run locally.

@ittaiz @kevingessner -- In the notes for our meeting we had:

In rules_scala’s travis: cloning the latest of intellij plugin, use override_repository to test intellij against proposed version of rules_scala.

So, something like bazel --override_repository io_bazel_rules_scala=$(pwd) in ./runTests.sh? Does this still sound like a good plan?

@ittaiz
Copy link
Contributor

ittaiz commented Oct 14, 2017 via email

@greggdonovan
Copy link
Contributor

Update:

Using the new aspect integration tests and git bisect I see this as the commit that started to break the aspect.

However, the failure with rules_scala master is different and looks related to macros + ijars expectations. Any ideas?

@greggdonovan
Copy link
Contributor

@ittaiz The idea would be to have a separate yaml for the IntelliJ integration tests so the current rules_scala travis.yaml CI could be green if only the aspect integration was broken? That makes sense.

A quick check for multiple .travis.yaml file support yields this, unfortunately.

@ittaiz
Copy link
Contributor

ittaiz commented Oct 14, 2017

@greggdonovan
Not sure but sounds reasonable that #278 fixed the first breakage.
From the bisect do you see any of other changes breaking the interface or is this from the intellij side?
I'll try to dive a bit into the stacktrace

And re multi travis.yml- let's drop it.
Any chance you can open a new issue about our plan (your original version) so people (mainly Oscar) can object or suggest better ways?

@ittaiz
Copy link
Contributor

ittaiz commented Oct 14, 2017

discussion should continue on #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants