Skip to content

Commit

Permalink
[Gradle|TestFramework] new: install Gradle execution output printer i…
Browse files Browse the repository at this point in the history
…n the Gradle Junit 5 tests

## Issues
  * IDEA-366878 An unnecessary additional plugin block is added to the settings.gradle(.kts) when a new Kotlin module is added

## Tests
  * org.jetbrains.kotlin.tools.projectWizard.wizard.GradleKotlinNewProjectWizardTest

GitOrigin-RevId: 6dfa47e68d4fc9bdb6664c764ed76276ac9139b0
  • Loading branch information
HackerMadCat authored and intellij-monorepo-bot committed Feb 6, 2025
1 parent 42b6334 commit ee51daf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
@Override
protected void setUp() throws Exception {
super.setUp();
installExecutionOutputPrinter();
installExecutionOutputPrinter(getTestDisposable());
}

@Override
Expand All @@ -96,7 +96,7 @@ public void tearDown() throws Exception {
return myTestDisposable;
}

private void installExecutionOutputPrinter() {
public static void installExecutionOutputPrinter(@NotNull Disposable parentDisposable) {
var notificationManager = ExternalSystemProgressNotificationManager.getInstance();
var notificationListener = new ExternalSystemTaskNotificationListener() {

Expand All @@ -120,7 +120,7 @@ public void onEnd(@NotNull String projectPath, @NotNull ExternalSystemTaskId id)
System.out.println();
}
};
notificationManager.addNotificationListener(notificationListener, getTestDisposable());
notificationManager.addNotificationListener(notificationListener, parentDisposable);
}

protected void assertModulesContains(String... expectedNames) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.externalSystem.testFramework.ExternalSystemImportingTestCase
import com.intellij.testFramework.common.runAll
import org.gradle.util.GradleVersion
import org.jetbrains.jps.model.java.JdkVersionDetector.JdkVersionInfo
Expand Down Expand Up @@ -43,6 +44,7 @@ abstract class GradleBaseTestCase {
testDisposable = Disposer.newDisposable()
AutoImportProjectTracker.enableAutoReloadInTests(testDisposable)
AutoImportProjectTracker.enableAsyncAutoReloadInTests(testDisposable)
ExternalSystemImportingTestCase.installExecutionOutputPrinter(testDisposable)
}

@AfterEach
Expand Down

0 comments on commit ee51daf

Please sign in to comment.