Extract reusable functionality from K2JVMCompiler, K2JVMCompilerArguments, CompilerEnvironmentConfiguration.
This commit is contained in:
@@ -20,7 +20,7 @@ fun main(args: Array<String?>): Unit {
|
||||
*/
|
||||
class KDocCompiler() : K2JVMCompiler() {
|
||||
|
||||
protected override fun configureEnvironment(configuration : CompileEnvironmentConfiguration?, arguments : K2JVMCompilerArguments?) {
|
||||
protected override fun configureEnvironment(configuration : CompileEnvironmentConfiguration, arguments : K2JVMCompilerArguments) {
|
||||
super.configureEnvironment(configuration, arguments)
|
||||
val coreEnvironment = configuration?.getEnvironment()
|
||||
if (coreEnvironment != null) {
|
||||
@@ -38,11 +38,11 @@ class KDocCompiler() : K2JVMCompiler() {
|
||||
}
|
||||
}
|
||||
|
||||
protected override fun createArguments() : K2JVMCompilerArguments? {
|
||||
protected override fun createArguments() : K2JVMCompilerArguments {
|
||||
return KDocArguments()
|
||||
}
|
||||
|
||||
protected override fun usage(target : PrintStream?) {
|
||||
protected override fun usage(target : PrintStream) {
|
||||
target?.println("Usage: KDocCompiler -docOutput <docOutputDir> [-output <outputDir>|-jar <jarFileName>] [-stdlib <path to runtime.jar>] [-src <filename or dirname>|-module <module file>] [-includeRuntime]");
|
||||
}
|
||||
}
|
||||
|
||||
+13
-15
@@ -7,20 +7,18 @@ import org.jetbrains.jet.cli.common.CompilerPluginContext
|
||||
*/
|
||||
class HtmlCompilerPlugin: CompilerPlugin {
|
||||
|
||||
public override fun processFiles(context: CompilerPluginContext?) {
|
||||
if (context != null) {
|
||||
val bindingContext = context.getContext()
|
||||
val files = context.getFiles()
|
||||
if (bindingContext != null && files != null) {
|
||||
if (files != null && bindingContext != null) {
|
||||
for (file in files) {
|
||||
if (file != null) {
|
||||
val visitor = HtmlKotlinVisitor()
|
||||
file.accept(visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val bindingContext = context.getContext()
|
||||
val files = context.getFiles()
|
||||
if (bindingContext != null && files != null) {
|
||||
if (files != null && bindingContext != null) {
|
||||
for (file in files) {
|
||||
if (file != null) {
|
||||
val visitor = HtmlKotlinVisitor()
|
||||
file.accept(visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-9
@@ -10,16 +10,14 @@ abstract class KModelCompilerPlugin: CompilerPlugin {
|
||||
public open var config: KDocConfig = KDocConfig()
|
||||
|
||||
|
||||
public override fun processFiles(context: CompilerPluginContext?) {
|
||||
if (context != null) {
|
||||
val bindingContext = context.getContext()
|
||||
val sources = context.getFiles()
|
||||
if (bindingContext != null && sources != null) {
|
||||
val model = KModel(bindingContext, config)
|
||||
model.load(sources)
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val bindingContext = context.getContext()
|
||||
val sources = context.getFiles()
|
||||
if (bindingContext != null && sources != null) {
|
||||
val model = KModel(bindingContext, config)
|
||||
model.load(sources)
|
||||
|
||||
processModel(model)
|
||||
}
|
||||
processModel(model)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user