mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-149447 Eternal 'You can configure Gradle wrapper...'
This commit is contained in:
+10
-3
@@ -49,6 +49,7 @@ import org.jetbrains.plugins.gradle.util.GradleUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -98,7 +99,7 @@ public class UseDistributionWithSourcesNotificationProvider extends EditorNotifi
|
||||
final GradleProjectSettings settings = GradleSettings.getInstance(module.getProject()).getLinkedProjectSettings(rootProjectPath);
|
||||
if (settings == null || settings.getDistributionType() != DistributionType.DEFAULT_WRAPPED) return null;
|
||||
if (settings.isDisableWrapperSourceDistributionNotification()) return null;
|
||||
if (isWrapperDistributionWithSourcesUsed(rootProjectPath)) return null;
|
||||
if (!showUseDistributionWithSourcesTip(rootProjectPath)) return null;
|
||||
|
||||
final EditorNotificationPanel panel = new EditorNotificationPanel();
|
||||
panel.setText(GradleBundle.message("gradle.notifications.use.distribution.with.sources"));
|
||||
@@ -157,12 +158,18 @@ public class UseDistributionWithSourcesNotificationProvider extends EditorNotifi
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isWrapperDistributionWithSourcesUsed(String linkedProjectPath) {
|
||||
private static boolean showUseDistributionWithSourcesTip(String linkedProjectPath) {
|
||||
WrapperConfiguration wrapperConfiguration = GradleUtil.getWrapperConfiguration(linkedProjectPath);
|
||||
// currently only wrapped distribution takes into account
|
||||
if (wrapperConfiguration == null) return true;
|
||||
String distributionUri = wrapperConfiguration.getDistribution().toString();
|
||||
return GRADLE_SRC_DISTRIBUTION_PATTERN.matcher(distributionUri).matches();
|
||||
try {
|
||||
String host = new URI(distributionUri).getHost();
|
||||
return host.endsWith("gradle.org") && !GRADLE_SRC_DISTRIBUTION_PATTERN.matcher(distributionUri).matches();
|
||||
}
|
||||
catch (URISyntaxException ignore) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user