diff options
Diffstat (limited to 'runners')
-rw-r--r-- | runners/build.gradle | 7 | ||||
-rw-r--r-- | runners/build.gradle.kts | 6 | ||||
-rw-r--r-- | runners/cli/build.gradle | 16 | ||||
-rw-r--r-- | runners/cli/build.gradle.kts | 37 | ||||
-rw-r--r-- | runners/fatjar/build.gradle | 78 | ||||
-rw-r--r-- | runners/gradle-plugin/build.gradle | 108 | ||||
-rw-r--r-- | runners/gradle-plugin/build.gradle.kts | 74 | ||||
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt | 10 | ||||
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt | 72 | ||||
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt | 2 | ||||
-rw-r--r-- | runners/maven-plugin/build.gradle | 161 | ||||
-rw-r--r-- | runners/maven-plugin/build.gradle.kts | 115 | ||||
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 3 | ||||
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt | 6 |
14 files changed, 313 insertions, 382 deletions
diff --git a/runners/build.gradle b/runners/build.gradle deleted file mode 100644 index 23d232d2..00000000 --- a/runners/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -subprojects { - buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } - } -}
\ No newline at end of file diff --git a/runners/build.gradle.kts b/runners/build.gradle.kts new file mode 100644 index 00000000..57081149 --- /dev/null +++ b/runners/build.gradle.kts @@ -0,0 +1,6 @@ +subprojects { + apply { + plugin("maven-publish") + plugin("com.jfrog.bintray") + } +}
\ No newline at end of file diff --git a/runners/cli/build.gradle b/runners/cli/build.gradle deleted file mode 100644 index 24db0b1e..00000000 --- a/runners/cli/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -apply plugin: 'kotlin' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -dependencies { - implementation "org.jetbrains.kotlinx:kotlinx-cli-jvm:0.1.0-dev-3" - implementation project(":core") -} diff --git a/runners/cli/build.gradle.kts b/runners/cli/build.gradle.kts new file mode 100644 index 00000000..4b39d64c --- /dev/null +++ b/runners/cli/build.gradle.kts @@ -0,0 +1,37 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + id("com.github.johnrengelman.shadow") +} + +repositories { + maven(url = "https://dl.bintray.com/orangy/maven") +} + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.1.0-dev-3") + implementation(project(":core")) +} + + +tasks { + shadowJar { + val dokka_version: String by project + archiveFileName.set("dokka-cli-$dokka_version.jar") + archiveClassifier.set("") + manifest { + attributes("Main-Class" to "org.jetbrains.dokka.MainKt") + } + } +} + +publishing { + publications { + register<MavenPublication>("dokkaCli") { + artifactId = "dokka-cli" + project.shadow.component(this) + } + } +} + +configureBintrayPublication("dokkaCli")
\ No newline at end of file diff --git a/runners/fatjar/build.gradle b/runners/fatjar/build.gradle deleted file mode 100644 index cab64c0f..00000000 --- a/runners/fatjar/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer -import org.jetbrains.PluginXmlTransformer -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -apply plugin: 'java' -apply plugin: 'com.github.johnrengelman.shadow' - -dependencies { - compile project(":runners:cli") - compile project(":runners:ant") -} - -jar { - manifest { - attributes 'Main-Class': 'org.jetbrains.dokka.MainKt' - } -} - -shadowJar { - baseName = 'dokka-fatjar' - classifier = '' - configurations { - exclude compileOnly - } - - transform(ServiceFileTransformer) - transform(PluginXmlTransformer) - - exclude 'colorScheme/**' - exclude 'fileTemplates/**' - exclude 'inspectionDescriptions/**' - exclude 'intentionDescriptions/**' - - exclude 'src/**' - -// relocate('kotlin.reflect.full', 'kotlin.reflect') -} - -task apiShadow(type: ShadowJar) { - baseName = 'dokka-fatapi' - classifier = '' - - configurations = [project.configurations.compile] - configurations { - exclude compileOnly - } - - transform(ServiceFileTransformer) - transform(PluginXmlTransformer) - - exclude 'kotlin/**' - exclude 'colorScheme/**' - exclude 'fileTemplates/**' - exclude 'inspectionDescriptions/**' - exclude 'intentionDescriptions/**' - - exclude 'src/**' - -// relocate('kotlin.reflect.full', 'kotlin.reflect') -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaFatJar(MavenPublication) { publication -> - artifactId = 'dokka-fatjar' - project.shadow.component(publication) - } - - dokkaFatApi(MavenPublication) {publication -> - artifactId = 'dokka-fatapi' - publication.artifact(project.tasks.apiShadow) - } - } -} - -bintrayPublication(project, ["dokkaFatJar"])
\ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle deleted file mode 100644 index ceb03bae..00000000 --- a/runners/gradle-plugin/build.gradle +++ /dev/null @@ -1,108 +0,0 @@ -import com.gradle.publish.DependenciesBuilder - -apply plugin: 'java' -apply plugin: 'kotlin' - - -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: "com.gradle.plugin-publish" - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -repositories { - jcenter() - google() -} - -dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' - - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version - - compile project(":integration") - - compileOnly "org.jetbrains.kotlin:kotlin-gradle-plugin" - compileOnly("com.android.tools.build:gradle:3.0.0") - compileOnly("com.android.tools.build:gradle-core:3.0.0") - compileOnly("com.android.tools.build:builder-model:3.0.0") - compileOnly gradleApi() - compileOnly localGroovy() - implementation "com.google.code.gson:gson:$gson_version" -} - -task sourceJar(type: Jar) { - from sourceSets.main.allSource -} - -processResources { - eachFile { - if (it.name == "org.jetbrains.dokka.properties") { - it.filter { line -> - line.replace("<version>", dokka_version) - } - } - } -} - -shadowJar { - baseName = 'dokka-gradle-plugin' - classifier = '' -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaGradlePlugin(MavenPublication) { publication -> - artifactId = 'dokka-gradle-plugin' - - artifact sourceJar { - classifier "sources" - } - - project.shadow.component(publication) - } - } -} - -bintrayPublication(project, ['dokkaGradlePlugin']) - -configurations.archives.artifacts.clear() -artifacts { - archives shadowJar -} - -pluginBundle { - website = 'https://www.kotlinlang.org/' - vcsUrl = 'https://github.com/kotlin/dokka.git' - description = 'Dokka, the Kotlin documentation tool' - tags = ['dokka', 'kotlin', 'kdoc', 'android'] - - plugins { - dokkaGradlePlugin { - id = 'org.jetbrains.dokka' - displayName = 'Dokka plugin' - } - } - - withDependencies { List<Dependency> list -> - list.clear() - def builder = new DependenciesBuilder() - builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") - } - - mavenCoordinates { - groupId = "org.jetbrains.dokka" - artifactId = "dokka-gradle-plugin" - } -}
\ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts new file mode 100644 index 00000000..0d68a525 --- /dev/null +++ b/runners/gradle-plugin/build.gradle.kts @@ -0,0 +1,74 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + id("com.gradle.plugin-publish") +} + +repositories { + google() +} + +dependencies { + implementation(project(":core")) + compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin") + compileOnly("com.android.tools.build:gradle:3.0.0") + compileOnly("com.android.tools.build:gradle-core:3.0.0") + compileOnly("com.android.tools.build:builder-model:3.0.0") + compileOnly(gradleApi()) + constraints { + val kotlin_version: String by project + compileOnly("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}") { + because("kotlin-gradle-plugin and :core both depend on this") + } + } +} + +tasks { + processResources { + val dokka_version: String by project + eachFile { + if (name == "org.jetbrains.dokka.properties") { + filter { line -> + line.replace("<version>", dokka_version) + } + } + } + } +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +publishing { + publications { + register<MavenPublication>("dokkaGradlePlugin") { + artifactId = "dokka-gradle-plugin" + from(components["java"]) + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaGradlePlugin") // TODO check if this publishes correctly + +pluginBundle { + // TODO check if this publishes correctly + website = "https://www.kotlinlang.org/" + vcsUrl = "https://github.com/kotlin/dokka.git" + description = "Dokka, the Kotlin documentation tool" + tags = listOf("dokka", "kotlin", "kdoc", "android") + + plugins { + create("dokkaGradlePlugin") { + id = "org.jetbrains.dokka" + displayName = "Dokka plugin" + } + } + + mavenCoordinates { + groupId = "org.jetbrains.dokka" + artifactId = "dokka-gradle-plugin" + } +}
\ No newline at end of file diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index 940c496e..65b0f4b3 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -89,17 +89,9 @@ open class DokkaTask : DefaultTask() { private var outputDiagnosticInfo: Boolean = false // Workaround for Gradle, which fires some methods (like collectConfigurations()) multiple times in its lifecycle - private fun tryResolveFatJar(configuration: Configuration?): Set<File> { - return try { - configuration!!.resolve() - } catch (e: Exception) { - project.parent?.let { tryResolveFatJar(configuration) } ?: throw e - } - } - private fun loadFatJar() { if (ClassloaderContainer.fatJarClassLoader == null) { - val jars = tryResolveFatJar(dokkaRuntime).toList() + val jars = dokkaRuntime!!.resolve() ClassloaderContainer.fatJarClassLoader = URLClassLoader(jars.map { it.toURI().toURL() }.toTypedArray(), ClassLoader.getSystemClassLoader().parent) } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt new file mode 100644 index 00000000..1984a3e5 --- /dev/null +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt @@ -0,0 +1,72 @@ +package org.jetbrains.dokka + +import kotlin.reflect.* +import kotlin.reflect.full.memberFunctions +import kotlin.reflect.full.memberProperties +import kotlin.reflect.jvm.isAccessible + +object ReflectDsl { + + class CallOrPropAccess(private val receiver: Any?, + private val clz: KClass<*>, + private val selector: String) { + + @Suppress("UNCHECKED_CAST") + operator fun <T : Any?> invoke(vararg a: Any?): T { + return func!!.call(receiver, *a) as T + } + + operator fun get(s: String): CallOrPropAccess { + return v<Any?>()!![s] + } + + val func: KFunction<*>? by lazy { clz.memberFunctions.find { it.name == selector } } + val prop: KProperty<*>? by lazy { clz.memberProperties.find { it.name == selector } } + + fun takeIfIsFunc(): CallOrPropAccess? = if (func != null) this else null + + fun takeIfIsProp(): CallOrPropAccess? = if (prop != null) this else null + + @Suppress("UNCHECKED_CAST") + fun <T : Any?> v(): T { + val prop = prop!! + return try { + prop.getter.apply { isAccessible = true }.call(receiver) as T + } catch (e: KotlinNullPointerException) { + // Hack around kotlin-reflect bug KT-18480 + val jclass = clz.java + val customGetterName = prop.getter.name + val getterName = if (customGetterName.startsWith("<")) "get" + prop.name.capitalize() else customGetterName + val getter = jclass.getDeclaredMethod(getterName) + getter.isAccessible = true + + getter.invoke(receiver) as T + + } + } + + @Suppress("UNCHECKED_CAST") + fun v(x: Any?) { + (prop as KMutableProperty).setter.apply { isAccessible = true }.call(receiver, x) + } + + + } + + operator fun Any.get(s: String): CallOrPropAccess { + val clz = this.javaClass.kotlin + return CallOrPropAccess(this, clz, s) + } + + operator fun Any.get(s: String, clz: Class<*>): CallOrPropAccess { + val kclz = clz.kotlin + return CallOrPropAccess(this, kclz, s) + } + + operator fun Any.get(s: String, clz: KClass<*>): CallOrPropAccess { + return CallOrPropAccess(this, clz, s) + } + + inline infix fun Any.isInstance(clz: Class<*>?): Boolean = clz != null && clz.isAssignableFrom(this.javaClass) + inline infix fun Any.isNotInstance(clz: Class<*>?): Boolean = !(this isInstance clz) +}
\ No newline at end of file diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index d75d3b21..71a02843 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -25,7 +25,7 @@ open class DokkaPlugin : Plugin<Project> { private fun addConfiguration(project: Project) = project.configurations.create("dokkaRuntime").apply { - defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) } + defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-core:${DokkaVersion.version}")) } } private fun addTasks( diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle deleted file mode 100644 index 76fab68d..00000000 --- a/runners/maven-plugin/build.gradle +++ /dev/null @@ -1,161 +0,0 @@ -import groovy.io.FileType -import org.jetbrains.CorrectShadowPublishing -import org.jetbrains.CrossPlatformExec - -import java.nio.file.Files -import java.nio.file.StandardCopyOption - -apply plugin: 'kotlin' -apply plugin: 'com.github.johnrengelman.shadow' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = "1.2" - apiVersion = languageVersion - jvmTarget = "1.8" - } -} - -configurations { - maven -} - -dependencies { - maven group: "org.apache.maven", name: 'apache-maven', version: maven_version, classifier: 'bin', ext: 'zip' - - shadow project(":runners:fatjar") - shadow "org.apache.maven:maven-core:$maven_version" - shadow "org.apache.maven:maven-model:$maven_version" - shadow "org.apache.maven:maven-plugin-api:$maven_version" - shadow "org.apache.maven:maven-archiver:$maven_archiver_version" - shadow "org.codehaus.plexus:plexus-utils:$plexus_utils_version" - shadow "org.codehaus.plexus:plexus-archiver:$plexus_archiver_version" - shadow "org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version" - shadow "com.github.olivergondza:maven-jdk-tools-wrapper:0.1" -} - -final File mavenHome = new File(buildDir, "maven-bin") -final File mvn = new File(mavenHome, "apache-maven-$maven_version/bin/mvn") - -tasks.clean.doLast { - delete mavenHome -} - -task setupMaven(type: Sync) { - from configurations.maven.collect{ zipTree(it) } - into "$buildDir/maven-bin" -} - -def mavenBuildDir = "$buildDir/maven" - - -sourceSets.main.resources { - srcDirs += "$mavenBuildDir/classes/java/main" - exclude "**/*.class" -} - -task generatePom() { - inputs.file(new File(projectDir, "pom.tpl.xml")) - outputs.file(new File(mavenBuildDir, "pom.xml")) - doLast { - final pomTemplate = new File(projectDir, "pom.tpl.xml") - final pom = new File(mavenBuildDir, "pom.xml") - pom.parentFile.mkdirs() - pom.text = pomTemplate.text.replace("<version>dokka_version</version>", "<version>$dokka_version</version>") - .replace("<maven.version></maven.version>", "<maven.version>$maven_version</maven.version>") - .replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>") - } -} -// -//task mergeClassOutputs doLast { -// def sourceDir = new File(buildDir, "classes/kotlin") -// def targetDir = new File(buildDir, "classes/java") -// -// sourceDir.eachFileRecurse FileType.ANY, { -// def filePath = it.toPath() -// def targetFilePath = targetDir.toPath().resolve(sourceDir.toPath().relativize(filePath)) -// if (it.isFile()) { -// Files.move(filePath, targetFilePath, StandardCopyOption.REPLACE_EXISTING) -// } else if (it.isDirectory()) { -// targetFilePath.toFile().mkdirs() -// } -// } -//} - - - -task syncKotlinClasses(type: Sync, dependsOn: compileKotlin) { - from "$buildDir/classes/kotlin" - into "$mavenBuildDir/classes/java" - - preserve { - include '**/*.class' - } -} - -task syncJavaClasses(type: Sync, dependsOn: compileJava) { - from "$buildDir/classes/java" - into "$mavenBuildDir/classes/java" - - preserve { - include '**/*.class' - } -} - -task helpMojo(type: CrossPlatformExec, dependsOn: setupMaven) { - workingDir mavenBuildDir - commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:helpmojo' - - dependsOn syncKotlinClasses -} - - -task pluginDescriptor(type: CrossPlatformExec, dependsOn: setupMaven) { - workingDir mavenBuildDir - commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:descriptor' - - dependsOn syncJavaClasses -} - - -//mergeClassOutputs.dependsOn compileKotlin -//helpMojo.dependsOn mergeClassOutputs -helpMojo.dependsOn generatePom -sourceSets.main.java.srcDir("$buildDir/maven/generated-sources/plugin") -compileJava.dependsOn helpMojo -processResources.dependsOn pluginDescriptor - -pluginDescriptor.dependsOn generatePom - -shadowJar { - baseName = 'dokka-maven-plugin' - classifier = '' -} - -shadowJar.dependsOn pluginDescriptor - - -task sourceJar(type: Jar) { - from sourceSets.main.allSource -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaMavenPlugin(MavenPublication) { MavenPublication publication -> - artifactId = 'dokka-maven-plugin' - - artifact sourceJar { - classifier "sources" - } - - CorrectShadowPublishing.configure(publication, project) - } - } -} - -bintrayPublication(project, ['dokkaMavenPlugin']) diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts new file mode 100644 index 00000000..2dffd71c --- /dev/null +++ b/runners/maven-plugin/build.gradle.kts @@ -0,0 +1,115 @@ +import org.jetbrains.configureBintrayPublication + +/** + * [mavenBin] configuration is used to download Maven Plugin Plugin + * for generating plugin-help.xml and plugin.xml files + */ +val mavenBin: Configuration by configurations.creating + +val maven_version: String by project + +dependencies { + implementation(project(":core")) + implementation("org.apache.maven:maven-core:$maven_version") + implementation("org.apache.maven:maven-plugin-api:$maven_version") + val maven_plugin_tools_version: String by project + implementation("org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version") + val maven_archiver_version: String by project + implementation("org.apache.maven:maven-archiver:$maven_archiver_version") + + mavenBin(group = "org.apache.maven", name = "apache-maven", version = maven_version, classifier = "bin", ext = "zip") + compileOnly(kotlin("stdlib-jdk8")) +} + +val mavenBinDir = "$buildDir/maven-bin" +val mavenBuildDir = "$buildDir/maven" +val mvn = File(mavenBinDir, "apache-maven-$maven_version/bin/mvn") + +tasks.named<Delete>("clean") { + delete(mavenBinDir) +} + +/** + * Copy Maven Plugin Plugin to [mavenBinDir] directory + */ +val setupMaven by tasks.registering(Sync::class) { + from(mavenBin.map { zipTree(it) }) + into(mavenBinDir) +} + +/** + * Generate pom.xml for Maven Plugin Plugin + */ +val generatePom by tasks.registering(Copy::class) { + val dokka_version: String by project + val maven_plugin_tools_version: String by project + + from("$projectDir/pom.tpl.xml") { + rename("(.*).tpl.xml", "$1.xml") + } + into(mavenBuildDir) + + eachFile { + filter { line -> + line.replace("<maven.version></maven.version>", "<maven.version>$maven_version</maven.version>") + } + filter { line -> + line.replace("<version>dokka_version</version>", "<version>$dokka_version</version>") + } + filter { line -> + line.replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>") + } + } +} + +/** + * Copy compiled classes to [mavenBuildDir] for Maven Plugin Plugin + */ +val syncClasses by tasks.registering(Sync::class) { + dependsOn(tasks.compileKotlin, tasks.compileJava) + from("$buildDir/classes/kotlin", "$buildDir/classes/java") + into("$mavenBuildDir/classes/java") + + preserve { + include("**/*.class") + } +} + +val helpMojo by tasks.registering(org.jetbrains.CrossPlatformExec::class) { + dependsOn(setupMaven, generatePom, syncClasses) + workingDir(mavenBuildDir) + commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:helpmojo") +} + +val pluginDescriptor by tasks.registering(org.jetbrains.CrossPlatformExec::class) { + dependsOn(setupMaven, generatePom, syncClasses) + workingDir(mavenBuildDir) + commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:descriptor") +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +tasks.named<Jar>("jar") { + dependsOn(pluginDescriptor, helpMojo) + metaInf { + from("$mavenBuildDir/classes/java/main/META-INF") + } + manifest { + attributes("Class-Path" to configurations.runtimeClasspath.get().files.joinToString(" ") { it.name }) + } +} + +publishing { + publications { + register<MavenPublication>("dokkaMavenPlugin") { + artifactId = "dokka-maven-plugin" + from(components["java"]) + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaMavenPlugin") diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index fb11ecac..67188325 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -189,7 +189,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() { impliedPlatforms = impliedPlatforms, cacheRoot = cacheRoot, passesConfigurations = listOf(passConfiguration), - generateIndexPages = generateIndexPages + generateIndexPages = generateIndexPages, + pluginsClasspath = emptyList() //TODO fix this ) val gen = DokkaGenerator(configuration, MavenDokkaLogger(log)) diff --git a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt index a535c807..950af3e0 100644 --- a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt +++ b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt @@ -1,17 +1,21 @@ package org.jetbrains.dokka.maven import org.apache.maven.plugin.logging.Log -import org.jetbrains.dokka.DokkaLogger +import org.jetbrains.dokka.utilities.DokkaLogger class MavenDokkaLogger(val log: Log) : DokkaLogger { override fun error(message: String) { log.error(message) } + override fun debug(message: String) = log.debug(message) + override fun info(message: String) { log.info(message) } + override fun progress(message: String) = log.info(message) + override fun warn(message: String) { log.warn(message) } |