Merge dev into master #59

Merged
altavir merged 37 commits from dev into master 2019-05-31 12:35:58 +03:00
2 changed files with 43 additions and 38 deletions
Showing only changes of commit 4cd316758a - Show all commits

View File

@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
val kmathVersion by extra("0.1.2-dev-1") val kmathVersion by extra("0.1.2-dev-1")
allprojects { allprojects {
@ -16,20 +18,19 @@ subprojects {
//apply artifactory configuration //apply artifactory configuration
apply(plugin = "artifactory-config") apply(plugin = "artifactory-config")
plugins.withId("org.jetbrains.kotlin.multiplatform") {
apply(plugin = "multiplatform-config")
}
} }
// dokka {
// outputFormat = "html" plugins.withType<KotlinMultiplatformPlugin> {
// outputDirectory = javadoc.destinationDir apply(plugin = "multiplatform-config")
// } // dokka {
// outputFormat = "html"
// outputDirectory = javadoc.destinationDir
// }
// //
// task dokkaJar (type: Jar, dependsOn: dokka) { // task dokkaJar (type: Jar, dependsOn: dokka) {
// from javadoc . destinationDir // from javadoc . destinationDir
// classifier = "javadoc" // classifier = "javadoc"
// } // }
}
} }

View File

@ -1,6 +1,7 @@
import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.npm.NpmTask import com.moowork.gradle.node.npm.NpmTask
import com.moowork.gradle.node.task.NodeTask import com.moowork.gradle.node.task.NodeTask
import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
plugins { plugins {
@ -8,42 +9,45 @@ plugins {
kotlin("multiplatform") kotlin("multiplatform")
} }
node { configure<NodeExtension> {
nodeModulesDir = file("$buildDir/node_modules") nodeModulesDir = file("$buildDir/node_modules")
} }
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class) val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class) val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
val populateNodeModules by tasks.registering(Copy::class) {
dependsOn(compileKotlinJs)
from(compileKotlinJs.destinationDir)
kotlin.js().compilations["test"].runtimeDependencyFiles.forEach {
if (it.exists() && !it.isDirectory) {
from(zipTree(it.absolutePath).matching { include("*.js") })
}
}
into("$buildDir/node_modules")
}
val installMocha by tasks.registering<NpmTask> {
setWorkingDir(buildDir)
setArgs(listOf("install", "mocha"))
}
inline fun <reified T : Task> TaskContainer.registering( inline fun <reified T : Task> TaskContainer.registering(
crossinline action: T.() -> Unit crossinline action: T.() -> Unit
): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> = ): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> =
RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() }) RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() })
val runMocha by tasks.registering(NodeTask::class) { configure<KotlinMultiplatformExtension> {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
setScript(file("$buildDir/node_modules/mocha/bin/mocha")) val populateNodeModules by tasks.registering(Copy::class) {
setArgs(listOf(compileTestKotlinJs.outputFile)) dependsOn(compileKotlinJs)
from(compileKotlinJs.destinationDir)
js().compilations["test"].runtimeDependencyFiles.forEach {
if (it.exists() && !it.isDirectory) {
from(zipTree(it.absolutePath).matching { include("*.js") })
}
}
into("$buildDir/node_modules")
}
val installMocha by tasks.registering<NpmTask> {
setWorkingDir(buildDir)
setArgs(listOf("install", "mocha"))
}
val runMocha by tasks.registering(NodeTask::class) {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
setArgs(listOf(compileTestKotlinJs.outputFile))
}
tasks["jsTest"].dependsOn(runMocha)
} }
tasks["jsTest"].dependsOn(runMocha)