Skip to content

[WIP] Add detection for unused classpath entries as part of strict mode #438

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
wants to merge 1 commit into from

Conversation

jjudd
Copy link
Contributor

@jjudd jjudd commented Mar 7, 2018

Based on what I read in #235, I hacked together a quick unused_deps implementation that is currently bundled together with strict_java_deps.

This is a work in progress. I would like to get people's feedback on this before continuing.

@jjudd
Copy link
Contributor Author

jjudd commented Mar 7, 2018

This should be it's own flag. I bundled it with strict_java_deps for the sake of speed in building a prototype.

@jjudd
Copy link
Contributor Author

jjudd commented Mar 23, 2018

Wanted to provide an update here: we're still working on this and should hopefully have something within the next couple weeks.

We found an issue with macros and classpath-shrinker, which I filed an issue about: scalacenter/classpath-shrinker#4

I like their suggestion of adding a whitelist for deps that are actually used, but the plugin marks as unused. That way unused_deps doesn't become totally blocked on bugs in the classpath shrinking mechanism.

We're moving into using our internal version of this to remove unused deps from our build files in combination with ibazel. If that goes well, we will polish it up and update this PR.

@ittaiz
Copy link
Contributor

ittaiz commented Mar 23, 2018 via email

@johnynek
Copy link
Contributor

really excited about this! Thank you!

@jjudd
Copy link
Contributor Author

jjudd commented Mar 23, 2018

I was planning on adding an attribute to the scala rules for the whitelist. The attribute lists the deps that should not be marked as unused.

I'm open to other ways of solving this. Ideally I'd be able to tag deps in the actual deps list, but I don't think Bazel supports that.

@ittaiz
Copy link
Contributor

ittaiz commented Mar 23, 2018 via email

@jjudd
Copy link
Contributor Author

jjudd commented Mar 24, 2018

I'm not totally certain if that macro classpath bug happens for all macros or just some. I was able to repro with those two jars, but there are others that I can't repro the problem with.

Automatically whitelisting scala_macro_library and scala_import would likely fix the issue. It may whitelist too many things, though.

As I work on optimizing our internal build files over the next few weeks, I'll see what happens and keep people updated.

@ittaiz
Copy link
Contributor

ittaiz commented Mar 24, 2018 via email

@ittaiz
Copy link
Contributor

ittaiz commented Feb 3, 2020

Closing this since we have unused deps. Thanks.

@ittaiz ittaiz closed this Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants