Fix compilation of ExternalSystem tests in legacy branches
This commit is contained in:
+7
-1
@@ -256,11 +256,13 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
|
||||
assertOrderedElementsAreEqual(actual, Arrays.asList(expected));
|
||||
}
|
||||
|
||||
/* Unused but available in ESITC@IDEA
|
||||
protected void assertModuleOutputs(String moduleName, String... outputs) {
|
||||
String[] outputPaths = ContainerUtil.map2Array(CompilerPaths.getOutputPaths(new Module[]{getModule(moduleName)}), String.class,
|
||||
s -> getAbsolutePath(s));
|
||||
assertUnorderedElementsAreEqual(outputPaths, outputs);
|
||||
}
|
||||
*/
|
||||
|
||||
protected void assertModuleOutput(String moduleName, String output, String testOutput) {
|
||||
CompilerModuleExtension e = getCompilerExtension(moduleName);
|
||||
@@ -378,11 +380,13 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
|
||||
assertOrderedElementsAreEqual(predicate, collectModuleDepsNames(moduleName, clazz), expectedDeps);
|
||||
}
|
||||
|
||||
/* Unused but available in ESITC@IDEA
|
||||
protected void assertProductionOnTestDependencies(String moduleName, String... expectedDeps) {
|
||||
assertOrderedElementsAreEqual(collectModuleDepsNames(
|
||||
moduleName, entry -> entry instanceof ModuleOrderEntry && ((ModuleOrderEntry)entry).isProductionOnTestDependency()
|
||||
), expectedDeps);
|
||||
}
|
||||
*/
|
||||
|
||||
protected void assertModuleModuleDepScope(String moduleName, String depName, DependencyScope... scopes) {
|
||||
List<ModuleOrderEntry> deps = getModuleModuleDeps(moduleName, depName);
|
||||
@@ -591,7 +595,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
|
||||
final Ref<Couple<String>> error = Ref.create();
|
||||
ImportSpec importSpec = createImportSpec();
|
||||
ExternalProjectRefreshCallback callback = importSpec.getCallback();
|
||||
if (callback == null || callback instanceof ImportSpecBuilder.DefaultProjectRefreshCallback) {
|
||||
if (callback == null || ExternalSystemTestCaseBunch.isDefaultRefreshCallback(callback)) {
|
||||
importSpec = new TestImportSpecBuilder(importSpec)
|
||||
.setCreateEmptyContentRoots(projectSettings.isCreateEmptyContentRootDirectories())
|
||||
.callback(new ExternalProjectRefreshCallback() {
|
||||
@@ -744,6 +748,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
|
||||
return ModuleRootManager.getInstance(getModule(module));
|
||||
}
|
||||
|
||||
/* Unused but available in ESITC@IDEA
|
||||
protected void ignoreData(BooleanFunction<DataNode<?>> booleanFunction, final boolean ignored) {
|
||||
final ExternalProjectInfo externalProjectInfo = ProjectDataManagerImpl.getInstance().getExternalProjectData(
|
||||
myProject, getExternalSystemId(), getCurrentExternalProjectSettings().getExternalProjectPath());
|
||||
@@ -758,6 +763,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest
|
||||
}
|
||||
ServiceManager.getService(ProjectDataManager.class).importData(projectDataNode, myProject, true);
|
||||
}
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
private <T> List<T> getModuleDep(@NotNull String moduleName, @NotNull String depName, @NotNull Class<T> clazz) {
|
||||
|
||||
+1
-14
@@ -77,9 +77,6 @@ import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public abstract class ExternalSystemTestCase extends UsefulTestCase {
|
||||
|
||||
private static final BiPredicate<Object, Object> EQUALS_PREDICATE = (t, u) -> Objects.equals(t, u);
|
||||
@@ -425,17 +422,7 @@ public abstract class ExternalSystemTestCase extends UsefulTestCase {
|
||||
}
|
||||
|
||||
private void build(Object[] buildableElements) {
|
||||
Promise<ProjectTaskManager.Result> promise;
|
||||
if (buildableElements instanceof Module[]) {
|
||||
promise = ProjectTaskManager.getInstance(myProject).build((Module[])buildableElements);
|
||||
}
|
||||
else if (buildableElements instanceof Artifact[]) {
|
||||
promise = ProjectTaskManager.getInstance(myProject).build((Artifact[])buildableElements);
|
||||
}
|
||||
else {
|
||||
throw new AssertionError("Unsupported buildableElements: " + Arrays.toString(buildableElements));
|
||||
}
|
||||
edt(() -> PlatformTestUtil.waitForPromise(promise));
|
||||
ExternalSystemTestCaseBunch.build(buildableElements, myProject);
|
||||
}
|
||||
|
||||
private void compile(@NotNull CompileScope scope) {
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight.gradle;
|
||||
|
||||
import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.task.ProjectTaskManager;
|
||||
import com.intellij.testFramework.EdtTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.jetbrains.concurrency.Promise;
|
||||
import java.util.Arrays;
|
||||
|
||||
//BUNCH: 192
|
||||
class ExternalSystemTestCaseBunch {
|
||||
|
||||
protected static boolean isDefaultRefreshCallback(Object callback) {
|
||||
return callback instanceof ImportSpecBuilder.DefaultProjectRefreshCallback;
|
||||
}
|
||||
|
||||
protected static void build(Object[] buildableElements, Project myProject) {
|
||||
Promise<ProjectTaskManager.Result> promise;
|
||||
if (buildableElements instanceof Module[]) {
|
||||
promise = ProjectTaskManager.getInstance(myProject).build((Module[])buildableElements);
|
||||
}
|
||||
else if (buildableElements instanceof Artifact[]) {
|
||||
promise = ProjectTaskManager.getInstance(myProject).build((Artifact[])buildableElements);
|
||||
}
|
||||
else {
|
||||
throw new AssertionError("Unsupported buildableElements: " + Arrays.toString(buildableElements));
|
||||
}
|
||||
EdtTestUtil.runInEdtAndWait(() -> PlatformTestUtil.waitForPromise(promise));
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight.gradle;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.task.ProjectTaskManager;
|
||||
|
||||
//BUNCH 193
|
||||
class ExternalSystemTestCaseBunch {
|
||||
|
||||
protected static boolean isDefaultRefreshCallback(Object callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void build(Object[] buildableElements, Project myProject) {
|
||||
if (buildableElements instanceof Module[]) {
|
||||
ProjectTaskManager.getInstance(myProject).build((Module[])buildableElements);
|
||||
}
|
||||
else if (buildableElements instanceof Artifact[]) {
|
||||
ProjectTaskManager.getInstance(myProject).build((Artifact[])buildableElements);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user