Skip to content

Commit

Permalink
Add kotlin.test library to build distribution and provide for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Mashkov committed Dec 18, 2015
1 parent 7aae2bd commit b57d2ff
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public static File runtimeJarForTests() {
return assertExists(new File("dist/kotlinc/lib/kotlin-runtime.jar"));
}

@NotNull
public static File kotlinTestJarForTests() {
return assertExists(new File("dist/kotlinc/lib/kotlin-test.jar"));
}

@NotNull
public static File reflectJarForTests() {
return assertExists(new File("dist/kotlinc/lib/kotlin-reflect.jar"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ else if (jdkKind == TestJdkKind.ANDROID_API) {

if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests());
}
if (configurationKind.getWithReflection()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.reflectJarForTests());
Expand Down
3 changes: 3 additions & 0 deletions compiler/util/src/org/jetbrains/kotlin/utils/KotlinPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public interface KotlinPaths {
@NotNull
File getReflectPath();

@NotNull
File getKotlinTestPath();

@NotNull
File getRuntimeSourcesPath();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public File getReflectPath() {
return getLibraryFile(PathUtil.KOTLIN_JAVA_REFLECT_JAR);
}

@NotNull
@Override
public File getKotlinTestPath() {
return getLibraryFile(PathUtil.KOTLIN_TEST_JAR);
}

@NotNull
@Override
public File getRuntimeSourcesPath() {
Expand Down
1 change: 1 addition & 0 deletions compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class PathUtil {
public static final String ANDROID_SDK_ANNOTATIONS_JAR = "kotlin-android-sdk-annotations.jar";
public static final String KOTLIN_JAVA_RUNTIME_JAR = "kotlin-runtime.jar";
public static final String KOTLIN_JAVA_REFLECT_JAR = "kotlin-reflect.jar";
public static final String KOTLIN_TEST_JAR = "kotlin-test.jar";
public static final String KOTLIN_JAVA_RUNTIME_SRC_JAR = "kotlin-runtime-sources.jar";
public static final String KOTLIN_COMPILER_JAR = "kotlin-compiler.jar";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/
public class ConfigLibraryUtil {
private static final String DEFAULT_JAVA_RUNTIME_LIB_NAME = "JAVA_RUNTIME_LIB_NAME";
private static final String DEFAULT_KOTLIN_TEST_LIB_NAME = "KOTLIN_TEST_LIB_NAME";
private static final String DEFAULT_KOTLIN_JS_STDLIB_NAME = "KOTLIN_JS_STDLIB_NAME";

private ConfigLibraryUtil() {
Expand All @@ -67,6 +68,8 @@ public static void configureKotlinJsRuntimeAndSdk(Module module, Sdk sdk) {
public static void configureKotlinRuntime(Module module) {
addLibrary(getKotlinRuntimeLibEditor(DEFAULT_JAVA_RUNTIME_LIB_NAME, PathUtil.getKotlinPathsForDistDirectory().getRuntimePath()),
module);
addLibrary(getKotlinRuntimeLibEditor(DEFAULT_KOTLIN_TEST_LIB_NAME, PathUtil.getKotlinPathsForDistDirectory().getKotlinTestPath()),
module);
}

public static void configureKotlinJsRuntime(Module module) {
Expand All @@ -76,6 +79,7 @@ public static void configureKotlinJsRuntime(Module module) {

public static void unConfigureKotlinRuntime(Module module) {
removeLibrary(module, DEFAULT_JAVA_RUNTIME_LIB_NAME);
removeLibrary(module, DEFAULT_KOTLIN_TEST_LIB_NAME);
}

public static void unConfigureKotlinRuntimeAndSdk(Module module, Sdk sdk) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public abstract class AbstractIncrementalJpsTest(
moduleNames = nameToModule.keySet()
}
AbstractKotlinJpsBuildTestCase.addKotlinRuntimeDependency(myProject)
AbstractKotlinJpsBuildTestCase.addKotlinTestRuntimeDependency(myProject)
return moduleNames
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ static JpsLibrary addKotlinRuntimeDependency(@NotNull JpsProject project) {
return addKotlinRuntimeDependency(JpsJavaDependencyScope.COMPILE, project.getModules(), false);
}

static JpsLibrary addKotlinTestRuntimeDependency(@NotNull JpsProject project) {
return addDependency(JpsJavaDependencyScope.COMPILE, project.getModules(), false, "kotlin-test", PathUtil.getKotlinPathsForDistDirectory().getKotlinTestPath());
}

static JpsLibrary addKotlinJavaScriptStdlibDependency(@NotNull JpsProject project) {
return addKotlinJavaScriptStdlibDependency(JpsJavaDependencyScope.COMPILE, project.getModules(), false);
}
Expand Down
2 changes: 2 additions & 0 deletions resources/kotlinManifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ manifest.impl.title.kotlin.preloader=Kotlin Preloader

manifest.impl.title.kotlin.runner=Kotlin Runner

manifest.impl.title.kotlin.test=Kotlin Reflect Sources

manifest.impl.title.kotlin.jdk.annotations=Kotlin Compiler JDK Annotations
manifest.impl.title.kotlin.android.sdk.annotations=Kotlin Compiler Android SDK Annotations

0 comments on commit b57d2ff

Please sign in to comment.