Merge remote branch 'origin/master'
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<project name="Kotlin" default="dist">
|
||||
<property name="output" value="${basedir}/dist"/>
|
||||
<property name="build.number" value="snapshot"/>
|
||||
<property name="output.name" value="kotlin-${build.number}"/>
|
||||
|
||||
<path id="classpath">
|
||||
<fileset dir="${basedir}/ideaSDK" includes="*.jar"/>
|
||||
@@ -43,21 +44,17 @@
|
||||
<target name="jar" depends="compile">
|
||||
<jar destfile="${output}/kotlin-compiler.jar">
|
||||
<fileset dir="${output}/classes/compiler"/>
|
||||
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="jarRT,jar">
|
||||
<zip destfile="${output}/kotlin-${build.number}.zip">
|
||||
<zipfileset prefix="kotlin-${build.number}/bin" filemode="755">
|
||||
<include name="${basedir}/compile/cli/bin/*"/>
|
||||
</zipfileset>
|
||||
<zipfileset prefix="kotlin-${build.number}/examples" includes="examples/src/**"/>
|
||||
<zipfileset prefix="kotlin-${build.number}/lib">
|
||||
<include name="ideaSDK/*.jar"/>
|
||||
<include name="lib/*.jar"/>
|
||||
<include name="${output}/*.jar"/>
|
||||
</zipfileset>
|
||||
<zipfileset prefix="kotlin-${build.number}/examples" includes="examples/src/**"/>
|
||||
<zip destfile="${output}/${output.name}.zip">
|
||||
<zipfileset prefix="${output.name}/bin" filemode="755" dir="${basedir}/compiler/cli/bin"/>
|
||||
<zipfileset prefix="${output.name}/lib" dir="${basedir}/ideaSDK"/>
|
||||
<zipfileset prefix="${output.name}/lib" dir="${basedir}/lib"/>
|
||||
<zipfileset prefix="${output.name}/lib" dir="${output}" includes="*.jar"/>
|
||||
<zipfileset prefix="${output.name}/examples" dir="${basedir}/examples/src"/>
|
||||
</zip>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -27,7 +27,7 @@ if "%_TOOL_CLASSPATH%"=="" (
|
||||
for /d %%f in ("%_KOTLIN_HOME%\lib\*") do call :add_cpath "%%f"
|
||||
)
|
||||
|
||||
"%_JAVACMD%" %_JAVA_OPTS% cp "%_TOOL_CLASSPATH%" org.jetbrains.jet.cli.KotlinCompiler %*
|
||||
"%_JAVACMD%" %_JAVA_OPTS% -cp "%_TOOL_CLASSPATH%" org.jetbrains.jet.cli.KotlinCompiler %*
|
||||
goto end
|
||||
|
||||
rem ##########################################################################
|
||||
|
||||
@@ -56,6 +56,10 @@ public class KotlinCompiler {
|
||||
environment.registerFileType(JetFileType.INSTANCE, "kt");
|
||||
environment.registerParserDefinition(new JetParserDefinition());
|
||||
VirtualFile vFile = environment.getLocalFileSystem().findFileByPath(args [0]);
|
||||
if (vFile == null) {
|
||||
System.out.print("File not found: " + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
Project project = environment.getProject();
|
||||
GenerationState generationState = new GenerationState(project, false);
|
||||
@@ -64,6 +68,10 @@ public class KotlinCompiler {
|
||||
if (psiFile instanceof JetFile) {
|
||||
namespaces.add(((JetFile) psiFile).getRootNamespace());
|
||||
}
|
||||
else {
|
||||
System.out.print("Not a Kotlin file: " + vFile.getPath());
|
||||
return;
|
||||
}
|
||||
|
||||
BindingContext bindingContext = AnalyzingUtils.getInstance(JavaDefaultImports.JAVA_DEFAULT_IMPORTS).analyzeNamespaces(project, namespaces, JetControlFlowDataTraceFactory.EMPTY);
|
||||
|
||||
@@ -92,6 +100,7 @@ public class KotlinCompiler {
|
||||
File target = new File(vFile.getParent().getPath(), file);
|
||||
try {
|
||||
FileUtil.writeToFile(target, factory.asBytes(file));
|
||||
System.out.println("Generated classfile: " + target);
|
||||
} catch (IOException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user