summaryrefslogtreecommitdiff
path: root/plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt')
-rw-r--r--plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt161
1 files changed, 0 insertions, 161 deletions
diff --git a/plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt b/plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
deleted file mode 100644
index 289ef955ccc4..000000000000
--- a/plugins/kotlin/jps/jps-plugin/tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-package org.jetbrains.kotlin.jps.build
-
-import com.intellij.openapi.util.io.FileUtil
-import com.intellij.util.ThrowableRunnable
-import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
-import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
-import org.jetbrains.kotlin.config.LanguageVersion
-import org.jetbrains.kotlin.daemon.common.isDaemonEnabled
-import org.jetbrains.kotlin.idea.test.runAll
-import org.jetbrains.kotlin.jps.build.fixtures.EnableICFixture
-import org.jetbrains.kotlin.jps.model.kotlinCommonCompilerArguments
-import org.jetbrains.kotlin.jps.model.kotlinCompilerArguments
-import java.io.File
-import kotlin.reflect.KMutableProperty1
-
-class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() {
- private val enableICFixture = EnableICFixture()
-
- override fun setUp() {
- super.setUp()
- enableICFixture.setUp()
- }
-
- override fun tearDown() {
- runAll(
- ThrowableRunnable { enableICFixture.tearDown() },
- ThrowableRunnable { super.tearDown() }
- )
- }
-
- fun testKotlinJavaScriptChangePackage() {
- initProject(LibraryDependency.JS_STDLIB)
- buildAllModules().assertSuccessful()
-
- val class2Kt = File(workDir, "src/Class2.kt")
- val newClass2KtContent = class2Kt.readText().replace("package2", "package1")
- change(class2Kt.path, newClass2KtContent)
- buildAllModules().assertSuccessful()
- checkOutputFilesList(File(workDir, "out/production"))
- }
-
- fun testJpsDaemonIC() {
- fun testImpl() {
- assertTrue("Daemon was not enabled!", isDaemonEnabled())
-
- doTest()
- val module = myProject.modules[0]
- val mainKtClassFile = findFileInOutputDir(module, "MainKt.class")
- assertTrue("$mainKtClassFile does not exist!", mainKtClassFile.exists())
-
- val fooKt = File(workDir, "src/Foo.kt")
- change(fooKt.path, null)
- buildAllModules().assertSuccessful()
- assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Foo.kt")
-
- change(fooKt.path, "class Foo(val x: Int = 0)")
- buildAllModules().assertSuccessful()
- assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/main.kt", "src/Foo.kt")
- }
-
- withDaemon {
- withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") {
- testImpl()
- }
- }
- }
-
- fun testManyFiles() {
- doTest()
-
- val module = myProject.modules[0]
- assertFilesExistInOutput(module, "foo/MainKt.class", "boo/BooKt.class", "foo/Bar.class")
-
- checkWhen(touch("src/main.kt"), null, packageClasses("kotlinProject", "src/main.kt", "foo.MainKt"))
- checkWhen(touch("src/boo.kt"), null, packageClasses("kotlinProject", "src/boo.kt", "boo.BooKt"))
- checkWhen(touch("src/Bar.kt"), arrayOf("src/Bar.kt"), arrayOf(module("kotlinProject"), klass("kotlinProject", "foo.Bar")))
-
- checkWhen(
- del("src/main.kt"),
- pathsToCompile = null,
- pathsToDelete = packageClasses("kotlinProject", "src/main.kt", "foo.MainKt")
- )
- assertFilesExistInOutput(module, "boo/BooKt.class", "foo/Bar.class")
- assertFilesNotExistInOutput(module, "foo/MainKt.class")
-
- checkWhen(touch("src/boo.kt"), null, packageClasses("kotlinProject", "src/boo.kt", "boo.BooKt"))
- checkWhen(touch("src/Bar.kt"), null, arrayOf(module("kotlinProject"), klass("kotlinProject", "foo.Bar")))
- }
-
- fun testManyFilesForPackage() {
- doTest()
-
- val module = myProject.modules[0]
- assertFilesExistInOutput(module, "foo/MainKt.class", "boo/BooKt.class", "foo/Bar.class")
-
- checkWhen(touch("src/main.kt"), null, packageClasses("kotlinProject", "src/main.kt", "foo.MainKt"))
- checkWhen(touch("src/boo.kt"), null, packageClasses("kotlinProject", "src/boo.kt", "boo.BooKt"))
- checkWhen(
- touch("src/Bar.kt"),
- arrayOf("src/Bar.kt"),
- arrayOf(
- klass("kotlinProject", "foo.Bar"),
- packagePartClass("kotlinProject", "src/Bar.kt", "foo.MainKt"),
- module("kotlinProject")
- )
- )
-
- checkWhen(
- del("src/main.kt"),
- pathsToCompile = null,
- pathsToDelete = packageClasses("kotlinProject", "src/main.kt", "foo.MainKt")
- )
- assertFilesExistInOutput(module, "boo/BooKt.class", "foo/Bar.class")
-
- checkWhen(touch("src/boo.kt"), null, packageClasses("kotlinProject", "src/boo.kt", "boo.BooKt"))
- checkWhen(
- touch("src/Bar.kt"), null,
- arrayOf(
- klass("kotlinProject", "foo.Bar"),
- packagePartClass("kotlinProject", "src/Bar.kt", "foo.MainKt"),
- module("kotlinProject")
- )
- )
- }
-
- @WorkingDir("LanguageOrApiVersionChanged")
- fun testLanguageVersionChanged() {
- languageOrApiVersionChanged(CommonCompilerArguments::languageVersion)
- }
-
- @WorkingDir("LanguageOrApiVersionChanged")
- fun testApiVersionChanged() {
- languageOrApiVersionChanged(CommonCompilerArguments::apiVersion)
- }
-
- private fun languageOrApiVersionChanged(versionProperty: KMutableProperty1<CommonCompilerArguments, String?>) {
- initProject(LibraryDependency.JVM_MOCK_RUNTIME)
-
- assertEquals(1, myProject.modules.size)
- val module = myProject.modules.first()
- val args = module.kotlinCompilerArguments
-
- fun setVersion(newVersion: String) {
- versionProperty.set(args, newVersion)
- myProject.kotlinCommonCompilerArguments = args
- }
-
- assertNull(args.apiVersion)
- buildAllModules().assertSuccessful()
-
- setVersion(LanguageVersion.LATEST_STABLE.versionString)
- buildAllModules().assertSuccessful()
- assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME)
-
- setVersion(LanguageVersion.KOTLIN_1_5.versionString)
- buildAllModules().assertSuccessful()
- assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Bar.kt", "src/Foo.kt")
- }
-} \ No newline at end of file