Skip to content
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

Semanticdb clear dir #1580

Merged
merged 3 commits into from
May 27, 2024
Merged

Conversation

crt-31
Copy link
Contributor

@crt-31 crt-31 commented May 18, 2024

Description

This change clears out and deletes the _semanticdb folder before compiling. This is similar to how ScalacWorker was already clearing out the _classes directory.

Motivation

I ran into a bug where, when you delete a source *.scala file, it's associated semanticdb file remained and was read-only which caused permission errors when the compiler tried to clear the semanticdb output directory.

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.

Thanks, @crt-31, for taking this. Please take a look at comment.

@@ -95,6 +98,15 @@ private static Path ensureEmptyWorkDirectory(Path output, String label) throws I

return Files.createDirectories(dir);
}

private static void ensureEmptySemanticDBDirectory(Path output, String label) throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to refactor ensureEmptyWorkDirectory instead of adding this method wich looks almost identical and serves same purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

(But the tests seem flaky... they have failed in different places (unrelated to this change) on last 2 runs).

@crt-31 crt-31 force-pushed the semanticdb_clear_dir branch 2 times, most recently from ac909f0 to 9532a4a Compare May 23, 2024 19:10
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!

@liucijus liucijus merged commit 69aec43 into bazelbuild:master May 27, 2024
2 checks passed
crt-31 added a commit to crt-31/rules_scala-devfork that referenced this pull request Jul 1, 2024
* Delete _semanticdb folder before compiling

* lint fix

* Consolidated some functions in Scalacworker.
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.

3 participants