Skip to content

Commit

Permalink
Merge pull request #532 from joshfriend/jfriend/support-jellyfish
Browse files Browse the repository at this point in the history
Use updated GradleSettingsListener apis
  • Loading branch information
asodja authored Jan 23, 2024
2 parents 49747cb + ca8c186 commit c7f54f7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.gradle.profiler.studio.plugin;

import java.util.Collection;
import java.util.Set;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.settings.DistributionType;
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings;
import org.jetbrains.plugins.gradle.settings.GradleSettingsListener;
import org.jetbrains.plugins.gradle.settings.TestRunner;

/**
* A default implementation of GradleSettingsListener that does nothing.
*/
public class DefaultGradleSettingsListener implements GradleSettingsListener {
@Override public void onProjectsLinked(@NotNull Collection<GradleProjectSettings> settings) { }
@Override public void onGradleHomeChange(@Nullable String oldPath, @Nullable String newPath, @NotNull String linkedProjectPath) { }
@Override public void onGradleDistributionTypeChange(DistributionType currentValue, @NotNull String linkedProjectPath) { }
@Override public void onServiceDirectoryPathChange(@Nullable String oldPath, @Nullable String newPath) { }
@Override public void onGradleVmOptionsChange(@Nullable String oldOptions, @Nullable String newOptions) { }
@Override public void onBuildDelegationChange(boolean delegatedBuild, @NotNull String linkedProjectPath) { }
@Override public void onTestRunnerChange(@NotNull TestRunner currentTestRunner, @NotNull String linkedProjectPath) { }
@Override public void onProjectRenamed(@NotNull String oldName, @NotNull String newName) { }
@Override public void onProjectsUnlinked(@NotNull Set<String> linkedProjectPaths) { }
@Override public void onBulkChangeStart() { }
@Override public void onBulkChangeEnd() { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager;
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.util.registry.Registry;
Expand Down Expand Up @@ -84,7 +83,7 @@ private void disableDownloadOfExternalAnnotations(Project project) {
GradleSettings gradleSettings = GradleSettings.getInstance(project);
gradleSettings.getLinkedProjectsSettings()
.forEach(settings -> settings.setResolveExternalAnnotations(false));
gradleSettings.subscribe(new ExternalSystemSettingsListenerAdapter<>() {
gradleSettings.subscribe(new DefaultGradleSettingsListener() {
@Override
public void onProjectsLinked(@NotNull Collection<GradleProjectSettings> linkedProjectsSettings) {
linkedProjectsSettings.forEach(settings -> settings.setResolveExternalAnnotations(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.gradle.profiler.studio.plugin
import com.android.tools.idea.sdk.Jdks
import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemJdkUtil
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.openapi.projectRoots.ProjectJdkTable
Expand Down Expand Up @@ -53,7 +52,7 @@ class IdeSetupHelper extends HeavyPlatformTestCase {
ProjectRootManager.getInstance(project).setProjectSdk(jdk)
}
GradleSettings gradleSettings = GradleSettings.getInstance(project);
gradleSettings.subscribe(new ExternalSystemSettingsListenerAdapter<GradleProjectSettings>() {
gradleSettings.subscribe(new DefaultGradleSettingsListener() {
@Override
void onProjectsLinked(@NotNull Collection<GradleProjectSettings> linkedProjectsSettings) {
linkedProjectsSettings.each { it.gradleJvm = ExternalSystemJdkUtil.USE_PROJECT_JDK }
Expand Down

0 comments on commit c7f54f7

Please sign in to comment.