From 3d1b6fb83c2e1ddf4096c5f73120ff1a1a67a26c Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 10 Apr 2019 21:16:42 +0200 Subject: [PATCH] Minor. Fix AS32 compilation --- .../kotlin/test/KotlinTestUtils.java.as32 | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 index 9e77f27a75f..9ecdfc1f196 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as32 @@ -90,6 +90,8 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static com.intellij.openapi.application.PathManager.PROPERTY_CONFIG_PATH; +import static com.intellij.openapi.application.PathManager.PROPERTY_SYSTEM_PATH; import static org.jetbrains.kotlin.test.InTextDirectivesUtils.*; public class KotlinTestUtils { @@ -109,6 +111,19 @@ public class KotlinTestUtils { private static final List filesToDelete = new ArrayList<>(); + // It's important that this is not created per test, but rather per process. + public static final String IDEA_SYSTEM_PATH; + + static { + try { + IDEA_SYSTEM_PATH = tmpDirForReusableFolder("idea-system").getPath(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** * Syntax: * @@ -424,7 +439,7 @@ public class KotlinTestUtils { } @NotNull - public static File tmpDirForReusableLibrary(String name) throws IOException { + public static File tmpDirForReusableFolder(String name) throws IOException { return normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, "", true)); } @@ -1272,4 +1287,9 @@ public class KotlinTestUtils { // Several extension if name contains another dot return name.indexOf('.', firstDotIndex + 1) != -1; } + + public static void setIdeaSystemPathProperties() { + System.setProperty(PROPERTY_SYSTEM_PATH, IDEA_SYSTEM_PATH); + System.setProperty(PROPERTY_CONFIG_PATH, IDEA_SYSTEM_PATH + "/config"); + } }