diff --git a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt index 33f946e31f5..1765dfd15b2 100644 --- a/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt +++ b/ant/src/org/jetbrains/kotlin/ant/Kotlin2JvmTask.kt @@ -26,7 +26,7 @@ import java.io.File.separator class Kotlin2JvmTask : KotlinCompilerBaseTask() { override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler" - var includeRuntime: Boolean = true + var includeRuntime: Boolean = false var moduleName: String? = null var noReflect: Boolean = false diff --git a/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.log.expected b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.log.expected new file mode 100644 index 00000000000..de2e3d06fa4 --- /dev/null +++ b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.log.expected @@ -0,0 +1,16 @@ +OUT: +Buildfile: [TestData]/build.xml + +test1: + [kotlinc] Compiling [[TestData]/test.kt] => [[Temp]/test.jar] + +test2: + [kotlinc] Compiling [[TestData]/test.kt] => [[Temp]/test.jar] + +test3: + [kotlinc] Compiling [[TestData]/test.kt] => [[Temp]/test.jar] + +BUILD SUCCESSFUL +Total time: [time] + +Return code: 0 diff --git a/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.xml b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.xml new file mode 100644 index 00000000000..11e264852f5 --- /dev/null +++ b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/build.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/test.kt b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/test.kt new file mode 100644 index 00000000000..700dece245f --- /dev/null +++ b/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/test.kt @@ -0,0 +1,14 @@ +import java.io.File +import java.util.jar.JarFile + +fun main(args: Array) { + val jar = File(args[0]) + // if "includeRuntime" is specified to be true + var specifiedBeTrue = args[1].toBoolean() + for (entry in JarFile(jar).entries()) { + if (!specifiedBeTrue && entry.name.startsWith("kotlin/")) { + println("Error: Kotlin runtime is expected to be excluded if the attribute \"includeRuntime\" is not specified to be true") + break; + } + } +} diff --git a/compiler/testData/integration/ant/jvm/kt11995/build.xml b/compiler/testData/integration/ant/jvm/kt11995/build.xml index 48b401de372..0ec394417e4 100644 --- a/compiler/testData/integration/ant/jvm/kt11995/build.xml +++ b/compiler/testData/integration/ant/jvm/kt11995/build.xml @@ -2,7 +2,7 @@ - + diff --git a/compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java index 42359965240..6b1d770aa8c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/integration/AntTaskTestGenerated.java @@ -39,6 +39,11 @@ public class AntTaskTestGenerated extends AbstractAntTaskTest { runTest("compiler/testData/integration/ant/jvm/doNotFailOnError/"); } + @TestMetadata("doNotIncludeRuntimeByDefault") + public void testDoNotIncludeRuntimeByDefault() throws Exception { + runTest("compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/"); + } + @TestMetadata("failOnErrorByDefault") public void testFailOnErrorByDefault() throws Exception { runTest("compiler/testData/integration/ant/jvm/failOnErrorByDefault/");