diff options
Diffstat (limited to 'src/main.kt')
-rw-r--r-- | src/main.kt | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/main.kt b/src/main.kt index 29a22672..a534ffdd 100644 --- a/src/main.kt +++ b/src/main.kt @@ -22,46 +22,46 @@ import java.io.File import kotlin.util.measureTimeMillis class DokkaArguments { - Argument(value = "src", description = "Source file or directory (allows many paths separated by the system path separator)") - ValueDescription("<path>") + @set:Argument(value = "src", description = "Source file or directory (allows many paths separated by the system path separator)") + @ValueDescription("<path>") public var src: String = "" - Argument(value = "srcLink", description = "Mapping between a source directory and a Web site for browsing the code") - ValueDescription("<path>=<url>[#lineSuffix]") + @set:Argument(value = "srcLink", description = "Mapping between a source directory and a Web site for browsing the code") + @ValueDescription("<path>=<url>[#lineSuffix]") public var srcLink: String = "" - Argument(value = "include", description = "Markdown files to load (allows many paths separated by the system path separator)") - ValueDescription("<path>") + @set:Argument(value = "include", description = "Markdown files to load (allows many paths separated by the system path separator)") + @ValueDescription("<path>") public var include: String = "" - Argument(value = "samples", description = "Source root for samples") - ValueDescription("<path>") + @set:Argument(value = "samples", description = "Source root for samples") + @ValueDescription("<path>") public var samples: String = "" - Argument(value = "output", description = "Output directory path") - ValueDescription("<path>") + @set:Argument(value = "output", description = "Output directory path") + @ValueDescription("<path>") public var outputDir: String = "out/doc/" - Argument(value = "format", description = "Output format (text, html, markdown, jekyll, kotlin-website)") - ValueDescription("<name>") + @set:Argument(value = "format", description = "Output format (text, html, markdown, jekyll, kotlin-website)") + @ValueDescription("<name>") public var outputFormat: String = "html" - Argument(value = "module", description = "Name of the documentation module") - ValueDescription("<name>") + @set:Argument(value = "module", description = "Name of the documentation module") + @ValueDescription("<name>") public var moduleName: String = "" - Argument(value = "classpath", description = "Classpath for symbol resolution") - ValueDescription("<path>") + @set:Argument(value = "classpath", description = "Classpath for symbol resolution") + @ValueDescription("<path>") public var classpath: String = "" - Argument(value = "nodeprecated", description = "Exclude deprecated members from documentation") + @set:Argument(value = "nodeprecated", description = "Exclude deprecated members from documentation") public var nodeprecated: Boolean = false } private fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition { val (path, urlAndLine) = srcLink.split('=') - return SourceLinkDefinition(File(path).getAbsolutePath(), + return SourceLinkDefinition(File(path).absolutePath, urlAndLine.substringBefore("#"), urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it }) } @@ -182,7 +182,7 @@ class DokkaGenerator(val logger: DokkaLogger, } fun isSample(file: PsiFile): Boolean { - val sourceFile = File(file.getVirtualFile()!!.getPath()) + val sourceFile = File(file.virtualFile!!.path) return samples.none { sample -> val canonicalSample = File(sample).canonicalPath val canonicalSource = sourceFile.canonicalPath @@ -199,7 +199,7 @@ fun buildDocumentationModule(environment: AnalysisEnvironment, logger: DokkaLogger): DocumentationModule { val documentation = environment.withContext { environment, resolutionFacade, session -> val fragmentFiles = environment.getSourceFiles().filter(filesToDocumentFilter) - val fragments = fragmentFiles.map { session.getPackageFragment(it.getPackageFqName()) }.filterNotNull().distinct() + val fragments = fragmentFiles.map { session.getPackageFragment(it.packageFqName) }.filterNotNull().distinct() val refGraph = NodeReferenceGraph() val documentationBuilder = DocumentationBuilder(resolutionFacade, session, options, refGraph, logger) @@ -235,7 +235,7 @@ fun KotlinCoreEnvironment.getJavaSourceFiles(): List<PsiJavaFile> { val result = arrayListOf<PsiJavaFile>() val localFileSystem = VirtualFileManager.getInstance().getFileSystem("file") sourceRoots.forEach { sourceRoot -> - sourceRoot.getAbsoluteFile().walkTopDown().forEach { + sourceRoot.absoluteFile.walkTopDown().forEach { val vFile = localFileSystem.findFileByPath(it.path) if (vFile != null) { val psiFile = PsiManager.getInstance(project).findFile(vFile) |