Skip to content

bugfix: Properly clean up orphan directories for internal classes #2032

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 1 commit into from
Apr 11, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Apr 6, 2023

It seems that the genericClassesDir is not being used at all by the compiler, so cleaning orphan directories in it was not achieving anything.

We might need to figure out how to use genericClassesDir and whether it needs to be used at all, but for now this fixes the issue of large .bloop directory.

@tgodzik tgodzik requested review from ckipp01 and kpodsiad April 6, 2023 17:02
@@ -177,7 +177,7 @@ object ResultsCache {
if (!cleanOrphanedInternalDirs) Task.unit
else {
val internalClassesDir =
CompileOutPaths.createInternalClassesRootDir(project.genericClassesDir)
CompileOutPaths.createInternalClassesRootDir(project.out)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you provide concrete values for project.out and project.genericClassesDir? Is one of them bloop-internal-classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

project.out is the currently used one for example /.bloop/input3/ while genericClassesDir is .bloop/input3/scala-3/classes, which is actually defined in the json file.

Copy link
Member

Choose a reason for hiding this comment

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

I'm actually a bit surprised by this, I thought it would use the one specific to the scala version and therefore the nested on in .bloop/input3/scala-3/classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is kind of redundant since you can't have multiple Scala versions for one project, so I don't think it's really useful. Also, it's a smaller change to just ignore that directory :S

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also, it seems that we always use bloop-bsp-clients-classes always instead of classesDir, so this looks legit as if we had only a single output we could have issues with mutiple clients. (whether we could have mutiple BSP client for the same workspace is another thing altogether.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add scaladoc which will explain what orphaned directories are? Giving some concrete examples you did int his thread will awesome

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, more digging it seems the is an option for the tool to use managed classes directory, but there is even more logic on top of it to dermine it.

Copy link
Member

Choose a reason for hiding this comment

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

That is kind of redundant since you can't have multiple Scala versions for one project, so I don't think it's really useful. Also, it's a smaller change to just ignore that directory :S

ah ok cool, thanks for the explanations 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added scaladoc to this method. I will probably dig in a bit more later on.

It seems that the genericClassesDir is not being used at all by the compiler, so cleaning orphan directories in it was not achieving anything.

We might need to figure out how to use `genericClassesDir` and whether it needs to be used at all, but for now this fixes the issue of large .bloop directory.
@tgodzik tgodzik merged commit 572983c into scalacenter:main Apr 11, 2023
@tgodzik tgodzik deleted the fix-cleanup branch April 11, 2023 08:12
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.

None yet

3 participants