Fix native and node hmpp
This commit is contained in:
parent
1cc83e8803
commit
8efae2ca4d
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.mipt.npm"
|
group = "ru.mipt.npm"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
|
|
||||||
description = "Build tools for DataForge and kscience projects"
|
description = "Build tools for DataForge and kscience projects"
|
||||||
|
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
|
import org.gradle.api.Action
|
||||||
|
import org.gradle.api.NamedDomainObjectContainer
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.findPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
|
||||||
|
private fun KotlinMultiplatformExtension.sourceSets(configure: Action<NamedDomainObjectContainer<KotlinSourceSet>>): Unit =
|
||||||
|
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("sourceSets", configure)
|
||||||
|
|
||||||
class KScienceNativePlugin : Plugin<Project> {
|
class KScienceNativePlugin : Plugin<Project> {
|
||||||
override fun apply(target: Project) = target.run {
|
override fun apply(project: Project) = project.run {
|
||||||
//Apply multiplatform plugin is not applied, apply it
|
//Apply multiplatform plugin is not applied, apply it
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||||
@ -35,45 +43,25 @@ class KScienceNativePlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain by getting
|
val commonMain = findByName("commonMain")!!
|
||||||
val commonTest by getting
|
val commonTest = findByName("commonTest")!!
|
||||||
|
|
||||||
val nativeMain by creating {
|
val nativeMain = create("nativeMain").apply {
|
||||||
dependsOn(commonMain)
|
dependsOn(commonMain)
|
||||||
}
|
}
|
||||||
|
|
||||||
val nativeTest by creating {
|
val nativeTest = create("nativeTest").apply {
|
||||||
dependsOn(commonTest)
|
dependsOn(commonTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLinux) {
|
findByName("linuxX64Main")?.dependsOn(nativeMain)
|
||||||
val linuxX64Main by getting {
|
findByName("linuxX64Test")?.dependsOn(nativeTest)
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
val linuxX64Test by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMinGw) {
|
findByName("mingwX64Main")?.dependsOn(nativeMain)
|
||||||
val mingwX64Main by getting {
|
findByName("mingwX64Test")?.dependsOn(nativeTest)
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
|
|
||||||
val mingwX64Test by getting {
|
findByName("macosX64Main")?.dependsOn(nativeMain)
|
||||||
dependsOn(nativeTest)
|
findByName("macosX64Test")?.dependsOn(nativeTest)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMacOs) {
|
|
||||||
val macosX64Main by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
|
|
||||||
val macosX64Test by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
|
import org.gradle.api.Action
|
||||||
|
import org.gradle.api.NamedDomainObjectContainer
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.findPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
|
||||||
|
private fun KotlinMultiplatformExtension.sourceSets(configure: Action<NamedDomainObjectContainer<KotlinSourceSet>>): Unit =
|
||||||
|
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("sourceSets", configure)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a separate target for node
|
* Create a separate target for node
|
||||||
@ -24,38 +32,30 @@ class KScienceNodePlugin : Plugin<Project> {
|
|||||||
js(name = "node", compiler = IR) {
|
js(name = "node", compiler = IR) {
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
sourceSets {
|
|
||||||
val commonMain by getting
|
|
||||||
val commonTest by getting
|
|
||||||
|
|
||||||
val jsCommonMain by creating{
|
sourceSets {
|
||||||
|
val commonMain = findByName("commonMain")!!
|
||||||
|
val commonTest = findByName("commonTest")!!
|
||||||
|
|
||||||
|
val jsCommonMain = create("jsCommonMain").apply {
|
||||||
dependsOn(commonMain)
|
dependsOn(commonMain)
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsCommonTest by creating{
|
val jsCommonTest = create("jsCommonTest").apply {
|
||||||
dependsOn(commonTest)
|
dependsOn(commonTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsMain by getting{
|
findByName("jsMain")?.dependsOn(jsCommonMain)
|
||||||
dependsOn(jsCommonMain)
|
findByName("jsTest")?.dependsOn(jsCommonTest)
|
||||||
}
|
|
||||||
|
|
||||||
val jsTest by getting{
|
findByName("nodeMain")?.apply {
|
||||||
dependsOn(jsCommonTest)
|
|
||||||
}
|
|
||||||
|
|
||||||
val nodeMain by creating {
|
|
||||||
dependsOn(jsCommonMain)
|
dependsOn(jsCommonMain)
|
||||||
dependencies{
|
dependencies {
|
||||||
api("org.jetbrains.kotlinx:kotlinx-nodejs:${KScienceVersions.kotlinxNodeVersion}")
|
api("org.jetbrains.kotlinx:kotlinx-nodejs:${KScienceVersions.kotlinxNodeVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
findByName("nodeTest")?.dependsOn(jsCommonMain)
|
||||||
val nodeTest by creating {
|
|
||||||
dependsOn(jsCommonTest)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user