developer option to exclude sources
to compile stdlib
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
<mkdir dir="${output}/classes/stdlib"/>
|
||||
<java classname="org.jetbrains.jet.cli.KotlinCompiler">
|
||||
<classpath refid="classpath.kotlin"/>
|
||||
<arg value="-excludeStdlib"/>
|
||||
<arg value="-src"/>
|
||||
<arg value="${basedir}/stdlib/ktSrc"/>
|
||||
<arg value="-output"/>
|
||||
|
||||
@@ -337,10 +337,12 @@ public class CompileEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean compileBunchOfSources(String sourceFileOrDir, String jar, String outputDir, boolean includeRuntime) {
|
||||
public boolean compileBunchOfSources(String sourceFileOrDir, String jar, String outputDir, boolean includeRuntime, boolean includeSources) {
|
||||
CompileSession session = new CompileSession(myEnvironment);
|
||||
session.addSources(sourceFileOrDir);
|
||||
session.addStdLibSources(false);
|
||||
if (includeSources) {
|
||||
session.addStdLibSources(false);
|
||||
}
|
||||
|
||||
String mainClass = null;
|
||||
for (JetFile file : session.getSourceFileNamespaces()) {
|
||||
|
||||
@@ -25,6 +25,8 @@ public class KotlinCompiler {
|
||||
public String module;
|
||||
@Argument(value = "includeRuntime", description = "include Kotlin runtime in to resulting jar")
|
||||
public boolean includeRuntime;
|
||||
@Argument(value = "excludeStdlib", description = "do not load stdlib (to compile stdlib itself)")
|
||||
public boolean excludeStdlib;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -59,7 +61,7 @@ public class KotlinCompiler {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (!environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime)) {
|
||||
if (!environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime, !arguments.excludeStdlib)) {
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user