aboutsummaryrefslogtreecommitdiff
path: root/ant
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:11 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:49 +0100
commit39631054c58df5841ea268b7002b820ec55f6e0a (patch)
treecefedd8411c859243bd181568e16fcdd372a38c8 /ant
parent797cb4732c53bf1e3b2091add8cf731fc436607f (diff)
downloaddokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.gz
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.bz2
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.zip
restructure Dokka build to use Gradle for everything except for the Maven plugin
Diffstat (limited to 'ant')
-rw-r--r--ant/ant.iml14
-rw-r--r--ant/src/dokka-antlib.xml3
-rw-r--r--ant/src/dokka.kt108
3 files changed, 0 insertions, 125 deletions
diff --git a/ant/ant.iml b/ant/ant.iml
deleted file mode 100644
index 0761035c..00000000
--- a/ant/ant.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="kotlin" level="project" />
- <orderEntry type="library" name="ant-1.9.4" level="project" />
- <orderEntry type="module" module-name="dokka" />
- </component>
-</module> \ No newline at end of file
diff --git a/ant/src/dokka-antlib.xml b/ant/src/dokka-antlib.xml
deleted file mode 100644
index 9c3373d5..00000000
--- a/ant/src/dokka-antlib.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<antlib>
- <taskdef name="dokka" classname="org.jetbrains.dokka.ant.DokkaAntTask"/>
-</antlib>
diff --git a/ant/src/dokka.kt b/ant/src/dokka.kt
deleted file mode 100644
index d78980f8..00000000
--- a/ant/src/dokka.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.jetbrains.dokka.ant
-
-import org.apache.tools.ant.Task
-import org.apache.tools.ant.types.Path
-import org.apache.tools.ant.types.Reference
-import org.apache.tools.ant.BuildException
-import org.apache.tools.ant.Project
-import org.jetbrains.dokka.DokkaLogger
-import org.jetbrains.dokka.DokkaGenerator
-import org.jetbrains.dokka.SourceLinkDefinition
-import java.io.File
-
-class AntLogger(val task: Task): DokkaLogger {
- override fun info(message: String) = task.log(message, Project.MSG_INFO)
- override fun warn(message: String) = task.log(message, Project.MSG_WARN)
- override fun error(message: String) = task.log(message, Project.MSG_ERR)
-}
-
-class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null)
-
-class DokkaAntTask(): Task() {
- public var moduleName: String? = null
- public var outputDir: String? = null
- public var outputFormat: String = "html"
-
- public var skipDeprecated: Boolean = false
-
- public val compileClasspath: Path = Path(getProject())
- public val sourcePath: Path = Path(getProject())
- public val samplesPath: Path = Path(getProject())
- public val includesPath: Path = Path(getProject())
-
- public val antSourceLinks: MutableList<AntSourceLinkDefinition> = arrayListOf()
-
- public fun setClasspath(classpath: Path) {
- compileClasspath.append(classpath)
- }
-
- public fun setClasspathRef(ref: Reference) {
- compileClasspath.createPath().refid = ref
- }
-
- public fun setSrc(src: Path) {
- sourcePath.append(src)
- }
-
- public fun setSrcRef(ref: Reference) {
- sourcePath.createPath().refid = ref
- }
-
- public fun setSamples(samples: Path) {
- samplesPath.append(samples)
- }
-
- public fun setSamplesRef(ref: Reference) {
- samplesPath.createPath().refid = ref
- }
-
- public fun setInclude(include: Path) {
- includesPath.append(include)
- }
-
- public fun createSourceLink(): AntSourceLinkDefinition {
- val def = AntSourceLinkDefinition()
- antSourceLinks.add(def)
- return def
- }
-
- override fun execute() {
- if (sourcePath.list().size == 0) {
- throw BuildException("At least one source path needs to be specified")
- }
- if (moduleName == null) {
- throw BuildException("Module name needs to be specified")
- }
- if (outputDir == null) {
- throw BuildException("Output directory needs to be specified")
- }
- val sourceLinks = antSourceLinks.map {
- val path = it.path
- if (path == null) {
- throw BuildException("Path attribute of a <sourceLink> element is required")
- }
- val url = it.url
- if (url == null) {
- throw BuildException("Path attribute of a <sourceLink> element is required")
- }
- SourceLinkDefinition(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
- }
-
- val url = DokkaAntTask::class.java.getResource("/org/jetbrains/dokka/ant/DokkaAntTask.class")
- val jarRoot = url.path.substringBefore("!/").removePrefix("file:")
-
- val generator = DokkaGenerator(
- AntLogger(this),
- listOf(jarRoot) + compileClasspath.list().toList(),
- sourcePath.list().toList(),
- samplesPath.list().toList(),
- includesPath.list().toList(),
- moduleName!!,
- outputDir!!,
- outputFormat,
- sourceLinks,
- skipDeprecated
- )
- generator.generate()
- }
-} \ No newline at end of file