diff --git a/compiler/cli/cli.iml b/compiler/cli/cli.iml
index 87b178e8745..224a2eeb8d3 100644
--- a/compiler/cli/cli.iml
+++ b/compiler/cli/cli.iml
@@ -13,6 +13,7 @@
+
diff --git a/compiler/cli/src/org/jetbrains/jet/cli/KDocProcessor.java b/compiler/cli/src/org/jetbrains/jet/cli/KDocProcessor.java
new file mode 100644
index 00000000000..ff6b81b56f0
--- /dev/null
+++ b/compiler/cli/src/org/jetbrains/jet/cli/KDocProcessor.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.jet.cli;
+
+import org.jetbrains.jet.compiler.JetFileProcessor;
+import org.jetbrains.jet.lang.psi.JetDeclaration;
+import org.jetbrains.jet.lang.psi.JetFile;
+import org.jetbrains.jet.lang.resolve.java.AnalyzerFacade;
+
+import java.util.List;
+
+/**
+ */
+public class KDocProcessor implements JetFileProcessor {
+
+ private final String outputDir;
+
+ public KDocProcessor(String outputDir) {
+ this.outputDir = outputDir;
+ }
+
+ @Override
+ public void processFiles(List sources) {
+ // TODO fire up the KDoc processor here...
+ }
+}
diff --git a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java
index 4c67e34f756..90b7e381997 100644
--- a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java
+++ b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java
@@ -47,6 +47,9 @@ public class KotlinCompiler {
@Argument(value = "output", description = "output directory")
public String outputDir;
+ @Argument(value = "docOutput", description = "KDoc output directory")
+ public String docOutputDir;
+
@Argument(value = "jar", description = "jar file name")
public String jar;
@@ -124,6 +127,10 @@ public class KotlinCompiler {
environment.setErrorStream(errStream);
}
+ if (arguments.docOutputDir != null) {
+ environment.getMyEnvironment().getFileProcessors().add(new KDocProcessor(arguments.docOutputDir));
+ }
+
if (arguments.stdlib != null) {
environment.setStdlib(arguments.stdlib);
}
diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java
index 1f6237429aa..1404bc105cf 100644
--- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java
+++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java
@@ -415,4 +415,8 @@ public class CompileEnvironment {
throw new RuntimeException(e);
}
}
+
+ public JetCoreEnvironment getMyEnvironment() {
+ return myEnvironment;
+ }
}
diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java
index 9c2c15aa12c..228171a8f47 100644
--- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java
+++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java
@@ -17,6 +17,7 @@
package org.jetbrains.jet.compiler;
import com.google.common.base.Predicates;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiErrorElement;
@@ -198,8 +199,17 @@ public class CompileSession {
@NotNull
public ClassFileFactory generate() {
- GenerationState generationState = new GenerationState(myEnvironment.getProject(), ClassBuilderFactory.BINARIES, myFileNameTransformer);
+ Project project = myEnvironment.getProject();
+ GenerationState generationState = new GenerationState(project, ClassBuilderFactory.BINARIES, myFileNameTransformer);
generationState.compileCorrectFiles(myBindingContext, mySourceFiles);
- return generationState.getFactory();
+ ClassFileFactory answer = generationState.getFactory();
+
+ List fileProcessors = myEnvironment.getFileProcessors();
+ if (fileProcessors != null) {
+ for (JetFileProcessor processor : fileProcessors) {
+ processor.processFiles(getSourceFileNamespaces());
+ }
+ }
+ return answer;
}
}
diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/compiler/JetCoreEnvironment.java
index 651c6b1a4ff..303dc2b01fb 100644
--- a/compiler/cli/src/org/jetbrains/jet/compiler/JetCoreEnvironment.java
+++ b/compiler/cli/src/org/jetbrains/jet/compiler/JetCoreEnvironment.java
@@ -26,10 +26,15 @@ import org.jetbrains.jet.lang.types.JetStandardLibrary;
import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.plugin.compiler.PathUtil;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author yole
*/
public class JetCoreEnvironment extends JavaCoreEnvironment {
+ private List fileProcessors = new ArrayList();
+
public JetCoreEnvironment(Disposable parentDisposable) {
super(parentDisposable);
registerFileType(JetFileType.INSTANCE, "kt");
@@ -55,4 +60,12 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
public MockApplication getApplication() {
return myApplication;
}
+
+ public List getFileProcessors() {
+ return fileProcessors;
+ }
+
+ public void setFileProcessors(List fileProcessors) {
+ this.fileProcessors = fileProcessors;
+ }
}
diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/JetFileProcessor.java b/compiler/cli/src/org/jetbrains/jet/compiler/JetFileProcessor.java
new file mode 100644
index 00000000000..990623cb236
--- /dev/null
+++ b/compiler/cli/src/org/jetbrains/jet/compiler/JetFileProcessor.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.jet.compiler;
+
+import org.jetbrains.jet.lang.psi.JetFile;
+
+import java.util.List;
+
+/**
+ */
+public interface JetFileProcessor {
+ void processFiles(List sources);
+}