mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[grails] use gradle init script to log test events (IDEA-162555)
This commit is contained in:
+7
-16
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.gradle.execution.test.runner;
|
||||
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.testframework.TestConsoleProperties;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
@@ -41,7 +28,11 @@ public class GradleConsoleProperties extends SMTRunnerConsoleProperties {
|
||||
@Nullable private File gradleTestReport;
|
||||
|
||||
public GradleConsoleProperties(final ExternalSystemRunConfiguration configuration, Executor executor) {
|
||||
super(configuration, configuration.getSettings().getExternalSystemId().getReadableName(), executor);
|
||||
this(configuration, configuration.getSettings().getExternalSystemId().getReadableName(), executor);
|
||||
}
|
||||
|
||||
public GradleConsoleProperties(@NotNull RunConfiguration config, @NotNull String testFrameworkName, @NotNull Executor executor) {
|
||||
super(config, testFrameworkName, executor);
|
||||
}
|
||||
|
||||
public void setGradleTestReport(@Nullable File gradleTestReport) {
|
||||
|
||||
+24
-29
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.gradle.service.execution;
|
||||
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
@@ -508,22 +494,31 @@ public class GradleExecutionHelper {
|
||||
}
|
||||
buf.append(']');
|
||||
|
||||
InputStream stream = Init.class.getResourceAsStream("/org/jetbrains/plugins/gradle/tooling/internal/init/testFilterInit.gradle");
|
||||
try {
|
||||
if (stream == null) {
|
||||
LOG.warn("Can't get test filter init script template");
|
||||
return;
|
||||
}
|
||||
String script = FileUtil.loadTextAndClose(stream).replaceFirst(Pattern.quote("${TEST_NAME_INCLUDES}"), Matcher.quoteReplacement(buf.toString()));
|
||||
final File tempFile = writeToFileGradleInitScript(script, "ijtestinit");
|
||||
ContainerUtil.addAll(args, GradleConstants.INIT_SCRIPT_CMD_OPTION, tempFile.getAbsolutePath());
|
||||
String path = renderInitScript(buf.toString());
|
||||
if (path != null) {
|
||||
ContainerUtil.addAll(args, GradleConstants.INIT_SCRIPT_CMD_OPTION, path);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.warn("Can't generate IJ gradle test filter init script", e);
|
||||
}
|
||||
finally {
|
||||
StreamUtil.closeStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String renderInitScript(@NotNull String testArgs) {
|
||||
InputStream stream = Init.class.getResourceAsStream("/org/jetbrains/plugins/gradle/tooling/internal/init/testFilterInit.gradle");
|
||||
try {
|
||||
if (stream == null) {
|
||||
LOG.error("Can't get test filter init script template");
|
||||
return null;
|
||||
}
|
||||
String script = FileUtil.loadTextAndClose(stream).replaceFirst(Pattern.quote("${TEST_NAME_INCLUDES}"), Matcher.quoteReplacement(testArgs));
|
||||
final File tempFile = writeToFileGradleInitScript(script, "ijtestinit");
|
||||
return tempFile.getAbsolutePath();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.warn("Can't generate IJ gradle test filter init script", e);
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
StreamUtil.closeStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user