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")
|
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"
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user