Updated build. Added doc jar

This commit is contained in:
Alexander Nozik 2019-05-09 13:52:26 +03:00
parent 9ddcf648a1
commit 577311ab7f
16 changed files with 81 additions and 53 deletions

View File

@ -1,4 +1,4 @@
val dataforgeVersion by extra("0.1.2-dev-7")
val dataforgeVersion by extra("0.1.2")
allprojects {
repositories {
@ -12,7 +12,7 @@ allprojects {
subprojects {
if (name.startsWith("dataforge")) {
apply(plugin = "bintray-config")
apply(plugin = "artifactory-config")
apply(plugin = "npm-bintray")
apply(plugin = "npm-artifactory")
}
}

View File

@ -14,6 +14,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.5")
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18")
implementation("com.moowork.gradle:gradle-node-plugin:1.3.1")
implementation("org.openjfx:javafx-plugin:0.0.7")
}

View File

@ -5,6 +5,5 @@ object Versions {
val ioVersion = "0.1.8"
val coroutinesVersion = "1.2.1"
val atomicfuVersion = "0.12.6"
val dokkaVersion = "0.9.18"
val serializationVersion = "0.11.0"
}

View File

@ -0,0 +1,59 @@
import org.jetbrains.dokka.gradle.DokkaTask
plugins {
kotlin("multiplatform")
id("org.jetbrains.dokka")
`maven-publish`
}
kotlin {
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
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 javadocJar by tasks.registering(Jar::class) {
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
publishing {
// publications.filterIsInstance<MavenPublication>().forEach { publication ->
// if (publication.name == "kotlinMultiplatform") {
// // for our root metadata publication, set artifactId with a package and project name
// publication.artifactId = project.name
// } else {
// // for targets, set artifactId with a package, project name and target name (e.g. iosX64)
// publication.artifactId = "${project.name}-${publication.name}"
// }
// }
targets.all {
val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc
publication.artifact(javadocJar.get())
}
}
}

View File

@ -1,4 +1,3 @@
import gradle.kotlin.dsl.plugins._e2353938d1a2b15c365d69a8d533ab12.js
import org.gradle.kotlin.dsl.*
plugins {
@ -33,35 +32,35 @@ kotlin {
}
}
sourceSets.invoke {
commonMain {
sourceSets {
val commonMain by getting {
dependencies {
api(kotlin("stdlib"))
}
}
commonTest {
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
"jvmMain" {
val jvmMain by getting {
dependencies {
api(kotlin("stdlib-jdk8"))
}
}
"jvmTest" {
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
"jsMain" {
val jsMain by getting {
dependencies {
api(kotlin("stdlib-js"))
}
}
"jsTest" {
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
@ -75,37 +74,7 @@ kotlin {
}
}
// Create empty jar for sources classifier to satisfy maven requirements
val stubSources by tasks.registering(Jar::class){
archiveClassifier.set("sources")
//from(sourceSets.main.get().allSource)
}
// Create empty jar for javadoc classifier to satisfy maven requirements
val stubJavadoc by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing {
publications.filterIsInstance<MavenPublication>().forEach { publication ->
if (publication.name == "kotlinMultiplatform") {
// for our root metadata publication, set artifactId with a package and project name
publication.artifactId = project.name
} else {
// for targets, set artifactId with a package, project name and target name (e.g. iosX64)
publication.artifactId = "${project.name}-${publication.name}"
}
}
targets.all {
val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc
publication.artifact(stubJavadoc.get())
}
}
apply(plugin = "dokka-publish")
// Apply JS test configuration
val runJsTests by ext(false)

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
description = "Context and provider definitions"

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
val coroutinesVersion: String = Versions.coroutinesVersion

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
description = "IO for meta"

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
description = "Meta definition and basic operations on meta"

View File

@ -17,10 +17,10 @@ fun <T> Configurable.value(default: T? = null, key: String? = null, transform: (
MutableValueDelegate(config, key, Value.of(default)).transform(reader = transform)
fun Configurable.stringList(key: String? = null) =
value { it?.list?.map { value -> value.string } ?: emptyList() }
value(key) { it?.list?.map { value -> value.string } ?: emptyList() }
fun Configurable.numberList(key: String? = null) =
value { it?.list?.map { value -> value.number } ?: emptyList() }
value(key) { it?.list?.map { value -> value.number } ?: emptyList() }
fun Configurable.string(default: String? = null, key: String? = null) =
MutableStringDelegate(config, key, default)

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
kotlin {

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
val htmlVersion by rootProject.extra("0.6.12")

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
kotlin {

View File

@ -1,5 +1,5 @@
plugins {
`multiplatform-config`
`npm-multiplatform`
}
kotlin {