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