forked from kscience/kmath
Build refactoring
This commit is contained in:
parent
0e7ad1c0c0
commit
4cd316758a
@ -1,3 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
val kmathVersion by extra("0.1.2-dev-1")
|
||||
|
||||
allprojects {
|
||||
@ -16,12 +18,10 @@ subprojects {
|
||||
|
||||
//apply artifactory configuration
|
||||
apply(plugin = "artifactory-config")
|
||||
}
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.multiplatform") {
|
||||
plugins.withType<KotlinMultiplatformPlugin> {
|
||||
apply(plugin = "multiplatform-config")
|
||||
}
|
||||
|
||||
}
|
||||
// dokka {
|
||||
// outputFormat = "html"
|
||||
// outputDirectory = javadoc.destinationDir
|
||||
@ -31,5 +31,6 @@ subprojects {
|
||||
// from javadoc . destinationDir
|
||||
// classifier = "javadoc"
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import com.moowork.gradle.node.NodeExtension
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
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
|
||||
|
||||
plugins {
|
||||
@ -8,18 +9,26 @@ plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
node {
|
||||
configure<NodeExtension> {
|
||||
nodeModulesDir = file("$buildDir/node_modules")
|
||||
}
|
||||
|
||||
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||
|
||||
inline fun <reified T : Task> TaskContainer.registering(
|
||||
crossinline action: T.() -> Unit
|
||||
): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> =
|
||||
RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() })
|
||||
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
|
||||
val populateNodeModules by tasks.registering(Copy::class) {
|
||||
dependsOn(compileKotlinJs)
|
||||
from(compileKotlinJs.destinationDir)
|
||||
|
||||
kotlin.js().compilations["test"].runtimeDependencyFiles.forEach {
|
||||
js().compilations["test"].runtimeDependencyFiles.forEach {
|
||||
if (it.exists() && !it.isDirectory) {
|
||||
from(zipTree(it.absolutePath).matching { include("*.js") })
|
||||
}
|
||||
@ -33,13 +42,6 @@ val installMocha by tasks.registering<NpmTask> {
|
||||
setArgs(listOf("install", "mocha"))
|
||||
}
|
||||
|
||||
|
||||
inline fun <reified T : Task> TaskContainer.registering(
|
||||
crossinline action: T.() -> Unit
|
||||
): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> =
|
||||
RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() })
|
||||
|
||||
|
||||
val runMocha by tasks.registering(NodeTask::class) {
|
||||
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
||||
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
||||
@ -47,3 +49,5 @@ val runMocha by tasks.registering(NodeTask::class) {
|
||||
}
|
||||
|
||||
tasks["jsTest"].dependsOn(runMocha)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user