Move IC tests to compiler
Fixing IC after moving it from Gradle to the compiler in commit f40a3eff20
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
@@ -15,5 +17,6 @@
|
||||
<orderEntry type="module" module-name="frontend" />
|
||||
<orderEntry type="module" module-name="frontend.java" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="library" name="junit-4.12" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
+2
-2
@@ -499,10 +499,10 @@ class IncrementalJvmCompilerRunner(
|
||||
}
|
||||
}
|
||||
|
||||
internal var K2JVMCompilerArguments.destinationAsFile: File
|
||||
var K2JVMCompilerArguments.destinationAsFile: File
|
||||
get() = File(destination)
|
||||
set(value) { destination = value.path }
|
||||
|
||||
internal var K2JVMCompilerArguments.classpathAsList: List<File>
|
||||
var K2JVMCompilerArguments.classpathAsList: List<File>
|
||||
get() = classpath.split(File.pathSeparator).map(::File)
|
||||
set(value) { classpath = value.joinToString(separator = File.pathSeparator, transform = { it.path }) }
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental.snapshots
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
internal class FileSnapshot(
|
||||
class FileSnapshot(
|
||||
val file: File,
|
||||
val length: Long,
|
||||
val hash: ByteArray
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.io.File
|
||||
|
||||
internal object FileSnapshotExternalizer : DataExternalizer<FileSnapshot> {
|
||||
object FileSnapshotExternalizer : DataExternalizer<FileSnapshot> {
|
||||
override fun save(out: DataOutput, value: FileSnapshot) {
|
||||
out.writeUTF(value.file.canonicalPath)
|
||||
out.writeLong(value.length)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.incremental.storage.PathStringDescriptor
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
internal class FileSnapshotMap(storageFile: File) : BasicStringMap<FileSnapshot>(storageFile, PathStringDescriptor, FileSnapshotExternalizer) {
|
||||
class FileSnapshotMap(storageFile: File) : BasicStringMap<FileSnapshot>(storageFile, PathStringDescriptor, FileSnapshotExternalizer) {
|
||||
override fun dumpValue(value: FileSnapshot): String =
|
||||
value.toString()
|
||||
|
||||
|
||||
+2
-2
@@ -18,11 +18,11 @@ package org.jetbrains.kotlin.incremental.snapshots
|
||||
|
||||
import java.io.File
|
||||
|
||||
internal interface FileSnapshotProvider {
|
||||
interface FileSnapshotProvider {
|
||||
operator fun get(file: File): FileSnapshot
|
||||
}
|
||||
|
||||
internal class SimpleFileSnapshotProviderImpl : FileSnapshotProvider {
|
||||
class SimpleFileSnapshotProviderImpl : FileSnapshotProvider {
|
||||
override fun get(file: File): FileSnapshot {
|
||||
val length = file.length()
|
||||
val hash = file.md5
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import java.io.File
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
abstract class TestWithWorkingDir {
|
||||
protected var workingDir: File by Delegates.notNull()
|
||||
private set
|
||||
|
||||
@Before
|
||||
open fun setUp() {
|
||||
workingDir = FileUtil.createTempDirectory(this.javaClass.simpleName, null)
|
||||
}
|
||||
|
||||
@After
|
||||
open fun tearDown() {
|
||||
workingDir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
+19
-5
@@ -1,7 +1,21 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import org.jetbrains.kotlin.gradle.incremental.dumpBuildLog
|
||||
import org.jetbrains.kotlin.gradle.incremental.parseTestBuildLog
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -9,7 +23,7 @@ import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
|
||||
@RunWith(Parameterized::class)
|
||||
class BuildLogParserParametrizedIT : BaseGradleIT() {
|
||||
class BuildLogParserParametrizedTest {
|
||||
|
||||
@Parameterized.Parameter
|
||||
@JvmField
|
||||
@@ -40,7 +54,7 @@ class BuildLogParserParametrizedIT : BaseGradleIT() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TEST_ROOT = File(resourcesRootFile, "buildLogsParserData")
|
||||
private val TEST_ROOT = File("compiler/incremental-compilation-impl/testData/buildLogsParserData")
|
||||
private val LOG_FILE_NAME = "build.log"
|
||||
private val EXPECTED_PARSED_LOG_FILE_NAME = "expected.txt"
|
||||
|
||||
+4
-5
@@ -22,15 +22,14 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.com.intellij.util.containers.HashMap
|
||||
import org.jetbrains.kotlin.gradle.incremental.parseTestBuildLog
|
||||
import com.intellij.util.containers.HashMap
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@RunWith(Parameterized::class)
|
||||
class KotlinStandaloneIncrementalCompilationTest : TestWithWorkingDir() {
|
||||
@@ -104,7 +103,7 @@ class KotlinStandaloneIncrementalCompilationTest : TestWithWorkingDir() {
|
||||
|
||||
val rebuildExpectedToSucceed = buildLogSteps.last().compileSucceeded
|
||||
val rebuildSucceeded = rebuildResult.exitCode == ExitCode.OK
|
||||
assertEquals(rebuildExpectedToSucceed, rebuildSucceeded, "Rebuild exit code differs from incremental exit code")
|
||||
assertEquals("Rebuild exit code differs from incremental exit code", rebuildExpectedToSucceed, rebuildSucceeded)
|
||||
|
||||
if (rebuildSucceeded) {
|
||||
assertEqualDirectories(outDir, rebuildOutDir, forgiveExtraFiles = rebuildSucceeded)
|
||||
@@ -185,7 +184,7 @@ class KotlinStandaloneIncrementalCompilationTest : TestWithWorkingDir() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val jpsResourcesPath = File("../../../jps-plugin/testData/incremental")
|
||||
private val jpsResourcesPath = File("jps-plugin/testData/incremental")
|
||||
private val ignoredDirs = setOf(File(jpsResourcesPath, "cacheVersionChanged"),
|
||||
File(jpsResourcesPath, "changeIncrementalOption"),
|
||||
File(jpsResourcesPath, "custom"),
|
||||
+19
-3
@@ -1,6 +1,22 @@
|
||||
package org.jetbrains.kotlin.gradle.incremental
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import java.io.File
|
||||
|
||||
private const val BEGIN_COMPILED_FILES = "Compiling files:"
|
||||
@@ -83,7 +99,7 @@ fun parseTestBuildLog(file: File): List<BuildStep> {
|
||||
}
|
||||
}
|
||||
|
||||
// used in integration tests
|
||||
// used in gradle integration tests
|
||||
@Suppress("unused")
|
||||
fun dumpBuildLog(buildSteps: Iterable<BuildStep>): String {
|
||||
val sb = StringBuilder()
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/inline/InlineGetKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/inlineGet.kt
|
||||
End of files
|
||||
Marked as dirty by Kotlin:
|
||||
src/UsageVal.kt
|
||||
src/UsageVar.kt
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Cleaning output files:
|
||||
out/production/module/usage/UsageVal.class
|
||||
out/production/module/usage/UsageVar.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/UsageVal.kt
|
||||
src/UsageVar.kt
|
||||
End of files
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Exit code: NOTHING_DONE
|
||||
------------------------------------------
|
||||
|
||||
================ Step #2 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/inline/InlineSetKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/inlineSet.kt
|
||||
End of files
|
||||
Marked as dirty by Kotlin:
|
||||
src/UsageVar.kt
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Cleaning output files:
|
||||
out/production/module/usage/UsageVar.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/UsageVar.kt
|
||||
End of files
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Exit code: NOTHING_DONE
|
||||
------------------------------------------
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Compiling files:
|
||||
src/UsageVal.kt
|
||||
src/UsageVar.kt
|
||||
src/inlineGet.kt
|
||||
End of files
|
||||
------------------------------------------
|
||||
|
||||
================ Step #2 =================
|
||||
|
||||
Compiling files:
|
||||
src/UsageVar.kt
|
||||
src/inlineSet.kt
|
||||
End of files
|
||||
------------------------------------------
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module1/META-INF/module1.kotlin_module
|
||||
out/production/module1/a/A.class
|
||||
out/production/module1/a/ClassAnnotation.class
|
||||
out/production/module1/a/FileAnnotation.class
|
||||
out/production/module1/a/Module1_aKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
module1/src/module1_a.kt
|
||||
End of files
|
||||
Marked as dirty by Kotlin:
|
||||
module2/src/module2_b.kt
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Exit code: NOTHING_DONE
|
||||
------------------------------------------
|
||||
Cleaning output files:
|
||||
out/production/module2/META-INF/module2.kotlin_module
|
||||
out/production/module2/b/B.class
|
||||
out/production/module2/b/Module2_bKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
module2/src/module2_b.kt
|
||||
End of files
|
||||
Exit code: ABORT
|
||||
------------------------------------------
|
||||
COMPILATION FAILED
|
||||
Cannot access 'FileAnnotation': it is internal in 'a'
|
||||
Cannot access 'A': it is internal in 'a'
|
||||
Cannot access 'FileAnnotation': it is internal in 'a'
|
||||
Cannot access 'ClassAnnotation': it is internal in 'a'
|
||||
Cannot access 'ClassAnnotation': it is internal in 'a'
|
||||
Function effective visibility 'public' should be the same or less permissive than its parameter type effective visibility 'internal'
|
||||
Cannot access 'A': it is internal in 'a'
|
||||
Cannot access 'a': it is internal in 'a'
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Compiling files:
|
||||
module1/src/module1_a.kt
|
||||
module2/src/module2_b.kt
|
||||
End of files
|
||||
------------------------------------------
|
||||
COMPILATION FAILED
|
||||
Cannot access 'FileAnnotation': it is internal in 'a'
|
||||
Cannot access 'A': it is internal in 'a'
|
||||
Cannot access 'FileAnnotation': it is internal in 'a'
|
||||
Cannot access 'ClassAnnotation': it is internal in 'a'
|
||||
Cannot access 'ClassAnnotation': it is internal in 'a'
|
||||
Function effective visibility 'public' should be the same or less permissive than its parameter type effective visibility 'internal'
|
||||
Cannot access 'A': it is internal in 'a'
|
||||
Cannot access 'a': it is internal in 'a'
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/JavaClass.class
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/UsageKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/usage.kt
|
||||
End of files
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Compiling files:
|
||||
src/JavaClass.java
|
||||
End of files
|
||||
Exit code: NOTHING_DONE
|
||||
------------------------------------------
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Compiling files:
|
||||
src/usage.kt
|
||||
src/JavaClass.java
|
||||
End of files
|
||||
------------------------------------------
|
||||
+2
-2
@@ -2,8 +2,8 @@ package org.jetbrains.kotlin.jps
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||
import org.jetbrains.kotlin.gradle.incremental.BuildStep
|
||||
import org.jetbrains.kotlin.gradle.incremental.parseTestBuildLog
|
||||
import org.jetbrains.kotlin.incremental.BuildStep
|
||||
import org.jetbrains.kotlin.incremental.parseTestBuildLog
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.*
|
||||
import org.junit.Assume
|
||||
import java.io.File
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package org.jetbrains.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import java.io.File
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
abstract class TestWithWorkingDir {
|
||||
protected var workingDir: File by Delegates.notNull()
|
||||
private set
|
||||
|
||||
@Before
|
||||
open fun setUp() {
|
||||
workingDir = FileUtil.createTempDirectory(this.javaClass.simpleName, null)
|
||||
}
|
||||
|
||||
@After
|
||||
open fun tearDown() {
|
||||
workingDir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user