提交 7e2c2ef6 编写于 作者: D Dmitry Jemerov

restore compilation after rebase of dropping external annotations; fix affected tests

上级 c41aefe2
......@@ -27,20 +27,10 @@ import java.io.File
import java.util.*
class KotlinCompilerAdapter : Javac13() {
var externalAnnotations: Path? = null
var moduleName: String? = null
var additionalArguments: MutableList<Commandline.Argument> = ArrayList(0)
fun createExternalAnnotations(): Path {
if (externalAnnotations == null) {
externalAnnotations = Path(getProject())
}
return externalAnnotations!!.createPath()
}
fun createCompilerArg(): Commandline.Argument {
val argument = Commandline.Argument()
additionalArguments.add(argument)
......@@ -70,8 +60,6 @@ class KotlinCompilerAdapter : Javac13() {
// it is constructed only of sources which are newer than classes with the same name
kotlinc.src = javac.srcdir
kotlinc.externalAnnotations = externalAnnotations
if (moduleName == null) {
moduleName = javac.defaultModuleName
}
......
......@@ -121,8 +121,6 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
configuration.addJvmClasspathRoots(getClasspath(paths, arguments))
configuration.addAll(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, getAnnotationsPath(paths, arguments))
configuration.put(JVMConfigurationKeys.MODULE_NAME, arguments.moduleName ?: JvmAbi.DEFAULT_MODULE_NAME)
if (arguments.module == null && arguments.freeArgs.isEmpty() && !arguments.version) {
......@@ -287,17 +285,6 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
}
return classpath
}
private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
val annotationsPath = arrayListOf<File>()
if (arguments.annotations != null) {
annotationsPath.addAll(arguments.annotations.split(File.pathSeparatorChar).map { File(it) })
}
if (!arguments.noJdkAnnotations) {
annotationsPath.add(paths.getJdkAnnotationsPath())
}
return annotationsPath
}
}
}
......
......@@ -3,4 +3,3 @@ name
outputDir=out
sources=[]
classpath=[]
annotations=[]
......@@ -17,12 +17,10 @@
package org.jetbrains.kotlin.test
public enum class ConfigurationKind(
public val withJdkAnnotations: Boolean,
public val withRuntime: Boolean,
public val withReflection: Boolean
) {
JDK_ONLY(withJdkAnnotations = false, withRuntime = false, withReflection = false),
JDK_AND_ANNOTATIONS(withJdkAnnotations = true, withRuntime = false, withReflection = false),
NO_KOTLIN_REFLECT(withJdkAnnotations = true, withRuntime = true, withReflection = false),
ALL(withJdkAnnotations = true, withRuntime = true, withReflection = true),
JDK_ONLY(withRuntime = false, withReflection = false),
NO_KOTLIN_REFLECT(withRuntime = true, withReflection = false),
ALL(withRuntime = true, withReflection = true),
}
......@@ -27,7 +27,5 @@ public interface Module {
public fun getClasspathRoots(): List<String>
public fun getAnnotationsRoots(): List<String>
public fun getJavaSourceRoots(): List<String>
}
......@@ -18,13 +18,7 @@ package org.jetbrains.kotlin.idea.test;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.AnnotationOrderRootType;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.test.JetTestUtils;
......@@ -43,13 +37,7 @@ public class PluginTestCaseBase {
@NotNull
private static Sdk getSdk(String sdkHome) {
Sdk sdk = JavaSdk.getInstance().createJdk("JDK", sdkHome, true);
SdkModificator modificator = sdk.getSdkModificator();
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(getJdkAnnotationsJar());
assert file != null;
modificator.addRoot(JarFileSystem.getInstance().getJarRootForLocalFile(file), AnnotationOrderRootType.getInstance());
modificator.commitChanges();
return sdk;
return JavaSdk.getInstance().createJdk("JDK", sdkHome, true);
}
@NotNull
......@@ -64,15 +52,6 @@ public class PluginTestCaseBase {
return getSdk(javaHome);
}
@NotNull
public static File getJdkAnnotationsJar() {
File jdkAnnotations = new File(JetTestUtils.getHomeDirectory(), "dist/kotlinc/lib/kotlin-jdk-annotations.jar");
if (!jdkAnnotations.exists()) {
throw new RuntimeException("Kotlin JDK annotations jar not found; please run 'ant dist' to build it");
}
return jdkAnnotations;
}
public static boolean isAllFilesPresentTest(@NotNull String testName) {
return StringUtil.startsWithIgnoreCase(testName, "allFilesPresentIn");
}
......
......@@ -2,6 +2,6 @@ import java.net.URI
// WITH_RUNTIME
fun foo(): URI {
fun foo(): URI? {
return java.io.File("x").toURI()
}
\ No newline at end of file
......@@ -2,4 +2,4 @@
import java.io.DataInputStream
import java.io.InputStream
class C(p0: InputStream) : DataInputStream<caret>(p0)
class C(p0: InputStream?) : DataInputStream<caret>(p0)
......@@ -2,4 +2,4 @@
// ACTION: Add constructor parameters from ArrayList(Int)
import java.util.ArrayList
class C(p0: MutableCollection<out String>) : ArrayList<String><caret>(p0)
class C(p0: MutableCollection<out String>?) : ArrayList<String><caret>(p0)
......@@ -246,7 +246,6 @@ public object KotlinCompilerRunner {
with(settings) {
module = moduleFile.absolutePath
noStdlib = true
noJdkAnnotations = true
noJdk = true
}
}
......
......@@ -21,7 +21,6 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import kotlin.CollectionsKt;
import kotlin.io.FilesKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......@@ -140,15 +139,5 @@ public class KotlinBuilderModuleScriptGenerator {
return result;
}
@NotNull
private static JpsSdkType getSdkType(@NotNull JpsModule module) {
for (JpsDependencyElement dependency : module.getDependenciesList().getDependencies()) {
if (dependency instanceof JpsSdkDependency) {
return ((JpsSdkDependency) dependency).getSdkType();
}
}
return JpsJavaSdkType.INSTANCE;
}
private KotlinBuilderModuleScriptGenerator() {}
}
......@@ -36,11 +36,11 @@ import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.org.objectweb.asm.ClassWriter
import java.io.IOException
import java.lang.ref.WeakReference
val DEFAULT_ANNOTATIONS = "org.jebrains.kotlin.gradle.defaultAnnotations"
import java.io.File
import java.util.HashSet
val DEFAULT_ANNOTATIONS = "org.jebrains.kotlin.gradle.defaultAnnotations"
val ANNOTATIONS_PLUGIN_NAME = "org.jetbrains.kotlin.kapt"
abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCompile() {
......
......@@ -97,6 +97,9 @@ public class K2JVMCompileMojo extends KotlinCompileMojoBase<K2JVMCompilerArgumen
getLog().info("Classes directory is " + output);
arguments.destination = output;
arguments.moduleName = moduleName;
getLog().info("Module name is " + moduleName);
try {
Args.parse(arguments, ArrayUtil.toStringArray(args));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册