Fix path util to return dist paths in tests
This commit is contained in:
committed by
Nikolay Krasko
parent
71be3bcec5
commit
d2b948dc2c
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.utils;
|
package org.jetbrains.jet.utils;
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.application.PathManager;
|
import com.intellij.openapi.application.PathManager;
|
||||||
import com.intellij.openapi.util.SystemInfo;
|
import com.intellij.openapi.util.SystemInfo;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
@@ -43,7 +44,9 @@ public class PathUtil {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static KotlinPaths getKotlinPathsForIdeaPlugin() {
|
public static KotlinPaths getKotlinPathsForIdeaPlugin() {
|
||||||
return new KotlinPathsFromHomeDir(getCompilerPathForIdeaPlugin());
|
return ApplicationManager.getApplication().isUnitTestMode()
|
||||||
|
? getKotlinPathsForDistDirectory()
|
||||||
|
: new KotlinPathsFromHomeDir(getCompilerPathForIdeaPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.jet.plugin.compiler;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.compiler.impl.javaCompiler.OutputItemImpl;
|
import com.intellij.compiler.impl.javaCompiler.OutputItemImpl;
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
|
||||||
import com.intellij.openapi.compiler.CompileContext;
|
import com.intellij.openapi.compiler.CompileContext;
|
||||||
import com.intellij.openapi.compiler.TranslatingCompiler;
|
import com.intellij.openapi.compiler.TranslatingCompiler;
|
||||||
import com.intellij.openapi.module.Module;
|
import com.intellij.openapi.module.Module;
|
||||||
@@ -46,9 +45,7 @@ public final class TranslatingCompilerUtils {
|
|||||||
VirtualFile mainOutput = compileContext.getModuleOutputDirectory(module);
|
VirtualFile mainOutput = compileContext.getModuleOutputDirectory(module);
|
||||||
VirtualFile outputDirectoryForTests = compileContext.getModuleOutputDirectoryForTests(module);
|
VirtualFile outputDirectoryForTests = compileContext.getModuleOutputDirectoryForTests(module);
|
||||||
File outputDir = tests ? toNullableIoFile(outputDirectoryForTests) : toNullableIoFile(mainOutput);
|
File outputDir = tests ? toNullableIoFile(outputDirectoryForTests) : toNullableIoFile(mainOutput);
|
||||||
KotlinPaths kotlinPaths = ApplicationManager.getApplication().isUnitTestMode()
|
KotlinPaths kotlinPaths = PathUtil.getKotlinPathsForIdeaPlugin();
|
||||||
? PathUtil.getKotlinPathsForDistDirectory()
|
|
||||||
: PathUtil.getKotlinPathsForIdeaPlugin();
|
|
||||||
return CompilerEnvironment.getEnvironmentFor(kotlinPaths, outputDir);
|
return CompilerEnvironment.getEnvironmentFor(kotlinPaths, outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,12 +106,12 @@ public class KotlinJavaModuleConfigurator extends KotlinWithLibraryConfigurator
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public File getExistedJarFile() {
|
public File getExistedJarFile() {
|
||||||
return assertFileExists(getKotlinPaths().getRuntimePath());
|
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getRuntimePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getExistedSourcesJarFile() {
|
public File getExistedSourcesJarFile() {
|
||||||
return assertFileExists(getKotlinPaths().getRuntimeSourcesPath());
|
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getRuntimeSourcesPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copySourcesToPathFromLibrary(@NotNull Library library) {
|
public void copySourcesToPathFromLibrary(@NotNull Library library) {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class KotlinJsModuleConfigurator extends KotlinWithLibraryConfigurator {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public File getExistedJarFile() {
|
public File getExistedJarFile() {
|
||||||
return assertFileExists(getKotlinPaths().getJsLibJarPath());
|
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getJsLibJarPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,7 +125,7 @@ public class KotlinJsModuleConfigurator extends KotlinWithLibraryConfigurator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public File getJsFile() {
|
public File getJsFile() {
|
||||||
return assertFileExists(getKotlinPaths().getJsLibJsPath());
|
return assertFileExists(PathUtil.getKotlinPathsForIdeaPlugin().getJsLibJsPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean needToChooseJsFilePath(@NotNull Project project) {
|
private static boolean needToChooseJsFilePath(@NotNull Project project) {
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.plugin.JetPluginUtil;
|
import org.jetbrains.jet.plugin.JetPluginUtil;
|
||||||
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
|
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
|
||||||
import org.jetbrains.jet.utils.KotlinPaths;
|
|
||||||
import org.jetbrains.jet.utils.PathUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -417,12 +415,6 @@ public abstract class KotlinWithLibraryConfigurator implements KotlinProjectConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static KotlinPaths getKotlinPaths() {
|
|
||||||
return ApplicationManager.getApplication().isUnitTestMode()
|
|
||||||
? PathUtil.getKotlinPathsForDistDirectory()
|
|
||||||
: PathUtil.getKotlinPathsForIdeaPlugin();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getPathToCopyFileTo(
|
private String getPathToCopyFileTo(
|
||||||
@NotNull Project project,
|
@NotNull Project project,
|
||||||
|
|||||||
Reference in New Issue
Block a user