Replaced jdk-headers with jdk-annotations everywhere.
This commit is contained in:
@@ -18,11 +18,10 @@ package org.jetbrains.jet;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileBuiltins;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@@ -36,8 +35,8 @@ public class CompileCompilerDependenciesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compileJdkHeaders() {
|
||||
ForTestCompileJdkHeaders.jdkHeadersForTests();
|
||||
public void packJdkAnnotations() {
|
||||
ForTestPackJdkAnnotations.jdkAnnotationsForTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,7 +52,7 @@ public class CompileCompilerDependenciesTest {
|
||||
return new CompilerDependencies(
|
||||
compilerSpecialMode,
|
||||
compilerSpecialMode.includeJdk() ? (mockJdk ? JetTestUtils.findMockJdkRtJar() : CompilerDependencies.findRtJar()) : null,
|
||||
compilerSpecialMode.includeJdkHeaders() ? ForTestCompileJdkHeaders.jdkHeadersForTests() : null,
|
||||
compilerSpecialMode.includeJdkAnnotations() ? ForTestPackJdkAnnotations.jdkAnnotationsForTests() : null,
|
||||
compilerSpecialMode.includeKotlinRuntime() ? ForTestCompileRuntime.runtimeJarForTests() : null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2012 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.jet.codegen.forTestCompile;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.cli.common.ExitCode;
|
||||
import org.jetbrains.jet.cli.jvm.K2JVMCompiler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class ForTestCompileJdkHeaders {
|
||||
|
||||
private ForTestCompileJdkHeaders() {
|
||||
}
|
||||
|
||||
private static class JdkHeaders extends ForTestCompileSomething {
|
||||
|
||||
JdkHeaders() {
|
||||
super("jdkHeaders");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCompile(@NotNull File classesDir) throws Exception {
|
||||
ExitCode exitCode = new K2JVMCompiler().exec(
|
||||
System.err, "-output", classesDir.getPath(), "-src", "./jdk-headers/src", "-mode", "jdkHeaders");
|
||||
if (exitCode != ExitCode.OK) {
|
||||
throw new IllegalStateException("jdk headers compilation failed: " + exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
private static final JdkHeaders jdkHeaders = new JdkHeaders();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File jdkHeadersForTests() {
|
||||
return ForTestCompileSomething.ACTUALLY_COMPILE ? JdkHeaders.jdkHeaders.getJarFile() : new File("dist/kotlinc/lib/alt/kotlin-jdk-headers.jar");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -80,7 +80,7 @@ abstract class ForTestCompileSomething {
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyToJar(File root, JarOutputStream os) throws IOException {
|
||||
static void copyToJar(File root, JarOutputStream os) throws IOException {
|
||||
Stack<Pair<String, File>> toCopy = new Stack<Pair<String, File>>();
|
||||
toCopy.add(new Pair<String, File>("", root));
|
||||
while (!toCopy.empty()) {
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2010-2012 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.jet.codegen.forTestCompile;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Stack;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class ForTestPackJdkAnnotations {
|
||||
|
||||
private ForTestPackJdkAnnotations() {
|
||||
}
|
||||
|
||||
private static File jarFile = null;
|
||||
|
||||
private static File getJarFile() {
|
||||
if (jarFile == null) {
|
||||
try {
|
||||
File tmpDir = JetTestUtils.tmpDir("runtimejar");
|
||||
jarFile = new File(tmpDir, "runtime.jar");
|
||||
FileOutputStream annotationsJar = new FileOutputStream(jarFile);
|
||||
try {
|
||||
JarOutputStream jarOutputStream = new JarOutputStream(new BufferedOutputStream(annotationsJar));
|
||||
try {
|
||||
ForTestCompileSomething.copyToJar(new File("./jdk-annotations"), jarOutputStream);
|
||||
}
|
||||
finally {
|
||||
jarOutputStream.close();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
annotationsJar.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File jdkAnnotationsForTests() {
|
||||
return ForTestCompileSomething.ACTUALLY_COMPILE ? getJarFile() : new File("dist/kotlinc/lib/alt/kotlin-jdk-annotations.jar");
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.jet.cli.common.ExitCode;
|
||||
import org.jetbrains.jet.cli.jvm.K2JVMCompiler;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
import org.junit.Assert;
|
||||
@@ -44,13 +44,13 @@ public class CompileEnvironmentTest extends TestCase {
|
||||
|
||||
try {
|
||||
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
|
||||
File jdkHeaders = ForTestCompileJdkHeaders.jdkHeadersForTests();
|
||||
File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests();
|
||||
File resultJar = new File(tempDir, "result.jar");
|
||||
ExitCode rv = new K2JVMCompiler().exec(System.out,
|
||||
"-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts",
|
||||
"-jar", resultJar.getAbsolutePath(),
|
||||
"-stdlib", stdlib.getAbsolutePath(),
|
||||
"-jdkHeaders", jdkHeaders.getAbsolutePath());
|
||||
"-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts",
|
||||
"-jar", resultJar.getAbsolutePath(),
|
||||
"-stdlib", stdlib.getAbsolutePath(),
|
||||
"-jdkAnnotations", jdkAnnotations.getAbsolutePath());
|
||||
Assert.assertEquals("compilation completed with non-zero code", ExitCode.OK, rv);
|
||||
FileInputStream fileInputStream = new FileInputStream(resultJar);
|
||||
try {
|
||||
@@ -78,10 +78,10 @@ public class CompileEnvironmentTest extends TestCase {
|
||||
try {
|
||||
File out = new File(tempDir, "out");
|
||||
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
|
||||
File jdkHeaders = ForTestCompileJdkHeaders.jdkHeadersForTests();
|
||||
File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests();
|
||||
ExitCode exitCode = new K2JVMCompiler()
|
||||
.exec(System.out, "-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt", "-output",
|
||||
out.getAbsolutePath(), "-stdlib", stdlib.getAbsolutePath(), "-jdkHeaders", jdkHeaders.getAbsolutePath());
|
||||
out.getAbsolutePath(), "-stdlib", stdlib.getAbsolutePath(), "-jdkAnnotations", jdkAnnotations.getAbsolutePath());
|
||||
Assert.assertEquals(ExitCode.OK, exitCode);
|
||||
assertEquals(1, out.listFiles().length);
|
||||
assertEquals(1, out.listFiles()[0].listFiles().length);
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.jet.jvm.compiler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
@@ -36,7 +36,6 @@ import org.junit.Assert;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
@@ -80,7 +79,8 @@ public class JavaDescriptorResolverTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
|
||||
public void testResolveJdkHeaderClassWithoutJdk() {
|
||||
JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(myTestRootDisposable, new CompilerDependencies(CompilerSpecialMode.IDEA, null, ForTestCompileJdkHeaders.jdkHeadersForTests(), null));
|
||||
JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(myTestRootDisposable, new CompilerDependencies(CompilerSpecialMode.IDEA, null, ForTestPackJdkAnnotations
|
||||
.jdkAnnotationsForTests(), null));
|
||||
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
jetCoreEnvironment.getCompilerDependencies(), jetCoreEnvironment.getProject());
|
||||
|
||||
Reference in New Issue
Block a user