Skip to content

Conversation

@liucijus
Copy link
Collaborator

@liucijus liucijus commented Apr 1, 2022

Description

jdeps files can be used by Intellij Bazel plugin to build project model without requiring special support for Scala rules.

This implementation is very simple: treats all classpath entries as explicit deps, and is written by ScalacWorker. I decided not to put it on dependency analyzer as it requires users to have it enabled, which can be undesired performance hit. Writing actual unused deps information from the analyzer can be implemented later.

Motivation

Improving Scala support in Intellij Bazel plugin. This should help advance support for external source attachment. Though more work is required on the plugin side:

  • consuming full jars instead of ijar
  • properly detecting source roots for Scala source artifacts

Motivation: jdeps output is used by Intellij Bazel plugin to construct project model. Current implementation adds all entries as explicit source deps, does not do distinguish between implicit or unused deps.
@liucijus liucijus requested a review from simuons as a code owner April 1, 2022 13:30
Copy link
Collaborator

@simuons simuons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just few minor comments.

args.add("--Manifest", manifest)
args.add("--PrintCompileTime", print_compile_time)
args.add("--ExpectJavaOutput", expect_java_output)
if jdepsPath != None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When jdepsPath can be None? Maybe there is no need for None and null checks?

import java.io.IOException;
import java.io.OutputStream;

public class JdepsWriter {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think according whole ceremony this class should be final with private constructor. But I'm fine with the way it is now.

}

try (OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(jdpesPath))) {
outputStream.write(builder.build().toByteArray());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think builder.build().writeTo(outputStream) should me more effective as it doesn't construct intermediary byte array.

@liucijus liucijus merged commit 3dd5d81 into bazel-contrib:master Apr 8, 2022
@liucijus liucijus deleted the jdeps branch April 8, 2022 10:11
liucijus added a commit to liucijus/rules_scala that referenced this pull request Apr 28, 2022
liucijus added a commit to liucijus/rules_scala that referenced this pull request Apr 28, 2022
Intellij needs full jars to be able to attach sources, and providing ijars with jdeps is degrading experience when someone already uses full jars
liucijus added a commit to liucijus/rules_scala that referenced this pull request Apr 29, 2022
Intellij needs full jars to be able to attach sources, and
providing ijars with jdeps is degrading experience when someone already uses full jars
liucijus added a commit to liucijus/rules_scala that referenced this pull request Apr 29, 2022
Intellij needs full jars to be able to attach sources, and providing ijars with jdeps is degrading experience when someone already uses full jars
liucijus added a commit that referenced this pull request Apr 29, 2022
Intellij needs full jars to be able to attach sources, and providing ijars with jdeps is degrading experience when someone already uses full jars
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 this pull request may close these issues.

2 participants