Skip to content

Make DepsTrackingReporter handle Windows path separators #1503

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

Merged
merged 2 commits into from
Jul 8, 2023

Conversation

crt-31
Copy link
Contributor

@crt-31 crt-31 commented Jun 24, 2023

Description

This fixes issue where the ‘compiler-dependency-analyzer’ was not handling Windows path separator and failed with false negatives.

  • Added one-liner in DepsTrackingReporter.java that replaces ‘\’ with ‘/’ in the paths it receives from the scalac compiler.

Motivation

Makes the new compiler-dependency-analyzer work on Windows.

Before this PR, on Windows, compiling would report a bunch of erroneous 'unused deps' errors.

This fixes #1487

@crt-31 crt-31 requested review from liucijus and simuons as code owners June 24, 2023 01:31
Copy link
Collaborator

@liucijus liucijus left a comment

Choose a reason for hiding this comment

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

Thanks @crt-31, LGTM, please address the comment

@@ -85,12 +85,16 @@ def _write_executable_windows(ctx, executable, rjars, main_class, jvm_flags, wra
cpfile = ctx.actions.declare_file("%s.classpath" % ctx.label.name)
ctx.actions.write(cpfile, classpath)

specifiedEnv = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need the same change in both PRs? #1502 (comment)

Copy link
Contributor Author

@crt-31 crt-31 Jun 26, 2023

Choose a reason for hiding this comment

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

Both PRs need the change to work (I was trying to make the PRs standalone). But I could put in only one if thats what you want, probably not big deal if you are gonna commit both PRs soon.
@liucijus please advise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@crt-31 we can merge PRs in order, #1502 and then #1503

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I removed this 'specifiedEnv' change from this PR.
@liucijus Ready for your review.

@crt-31 crt-31 force-pushed the DepsTrackingReporterPathFix branch from 927cfd5 to 5093801 Compare June 28, 2023 00:41
@@ -17,6 +17,9 @@
import java.util.Set;
import java.util.jar.JarFile;
import java.util.stream.Collectors;

import javax.print.attribute.standard.Severity;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks to be unused import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liucijus: ok. That unused import is removed.
Fixed.

@crt-31
Copy link
Contributor Author

crt-31 commented Jul 6, 2023

@liucijus, I'm not sure why the CI tests failed on this merge. The tests ran fine on my linux vm.
Any chance you could re-run the CI tests on this merge?

@liucijus liucijus merged commit 58b98f2 into bazel-contrib:master Jul 8, 2023
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.

New dep tracking not working on Windows due to 'unused dep' errors
3 participants