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