scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
907 stars 202 forks source link

Consider using `dirs-dev` instead of putting everything in `$HOME/.bloop` #1844

Open ckipp01 opened 1 year ago

ckipp01 commented 1 year ago

Lately I've been trying to clean up my $HOME dir and have been noticing that a lot of the Scala ecosystem stick stuff in $HOME. Looking around in Bloop I see that defaultBloopDirectory is $HOME/.bloop.

https://github.com/scalacenter/bloop/blob/efc8d628130fc96ec3875cda1a490dede24fe0d6/bloopgun/src/main/scala/bloop/bloopgun/util/Environment.scala#L26

There are probably other places this is set as well, but I wonder if instead it'd be better to rely on something like dirs-dev to handle this more correctly and place these things in the appropriate places instead of polluting the users home directory. I know this might break some stuff so we could also use $HOME/.bloop for a while as a fallback, but default to the correct places via dirs-dev.

Do you think this would be possible, or do you see any issues with this?

tgodzik commented 1 year ago

I think that makes sense, I doubt there is any real reason why it necessarily is done via .bloop in home directory.

Though the only problem is .bloop/bloop.json which would be harder to find when using dirs-dev

ckipp01 commented 1 year ago

Though the only problem is .bloop/bloop.json which would be harder to find when using dirs-dev

I think it shouldn't be a problem right? Since it's a config file I'd just expect it to look for XDG_CONFIG_HOME/bloop/bloop.json (in Linux anyways).

tgodzik commented 1 year ago

Maybe not, yeah. So probably not blockers to do that.

ckipp01 commented 1 year ago

Funny enough, I just realized that Bloop actually has everything that is needed to start just utilizing this, but it's not used by everything. You can see this in

https://github.com/scalacenter/bloop/blob/931ce1b480dc0310c56a8783aa99c4c7bf9b3109/shared/src/main/scala/bloop/io/Paths.scala#L25-L31

So for the config stuff mentioned above we literally need to just start using it.

tgodzik commented 1 year ago

That's pretty typical in the repo, loads of things were done by one person only team, so it's expected that some stuff might be leftover :sweat: