new compiler mode: stdlib
include jdk-headers, do not include runtime
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compileStdlib" depends="jar,jarLang">
|
||||
<target name="compileStdlib" depends="jar,jarLang,compileRT">
|
||||
<mkdir dir="${output}/classes/stdlib"/>
|
||||
<java classname="org.jetbrains.jet.cli.KotlinCompiler" failonerror="true" fork="true">
|
||||
<classpath>
|
||||
@@ -63,6 +63,10 @@
|
||||
<arg value="${basedir}/libraries/stdlib/src"/>
|
||||
<arg value="-output"/>
|
||||
<arg value="${output}/classes/stdlib"/>
|
||||
<arg value="-mode"/>
|
||||
<arg value="stdlib"/>
|
||||
<arg value="-classpath"/>
|
||||
<arg value="${output}/classes/runtime"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ public class CompileEnvironment {
|
||||
ensureRuntime(environment);
|
||||
} else if (mode == CompilerSpecialMode.JDK_HEADERS) {
|
||||
ensureJdkRuntime(environment);
|
||||
} else if (mode == CompilerSpecialMode.STDLIB) {
|
||||
ensureJdkRuntime(environment);
|
||||
} else if (mode == CompilerSpecialMode.BUILTINS) {
|
||||
// nop
|
||||
} else {
|
||||
|
||||
+6
@@ -23,4 +23,10 @@ public enum CompilerSpecialMode {
|
||||
REGULAR,
|
||||
BUILTINS,
|
||||
JDK_HEADERS,
|
||||
STDLIB,
|
||||
;
|
||||
|
||||
public boolean includeJdkHeaders() {
|
||||
return this == REGULAR || this == STDLIB;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class PsiClassFinderForJvm implements PsiClassFinder {
|
||||
@PostConstruct
|
||||
public void initialize() {
|
||||
this.altClassFinder = new AltClassFinder(project,
|
||||
compilerSpecialMode == CompilerSpecialMode.REGULAR ? PathUtil.getAltHeadersRoots() : Collections.<VirtualFile>emptyList());
|
||||
compilerSpecialMode.includeJdkHeaders() ? PathUtil.getAltHeadersRoots() : Collections.<VirtualFile>emptyList());
|
||||
this.javaSearchScope = new DelegatingGlobalSearchScope(GlobalSearchScope.allScope(project)) {
|
||||
@Override
|
||||
public boolean contains(VirtualFile file) {
|
||||
|
||||
@@ -98,7 +98,11 @@ public class ForTestCompileStdlib {
|
||||
}
|
||||
|
||||
private static void compileKotlinPartOfStdlib(File destdir) throws IOException {
|
||||
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(System.err, "-output", destdir.getPath(), "-src", "./libraries/stdlib/src", "-stdlib", destdir.getAbsolutePath());
|
||||
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(System.err,
|
||||
"-output", destdir.getPath(),
|
||||
"-src", "./libraries/stdlib/src",
|
||||
"-mode", "stdlib",
|
||||
"-classpath", "out/production/runtime");
|
||||
if (exitCode != KotlinCompiler.ExitCode.OK) {
|
||||
throw new IllegalStateException("stdlib for test compilation failed: " + exitCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user