From ff2c45373296e83fb678ba51aa740b787cfdcae9 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Tue, 9 Jun 2020 13:20:35 +0300 Subject: [PATCH] 202: Fix compilation Original commit: ff7576f8e4137733dd11c8acbdec5e703d5fd2e2 --- .../jps/build/KotlinJpsBuildTest.kt.202 | 58 ++++++++----------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 index 125ffde238d..3ac350767d3 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt.202 @@ -58,7 +58,6 @@ import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.JvmCodegenUtil import org.jetbrains.kotlin.config.IncrementalCompilation import org.jetbrains.kotlin.config.KotlinCompilerVersion.TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY -import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.incremental.withIC import org.jetbrains.kotlin.jps.build.KotlinJpsBuildTestBase.LibraryDependency.* @@ -464,6 +463,29 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() { buildAllModules().assertSuccessful() } + fun testPureJavaProject() { + initProject(JVM_FULL_RUNTIME) + + fun build() { + var someFilesCompiled = false + + buildCustom(CanceledStatus.NULL, TestProjectBuilderLogger(), BuildResult()) { + project.setTestingContext(TestingContext(LookupTracker.DO_NOTHING, object : TestingBuildLogger { + override fun compilingFiles(files: Collection, allRemovedFilesFiles: Collection) { + someFilesCompiled = true + } + })) + } + + assertFalse("Kotlin builder should return early if there are no Kotlin files", someFilesCompiled) + } + + build() + + rename("${workDir}/src/Test.java", "Test1.java") + build() + } + fun testKotlinJavaProject() { doTestWithRuntime() } @@ -626,40 +648,6 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() { result.assertSuccessful() } - /* - * Here we're checking that enabling inference in IDE doesn't affect compilation via JPS - * - * the following two tests are connected: - * - testKotlinProjectWithEnabledNewInferenceInIDE checks that project is compiled when new inference is enabled only in IDE - * - this is done via project component - * - testKotlinProjectWithErrorsBecauseOfNewInference checks that project isn't compiled when new inference is enabled in the compiler - * - * So, if the former will fail => option affects JPS compilation, it's bad. Also, if the latter test fails => test is useless as it's - * compiled with new and old inference. - * - */ - fun testKotlinProjectWithEnabledNewInferenceInIDE() { - initProject(JVM_MOCK_RUNTIME) - val module = myProject.modules.single() - val args = module.kotlinCompilerArguments - args.languageVersion = LanguageVersion.KOTLIN_1_3.versionString - myProject.kotlinCommonCompilerArguments = args - - buildAllModules().assertSuccessful() - } - - fun testKotlinProjectWithErrorsBecauseOfNewInference() { - initProject(JVM_MOCK_RUNTIME) - val module = myProject.modules.single() - val args = module.kotlinCompilerArguments - args.newInference = true - myProject.kotlinCommonCompilerArguments = args - - val result = buildAllModules() - result.assertFailed() - result.checkErrors() - } - private fun createKotlinJavaScriptLibraryArchive() { val jarFile = File(workDir, KOTLIN_JS_LIBRARY_JAR) try {