Skip to content

scrooge_scala_library: Remove scala field on provider and instead return jars in JavaInfo provider #564

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

Open
beala-stripe opened this issue Jul 18, 2018 · 1 comment

Comments

@beala-stripe
Copy link
Contributor

In order to support the IntelliJ Bazel plugin, #562 returns an old style provider from scrooge_scala_library. This is to work around an issue where a JavaInfo provider cannot have multiple output jars, so we return a scala provider instead (see PR #562 for an in depth description of the issue and workaround).

Setting multiple output jars on an JavaInfo will be addressed by this fix, which is expected to arrive in 0.17.0. Once this lands, it will allow us to set multiple output jars by merging multiple JavaInfos and we can then get rid of the scala field and set the output jars on JavaInfo instead.

@johnynek
Copy link
Contributor

relates to #466

beala-stripe added a commit to beala-stripe/rules_scala that referenced this issue Jan 14, 2019
This addresses bazel-contrib#564

tl;dr: In order to support thrift resolution in IJ, we had to use old-style
providers to return the metadata in a shape that IJ understood. Since bazel
0.17, java_common.merge has been changed to support using new-style providers.

This uses new-style providers and gets rid of the previous hack, but note
that this means this change *isn't compatible with bazel < 0.17*
ittaiz pushed a commit that referenced this issue Jan 23, 2019
* Fix transitive thrift symbol resolution in IntelliJ

Currently, given the following build file structure:

scrooge_scala_library -> thrift_library -> thrift_library

where "A -> B" means "A depends on B"

Only symbols in the leftmost thrift_library will resolve in IJ.
This is because when the compile scrooge jars are gathered up,
transitive jars are not gathered. This fixes this behavor by
adding transitive jars to the ScroogeAspectInfo.output_files
depset.

* Add transitive outputs field to ScroogeAspectInfo. Add dep attr to scrooge rule.

* Use new style providers in twitter_scrooge

This addresses #564

tl;dr: In order to support thrift resolution in IJ, we had to use old-style
providers to return the metadata in a shape that IJ understood. Since bazel
0.17, java_common.merge has been changed to support using new-style providers.

This uses new-style providers and gets rid of the previous hack, but note
that this means this change *isn't compatible with bazel < 0.17*

* Remove unnecessary code

It appears that this mostly just works given the new behavior of java_common.merge (outputs are merged), so I was able to remove all the code that was gathering up outputs manually.

* Add unit tests for scrooge rule outputs

* Bump to latest version of skylib

* Run tests with bazel 0.17.1

* Run CI tests with upper and lower bounds.
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

No branches or pull requests

2 participants