Skip to content

IDEA-328157 Allow gradle installations to be read-only #3028

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JFronny
Copy link

@JFronny JFronny commented Apr 19, 2025

Currently, the Gradle tool window permits any directory containing the correct content to be configured as the Gradle installation home:

if (GradleInstallationManager.getInstance().isGradleSdkHome(project, Path.of(myGradleHomePathField.getText()))) {
myGradleHomeSettingType = GradleLocationSettingType.EXPLICIT_CORRECT;
}

The new project wizard and settings component on the other hand use CHECK_DIRECTORY in addition, which also checks whether the directory is writable, even though this is never needed here:

val CHECK_DIRECTORY: DialogValidation.WithParameter<() -> String> = validationPathErrorFor { path ->
when {
!path.exists() -> null
!path.isWritable() -> UIBundle.message("label.project.wizard.new.project.directory.not.writable.error", path.name)
!path.isDirectory() -> UIBundle.message("label.project.wizard.new.project.file.not.directory.error", path.name)
else -> null
}
}

As a consequence, users that use a package manager first have to create their projects with gradlew, then manually delete the gradlew files and change the installation home in the tool window instead of just creating their project.

This PR fixes this by providing a variant of CHECK_DIRECTORY that does not check for writeability.

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.

1 participant