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

[Bug]: Non-canonical default for GRADLE_USER_HOME in gradle #5006

Open
3 tasks done
mwisnicki opened this issue Aug 7, 2023 · 6 comments
Open
3 tasks done

[Bug]: Non-canonical default for GRADLE_USER_HOME in gradle #5006

mwisnicki opened this issue Aug 7, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@mwisnicki
Copy link

mwisnicki commented Aug 7, 2023

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues/PRs to ensure it has not already been reported or fixed.
  • I have verified that I am using the latest version of Scoop and corresponding bucket.

Package Name

gradle

Expected/Current Behaviour

I'm migrating manually installed gradle to the one managed by scoop and expect it to follow reasonable/canonical defaults.

The default value of GRADLE_USER_HOME for upstream gradle is ~/.gradle however gradle package from scoop effectively changes that to ~\scoop\apps\gradle\current\.gradle.

This means that caches are not reused and I'm wasting a ton of space.

Scoop should follow Principle Of Least Surprise and stick to upstream defaults unless there is a good justification for doing so and in which case it must be documented.

Related: #4512

Steps to Reproduce

scoop install gradle
ls ~/.gradle ~/scoop/apps/gradle/current/.gradle

Possible Solution

Default GRADLE_USER_HOME to ~/.gradle or do not set it at all.

OR

Document why it absolutely has to be non-standard by default.

Scoop and Buckets Version

$ scoop --version
Current Scoop version:
v0.3.1 - Released at 2022-11-15

'main' bucket:
6ef223035 (HEAD -> master, origin/master, origin/HEAD) watchman: Update to version 2023.08.07.00

Scoop Config

$ scoop config

last_update                       scoop_branch scoop_repo
-----------                       ------------ ----------
2023-08-07T11:56:54.9662627-04:00 master       https://github.com/ScoopInstaller/Scoop

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.22621.1778
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.1778
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Additional Softwares

No response

@mwisnicki mwisnicki added the bug Something isn't working label Aug 7, 2023
@mwisnicki
Copy link
Author

I looked around a bit and found that usage of persist directory in scoop is sadly by design.

In that case maybe we can consider some of these options instead:

  1. Default to ~/.grade only if it exists
  2. Migrate ~/.gradle to scoop/persist if it exists
    • create ~/.gradle/MIGRATED-TO-SCOOP.txt so the user knows what's going on ?

@mwisnicki
Copy link
Author

Also this is somewhat inconsistent with scoop's maven - which still uses ~/.m2 but maybe that should be considered a bug of maven package?

@HUMORCE
Copy link
Member

HUMORCE commented Aug 7, 2023

I have believed that any migration should be done manually by the user, but some people don't think so.

Migrate ~/.gradle to scoop/persist if it exists

That's fine, then tell the users GRADLE_USER_HOME has been set to $dir\.gradle or $persist_dir\.gradle. I am not a gradle user, so if you are good with it, fell free to improve it.

@mwisnicki
Copy link
Author

mwisnicki commented Aug 7, 2023

Btw what is the rationale for moving application config/cache to persist directory?

I've found https://github.com/ScoopInstaller/Scoop/wiki/Persistent-data but that answers what/when but not why.

@HUMORCE
Copy link
Member

HUMORCE commented Aug 8, 2023

The apps that install best with Scoop are commonly called "portable" apps: i.e. compressed program files that run stand-alone when extracted and don't have side-effects like changing the registry or putting files outside the program directory.

https://github.com/ScoopInstaller/Scoop#what-sort-of-apps-can-scoop-install

Scoop usually relocates files/dirs(configs, profiles, etc.) of programs via files, environment variables, or CLI options.

btw, that's why I use Scoop instead of winget or choco, we can got this with any installation but Scoop is more intuitive and easier.

@rashil2000
Copy link
Member

@mwisnicki could you make a PR to include an additional condition which checks for the existence of ~/.gradle folder in the post_install script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants