stdlib included in to cli-compilation

This commit is contained in:
Alex Tkachman
2011-12-25 12:28:00 +02:00
parent f4704adc3f
commit 9f4cd37dbb
2 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -46,7 +46,7 @@
<jar destfile="${output}/kotlin-runtime.jar"> <jar destfile="${output}/kotlin-runtime.jar">
<fileset dir="${output}/classes/runtime"/> <fileset dir="${output}/classes/runtime"/>
<!--<fileset dir="${output}/classes/stdlib"/>--> <!--<fileset dir="${output}/classes/stdlib"/>-->
<fileset dir="${basedir}" includes="stdlib/ktSrc/*.*"/> <fileset dir="${basedir}" includes="stdlib/ktSrc/**/*"/>
</jar> </jar>
</target> </target>
@@ -37,6 +37,9 @@ public class CompileSession {
} }
public void addSources(String path) { public void addSources(String path) {
if(path == null)
return;
VirtualFile vFile = myEnvironment.getLocalFileSystem().findFileByPath(path); VirtualFile vFile = myEnvironment.getLocalFileSystem().findFileByPath(path);
if (vFile == null) { if (vFile == null) {
myErrors.add("File/directory not found: " + path); myErrors.add("File/directory not found: " + path);
@@ -68,15 +71,15 @@ public class CompileSession {
public void addSources(VirtualFile vFile) { public void addSources(VirtualFile vFile) {
if (vFile.isDirectory()) { if (vFile.isDirectory()) {
for (VirtualFile virtualFile : vFile.getChildren()) { for (VirtualFile virtualFile : vFile.getChildren()) {
if (virtualFile.getFileType() == JetFileType.INSTANCE) { addSources(virtualFile);
addSources(virtualFile);
}
} }
} }
else { else {
PsiFile psiFile = PsiManager.getInstance(myEnvironment.getProject()).findFile(vFile); if (vFile.getFileType() == JetFileType.INSTANCE) {
if (psiFile instanceof JetFile) { PsiFile psiFile = PsiManager.getInstance(myEnvironment.getProject()).findFile(vFile);
mySourceFileNamespaces.add(((JetFile) psiFile).getRootNamespace()); if (psiFile instanceof JetFile) {
mySourceFileNamespaces.add(((JetFile) psiFile).getRootNamespace());
}
} }
} }
} }
@@ -121,8 +124,9 @@ public class CompileSession {
else { else {
final File runtimeJarPath = CompileEnvironment.getRuntimeJarPath(); final File runtimeJarPath = CompileEnvironment.getRuntimeJarPath();
if (runtimeJarPath != null && runtimeJarPath.exists()) { if (runtimeJarPath != null && runtimeJarPath.exists()) {
// todo VirtualFile runtimeJar = myEnvironment.getLocalFileSystem().findFileByPath(runtimeJarPath.getAbsolutePath());
throw new UnsupportedOperationException("Loading of stdlib sources from jar"); VirtualFile jarRoot = myEnvironment.getJarFileSystem().findFileByPath(runtimeJar.getPath() + "!/stdlib/ktSrc");
addSources(jarRoot);
} }
else { else {
return false; return false;