mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-207382 - some fixes to delegated maven build
GitOrigin-RevId: 8a2223445fadfa27153236819dc5ca8a88b06f87
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c4090246e6
commit
403b0c90d8
+13
-2
@@ -11,9 +11,18 @@ import org.jetbrains.annotations.NotNull;
|
||||
@ApiStatus.Experimental
|
||||
public class BuildToolConsoleProcessAdapter extends ProcessAdapter {
|
||||
private final MavenBuildEventProcessor myEventParser;
|
||||
private final boolean myProcessText;
|
||||
private final AnsiEscapeDecoder myDecoder = new AnsiEscapeDecoder();
|
||||
|
||||
public BuildToolConsoleProcessAdapter(MavenBuildEventProcessor eventParser) {myEventParser = eventParser;}
|
||||
|
||||
/**
|
||||
* @param eventParser
|
||||
* @param processText to be removed after IDEA-216278
|
||||
*/
|
||||
public BuildToolConsoleProcessAdapter(MavenBuildEventProcessor eventParser, @Deprecated boolean processText) {
|
||||
myEventParser = eventParser;
|
||||
myProcessText = processText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNotified(@NotNull ProcessEvent event) {
|
||||
@@ -22,7 +31,9 @@ public class BuildToolConsoleProcessAdapter extends ProcessAdapter {
|
||||
|
||||
@Override
|
||||
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
|
||||
myDecoder.escapeText(event.getText(), outputType, myEventParser);
|
||||
if (myProcessText) {
|
||||
myDecoder.escapeText(event.getText(), outputType, myEventParser);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-5
@@ -4,9 +4,9 @@ package org.jetbrains.idea.maven.buildtool;
|
||||
import com.intellij.build.*;
|
||||
import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.process.AnsiEscapeDecoder;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
@@ -18,7 +18,7 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import icons.MavenIcons;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.execution.MavenRunConfiguration;
|
||||
import org.jetbrains.idea.maven.execution.MavenRunner;
|
||||
import org.jetbrains.idea.maven.externalSystemIntegration.output.parsers.MavenSpyOutputParser;
|
||||
import org.jetbrains.idea.maven.project.MavenConsole;
|
||||
import org.jetbrains.idea.maven.project.MavenConsoleImpl;
|
||||
import org.jetbrains.idea.maven.project.MavenGeneralSettings;
|
||||
@@ -55,6 +54,7 @@ public class BuildViewMavenConsole extends MavenConsole {
|
||||
@NotNull
|
||||
private final String myTitle;
|
||||
private final long myExecutionId;
|
||||
private final AnsiEscapeDecoder myDecoder = new AnsiEscapeDecoder();
|
||||
|
||||
public BuildViewMavenConsole(@NotNull Project project,
|
||||
@NotNull String title,
|
||||
@@ -66,7 +66,7 @@ public class BuildViewMavenConsole extends MavenConsole {
|
||||
myTitle = title;
|
||||
myExecutionId = executionId;
|
||||
ExternalSystemTaskId taskId = ExternalSystemTaskId.create(MavenUtil.SYSTEM_ID, EXECUTE_TASK, project);
|
||||
DefaultBuildDescriptor descriptor = new DefaultBuildDescriptor(taskId, "Run Maven task", workingDir, System.currentTimeMillis());
|
||||
DefaultBuildDescriptor descriptor = new DefaultBuildDescriptor(taskId, title, workingDir, System.currentTimeMillis());
|
||||
|
||||
BuildProgressListener buildProgressListener;
|
||||
if (ToolWindowId.BUILD.equals(toolWindowId)) {
|
||||
@@ -86,7 +86,7 @@ public class BuildViewMavenConsole extends MavenConsole {
|
||||
|
||||
@Override
|
||||
public void attachToProcess(ProcessHandler processHandler) {
|
||||
processHandler.addProcessListener(new BuildToolConsoleProcessAdapter(myEventParser));
|
||||
processHandler.addProcessListener(new BuildToolConsoleProcessAdapter(myEventParser, false));
|
||||
if (myBuildView != null) {
|
||||
myBuildView.attachToProcess(processHandler);
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
@@ -134,6 +134,10 @@ public class BuildViewMavenConsole extends MavenConsole {
|
||||
myEventParser.onTextAvailable(text, type == OutputType.ERROR);
|
||||
}
|
||||
|
||||
public void onTextAvailable(String text, Key outputType) {
|
||||
myDecoder.escapeText(text, outputType, myEventParser);
|
||||
}
|
||||
|
||||
private static JComponent createConsolePanel(ConsoleView view, ActionGroup actions) {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.jetbrains.idea.maven.execution;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.buildtool.BuildViewMavenConsole;
|
||||
import org.jetbrains.idea.maven.project.MavenConsole;
|
||||
import org.jetbrains.idea.maven.project.MavenGeneralSettings;
|
||||
import org.jetbrains.idea.maven.server.MavenServerConsole;
|
||||
|
||||
+6
-2
@@ -31,14 +31,15 @@ import com.intellij.util.io.BaseOutputReader;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.buildtool.BuildViewMavenConsole;
|
||||
import org.jetbrains.idea.maven.externalSystemIntegration.output.parsers.MavenSpyOutputParser;
|
||||
import org.jetbrains.idea.maven.project.MavenConsole;
|
||||
import org.jetbrains.idea.maven.project.MavenGeneralSettings;
|
||||
import org.jetbrains.idea.maven.server.MavenServerConsole;
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* external executor should woork through maven run configuration
|
||||
/*
|
||||
@deprecated external executor should work through maven run configuration
|
||||
*/
|
||||
public class MavenExternalExecutor extends MavenExecutor {
|
||||
|
||||
@@ -79,6 +80,9 @@ public class MavenExternalExecutor extends MavenExecutor {
|
||||
@Override
|
||||
public void notifyTextAvailable(@NotNull String text, @NotNull Key outputType) {
|
||||
// todo move this logic to ConsoleAdapter class
|
||||
if (myConsole instanceof BuildViewMavenConsole) {
|
||||
((BuildViewMavenConsole)myConsole).onTextAvailable(text, outputType);
|
||||
}
|
||||
if (!myConsole.isSuppressed(text) && (!MavenSpyOutputParser.isSpyLog(text) || Registry.is("maven.spy.events.debug"))) {
|
||||
super.notifyTextAvailable(text, outputType);
|
||||
}
|
||||
|
||||
+3
-3
@@ -346,7 +346,7 @@ public class MavenRunConfiguration extends LocatableConfigurationBase implements
|
||||
|
||||
MavenBuildEventProcessor eventProcessor =
|
||||
new MavenBuildEventProcessor(getProject(), getProject().getBasePath(), buildView, descriptor, taskId);
|
||||
processHandler.addProcessListener(new BuildToolConsoleProcessAdapter(eventProcessor));
|
||||
processHandler.addProcessListener(new BuildToolConsoleProcessAdapter(eventProcessor, true));
|
||||
buildView.attachToProcess(new MavenHandlerFilterSpyWrapper(processHandler));
|
||||
return buildView;
|
||||
}
|
||||
@@ -413,10 +413,10 @@ public class MavenRunConfiguration extends LocatableConfigurationBase implements
|
||||
}
|
||||
|
||||
|
||||
private class MavenHandlerFilterSpyWrapper extends ProcessHandler {
|
||||
private static class MavenHandlerFilterSpyWrapper extends ProcessHandler {
|
||||
private final ProcessHandler myOriginalHandler;
|
||||
|
||||
public MavenHandlerFilterSpyWrapper(ProcessHandler original) {
|
||||
MavenHandlerFilterSpyWrapper(ProcessHandler original) {
|
||||
|
||||
myOriginalHandler = original;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user