Updated dokka plugin

This commit is contained in:
Alexander Nozik 2019-11-01 22:06:41 +03:00
parent 7b45e253b4
commit 1f03951cff
6 changed files with 20 additions and 28 deletions

View File

@ -7,7 +7,7 @@ plugins {
} }
group = "scientifik" group = "scientifik"
version = "0.2.1" version = "0.2.2"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
@ -23,16 +23,17 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0") implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.12.10") implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.13.2")
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4") implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18") implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.0")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0")
} }
gradlePlugin { gradlePlugin {
plugins { plugins {
create("scientifik-publish") { create("scientifik-publish") {
id = "scientifik.publish" id = "scientifik.publish"
description = "The publication plugin for bintray and bitbucket" description = "The publication plugin for bintray and github"
implementationClass = "scientifik.ScientifikPublishPlugin" implementationClass = "scientifik.ScientifikPublishPlugin"
} }

View File

@ -50,9 +50,9 @@ open class ScientifikJSPlugin : Plugin<Project> {
dependsOn(browserWebpack) dependsOn(browserWebpack)
from(fileTree("src/main/web")) from(fileTree("src/main/web"))
into(browserWebpack.destinationDirectory!!) into(browserWebpack.destinationDirectory!!)
doLast{ doLast {
val indexFile = File(browserWebpack.destinationDirectory!!,"index.html") val indexFile = File(browserWebpack.destinationDirectory!!, "index.html")
if(indexFile.exists()){ if (indexFile.exists()) {
println("Run JS distribution at: ${indexFile.canonicalPath}") println("Run JS distribution at: ${indexFile.canonicalPath}")
} }
} }

View File

@ -28,6 +28,7 @@ open class ScientifikJVMPlugin : Plugin<Project> {
} }
configure<KotlinJvmProjectExtension> { configure<KotlinJvmProjectExtension> {
val sourceSet = sourceSets["main"].apply { val sourceSet = sourceSets["main"].apply {
languageSettings.applySettings() languageSettings.applySettings()
dependencies { dependencies {
@ -35,6 +36,14 @@ open class ScientifikJVMPlugin : Plugin<Project> {
} }
} }
sourceSets["test"].apply {
languageSettings.applySettings()
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
val sourcesJar by tasks.registering(Jar::class) { val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
from(sourceSet.kotlin.srcDirs.first()) from(sourceSet.kotlin.srcDirs.first())
@ -54,7 +63,6 @@ open class ScientifikJVMPlugin : Plugin<Project> {
val dokka by tasks.getting(DokkaTask::class) { val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html" outputFormat = "html"
outputDirectory = "$buildDir/javadoc" outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
} }
val kdocJar by tasks.registering(Jar::class) { val kdocJar by tasks.registering(Jar::class) {

View File

@ -82,25 +82,9 @@ open class ScientifikMPPlugin : Plugin<Project> {
val dokka by tasks.getting(DokkaTask::class) { val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html" outputFormat = "html"
outputDirectory = "$buildDir/javadoc" outputDirectory = "$buildDir/javadoc"
jdkVersion = 8 multiplatform{
kotlinTasks {
// dokka fails to retrieve sources from MPP-tasks so we only define the jvm task
listOf(tasks.getByPath("compileKotlinJvm"))
} }
sourceRoot {
// assuming only single source dir
path = sourceSets["commonMain"].kotlin.srcDirs.first().toString()
platforms = listOf("Common")
}
// although the JVM sources are now taken from the task,
// we still define the jvm source root to get the JVM marker in the generated html
sourceRoot {
// assuming only single source dir
path = sourceSets["jvmMain"].kotlin.srcDirs.first().toString()
platforms = listOf("JVM")
}
} }
val kdocJar by tasks.registering(Jar::class) { val kdocJar by tasks.registering(Jar::class) {

View File

@ -19,10 +19,8 @@ class ScientifikNativePlugin : Plugin<Project> {
dependsOn(commonMain) dependsOn(commonMain)
dependencies { dependencies {
api(kotlin("native"))
//TODO add stdlib here //TODO add stdlib here
target.afterEvaluate {
//TODO add optional libraries here
}
} }
} }

View File

@ -79,6 +79,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
username = githubUser username = githubUser
password = githubToken password = githubToken
} }
} }
val githubPublishTasks = publications.filterIsInstance<MavenPublication>().map { publication -> val githubPublishTasks = publications.filterIsInstance<MavenPublication>().map { publication ->