Skip to content

Commit

Permalink
Use JDK annotations downloaded from a KAnnotator build
Browse files Browse the repository at this point in the history
  • Loading branch information
abreslav committed Feb 21, 2014
1 parent 48df541 commit ff762a4
Show file tree
Hide file tree
Showing 180 changed files with 31 additions and 35,784 deletions.
4 changes: 1 addition & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@
</target>

<target name="jdkAnnotations">
<pack_annotations jarfile="kotlin-jdk-annotations.jar"
annotationsdir="${basedir}/jdk-annotations"
title="${manifest.impl.title.kotlin.compiler.annotations.jdk}"/>
<copy file="dependencies/annotations/kotlin-jdk-annotations.jar" todir="${kotlin-home}/lib"/>
</target>

<target name="androidSdkAnnotations">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
package org.jetbrains.jet;

import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
import org.junit.Test;

public class CompileCompilerDependenciesTest {
@Test
public void packJdkAnnotations() {
ForTestPackJdkAnnotations.jdkAnnotationsForTests();
JetTestUtils.getJdkAnnotationsJar();
}

@Test
Expand Down
12 changes: 10 additions & 2 deletions compiler/tests/org/jetbrains/jet/JetTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.jetbrains.jet.cli.jvm.compiler.CliLightClassGenerationSupport;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
import org.jetbrains.jet.config.CommonConfigurationKeys;
import org.jetbrains.jet.config.CompilerConfiguration;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
Expand Down Expand Up @@ -272,6 +271,15 @@ public static File getAnnotationsJar() {
return new File(JetTestCaseBuilder.getHomeDirectory(), "compiler/testData/mockJDK/jre/lib/annotations.jar");
}

@NotNull
public static File getJdkAnnotationsJar() {
File jdkAnnotations = new File("dependencies/annotations/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 void mkdirs(File file) throws IOException {
if (file.isDirectory()) {
return;
Expand Down Expand Up @@ -370,7 +378,7 @@ public static CompilerConfiguration compilerConfigurationForTests(@NotNull Confi
configuration.addAll(CLASSPATH_KEY, extraClasspath);

if (configurationKind == ALL || configurationKind == JDK_AND_ANNOTATIONS) {
configuration.add(ANNOTATIONS_PATH_KEY, ForTestPackJdkAnnotations.jdkAnnotationsForTests());
configuration.add(ANNOTATIONS_PATH_KEY, getJdkAnnotationsJar());
}

return configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private static void compileKotlinToJvm(
"-noStdlib",
"-noJdkAnnotations",
"-suppress", "warnings",
"-annotations", "./jdk-annotations",
"-annotations", JetTestUtils.getJdkAnnotationsJar().getAbsolutePath(),
"-classpath", classPath
);
if (exitCode != ExitCode.OK) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestCase;
import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.cli.common.ExitCode;
import org.jetbrains.jet.cli.jvm.K2JVMCompiler;
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
Expand All @@ -42,7 +42,7 @@ public void testSmokeWithCompilerJar() throws IOException {

try {
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests();
File jdkAnnotations = JetTestUtils.getJdkAnnotationsJar();
File resultJar = new File(tempDir, "result.jar");
ExitCode rv = new K2JVMCompiler().exec(System.out,
"-module", JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.kts",
Expand Down Expand Up @@ -78,7 +78,7 @@ public void testSmokeWithCompilerOutput() throws IOException {
try {
File out = new File(tempDir, "out");
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests();
File jdkAnnotations = JetTestUtils.getJdkAnnotationsJar();
ExitCode exitCode = new K2JVMCompiler()
.exec(System.out, "-src", JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.kt",
"-output", out.getAbsolutePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected JetCoreEnvironment createEnvironment() {
@Override
protected void setUp() throws Exception {
super.setUp();
kotlinAnnotationsRoot = VirtualFileManager.getInstance().findFileByUrl("file://jdk-annotations");
kotlinAnnotationsRoot = VirtualFileManager.getInstance().findFileByUrl("jar://dependencies/annotations/kotlin-jdk-annotations.jar!/");
ideaAnnotationsRoot = VirtualFileManager.getInstance().findFileByUrl("jar://ideaSDK/lib/jdkAnnotations.jar!/");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected void tearDown() throws Exception {
}

public void testNoErrorsInAlternativeSignatures() {
List<FqName> affectedClasses = getAffectedClasses("file://jdk-annotations");
List<FqName> affectedClasses = getAffectedClasses("jar://dependencies/annotations/kotlin-jdk-annotations.jar!/");

Map<String, List<String>> errors = Maps.newLinkedHashMap();

Expand Down
4 changes: 2 additions & 2 deletions idea/tests/org/jetbrains/jet/plugin/PluginTestCaseBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
import org.jetbrains.jet.JetTestUtils;

import java.io.File;

Expand All @@ -44,7 +44,7 @@ public static String getTestDataPathBase() {
private static Sdk getSdk(String sdkHome) {
Sdk sdk = new JavaSdkImpl().createJdk("JDK", sdkHome, true);
SdkModificator modificator = sdk.getSdkModificator();
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(ForTestPackJdkAnnotations.jdkAnnotationsForTests());
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(JetTestUtils.getJdkAnnotationsJar());
assert file != null;
modificator.addRoot(JarFileSystem.getInstance().getJarRootForLocalFile(file), AnnotationOrderRootType.getInstance());
modificator.commitChanges();
Expand Down
25 changes: 0 additions & 25 deletions jdk-annotations/java/applet/annotations.xml

This file was deleted.

Loading

0 comments on commit ff762a4

Please sign in to comment.