diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Model/DocumentationBuildingVisitor.kt | 7 | ||||
-rw-r--r-- | src/Model/DocumentationModule.kt | 7 | ||||
-rw-r--r-- | src/main.kt | 13 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/Model/DocumentationBuildingVisitor.kt b/src/Model/DocumentationBuildingVisitor.kt index 2d293de2..b544b42b 100644 --- a/src/Model/DocumentationBuildingVisitor.kt +++ b/src/Model/DocumentationBuildingVisitor.kt @@ -4,7 +4,10 @@ import org.jetbrains.jet.lang.descriptors.* import org.jetbrains.jet.lang.resolve.name.* import org.jetbrains.jet.lang.resolve.* -class DocumentationBuildingVisitor(val context: BindingContext, private val worker: DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode>) +public data class DocumentationOptions(val includeNonPublic : Boolean = false) +class DocumentationBuildingVisitor(val context: BindingContext, + val options: DocumentationOptions, + private val worker: DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode>) : DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode> { private fun visitChildren(descriptors: Collection<DeclarationDescriptor>, data: DocumentationNode) { @@ -15,7 +18,7 @@ class DocumentationBuildingVisitor(val context: BindingContext, private val work private fun visitChild(descriptor: DeclarationDescriptor?, data: DocumentationNode) { if (descriptor != null && descriptor.isUserCode()) { - if (descriptor !is MemberDescriptor || descriptor.getVisibility().isPublicAPI()) { + if (options.includeNonPublic || descriptor !is MemberDescriptor || descriptor.getVisibility().isPublicAPI()) { descriptor.accept(this, data) } } diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt index 832eb9e3..78ebda04 100644 --- a/src/Model/DocumentationModule.kt +++ b/src/Model/DocumentationModule.kt @@ -13,12 +13,15 @@ public class DocumentationModule(name: String, val module: ModuleDescriptor) : D } } -fun BindingContext.createDocumentationModule(name: String, module: ModuleDescriptor, packages: Set<FqName>): DocumentationModule { +fun BindingContext.createDocumentationModule(name: String, + module: ModuleDescriptor, + packages: Set<FqName>, + options : DocumentationOptions = DocumentationOptions()): DocumentationModule { val documentationModule = DocumentationModule(name, module) val visitor = DocumentationNodeBuilder(this) for (packageName in packages) { val pkg = module.getPackage(packageName) - pkg!!.accept(DocumentationBuildingVisitor(this, visitor), documentationModule) + pkg!!.accept(DocumentationBuildingVisitor(this, options, visitor), documentationModule) } // TODO: Uncomment for resolve verification diff --git a/src/main.kt b/src/main.kt index 812e4830..2f2ac93c 100644 --- a/src/main.kt +++ b/src/main.kt @@ -5,7 +5,6 @@ import com.intellij.openapi.util.* import org.jetbrains.jet.cli.common.messages.* import org.jetbrains.jet.cli.common.arguments.* import org.jetbrains.jet.utils.PathUtil -import com.google.common.base.Splitter import java.io.File class DokkaArguments { @@ -48,7 +47,8 @@ public fun main(args: Array<String>) { println() - println("Analysing sources and libraries...") + print("Analysing sources and libraries... ") + val startAnalyse = System.currentTimeMillis() val documentation = environment.withContext<DocumentationModule> { environment, module, context -> val packageSet = environment.getSourceFiles().map { file -> context.getPackageFragment(file)!!.fqName @@ -56,15 +56,20 @@ public fun main(args: Array<String>) { context.createDocumentationModule(arguments.moduleName, module, packageSet) } + val timeAnalyse = System.currentTimeMillis() - startAnalyse + println("done in ${timeAnalyse / 1000} secs") + val startBuild = System.currentTimeMillis() val signatureGenerator = KotlinLanguageService() val locationService = FoldersLocationService(arguments.outputDir) val formatter = JekyllFormatService(locationService, signatureGenerator) val generator = FileGenerator(signatureGenerator, locationService, formatter) - println("Building pages...") + print("Building pages... ") generator.buildPage(documentation) - println("Building outline...") generator.buildOutline(documentation) + val timeBuild = System.currentTimeMillis() - startBuild + println("done in ${timeBuild / 1000} secs") + println() println("Done.") Disposer.dispose(environment) }
\ No newline at end of file |