Skip to content

Commit

Permalink
[JVM_IR] Enable KotlinAgainstJava and remaining JavaAgainstKotlin test.
Browse files Browse the repository at this point in the history
  • Loading branch information
madsager authored and udalov committed Nov 4, 2020
1 parent 24345bb commit 2c8c473
Show file tree
Hide file tree
Showing 8 changed files with 1,784 additions and 471 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// IGNORE_BACKEND: JVM, JVM_IR

package test

interface KotlinInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.cli.common.modules.ModuleBuilder
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.javac.JavacWrapper
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
Expand Down Expand Up @@ -90,6 +91,7 @@ abstract class AbstractCompileKotlinAgainstJavaTest : TestCaseWithTmpdir() {
aptMode: Boolean
): Boolean {
val environment = createEnvironmentWithMockJdkAndIdeaAnnotations(disposable)
updateConfiguration(environment.configuration)
environment.configuration.put(JVMConfigurationKeys.USE_JAVAC, true)
environment.configuration.put(JVMConfigurationKeys.COMPILE_JAVA, true)
val ktFiles = kotlinFiles.map { kotlinFile: File ->
Expand All @@ -115,6 +117,8 @@ abstract class AbstractCompileKotlinAgainstJavaTest : TestCaseWithTmpdir() {
return JavacWrapper.getInstance(environment.project).use { it.compile(outDir) }
}

open fun updateConfiguration(configuration: CompilerConfiguration) {}

companion object {
// Do not render parameter names because there are test cases where classes inherit from JDK collections,
// and some versions of JDK have debug information in the class files (including parameter names), and some don't
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/

package org.jetbrains.kotlin.jvm.compiler.ir

import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.jvm.compiler.AbstractCompileKotlinAgainstJavaTest

abstract class AbstractIrCompileKotlinAgainstJavaTest : AbstractCompileKotlinAgainstJavaTest() {
override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import org.jetbrains.kotlin.ir.AbstractIrSourceRangesTestCase
import org.jetbrains.kotlin.ir.AbstractIrTextTestCase
import org.jetbrains.kotlin.jvm.compiler.*
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileJavaAgainstKotlinTest
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileKotlinAgainstJavaTest
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrLoadJavaTest
import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJavaUsingJavacTest
import org.jetbrains.kotlin.lexer.kdoc.AbstractKDocLexerTest
Expand Down Expand Up @@ -329,8 +330,18 @@ fun main(args: Array<String>) {
}

testClass<AbstractCompileKotlinAgainstJavaTest> {
model("compileKotlinAgainstJava", testClassName = "WithAPT", testMethod = "doTestWithAPT")
model("compileKotlinAgainstJava", testClassName = "WithoutAPT", testMethod = "doTestWithoutAPT")
model(
"compileKotlinAgainstJava",
testClassName = "WithAPT",
testMethod = "doTestWithAPT",
targetBackend = TargetBackend.JVM
)
model(
"compileKotlinAgainstJava",
testClassName = "WithoutAPT",
testMethod = "doTestWithoutAPT",
targetBackend = TargetBackend.JVM
)
}

testClass<AbstractCompileKotlinAgainstKotlinTest> {
Expand Down Expand Up @@ -438,7 +449,27 @@ fun main(args: Array<String>) {
testMethod = "doTestWithoutJavac",
targetBackend = TargetBackend.JVM_IR
)
//model("compileJavaAgainstKotlin", testClassName = "WithJavac", testMethod = "doTestWithJavac", targetBackend = TargetBackend.JVM_IR)
model(
"compileJavaAgainstKotlin",
testClassName = "WithJavac",
testMethod = "doTestWithJavac",
targetBackend = TargetBackend.JVM_IR
)
}

testClass<AbstractIrCompileKotlinAgainstJavaTest> {
model(
"compileKotlinAgainstJava",
testClassName = "WithAPT",
testMethod = "doTestWithAPT",
targetBackend = TargetBackend.JVM_IR
)
model(
"compileKotlinAgainstJava",
testClassName = "WithoutAPT",
testMethod = "doTestWithoutAPT",
targetBackend = TargetBackend.JVM_IR
)
}

testClass<AbstractIrCompileKotlinAgainstKotlinTest> {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2c8c473

Please sign in to comment.