Kotlin 1.4.20 #4
@ -19,6 +19,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
|
||||
//Configuration for K-JVM plugin
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
//logger.info("Applying KScience configuration for JVM project")
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
@ -37,6 +38,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||
//logger.info("Applying KScience configuration for JS project")
|
||||
configure<KotlinJsProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
@ -117,7 +119,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
tasks.apply {
|
||||
withType<KotlinJvmCompile> {
|
||||
kotlinOptions {
|
||||
// useIR = true
|
||||
// useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,12 @@ package ru.mipt.npm.gradle
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.findPlugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
open class KScienceMPPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
||||
}
|
||||
plugins.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
|
@ -5,14 +5,13 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
class KScienceNativePlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) = target.run {
|
||||
//Apply multiplatform plugin is not applied, apply it
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
||||
}
|
||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||
|
@ -4,7 +4,6 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
/**
|
||||
* Create a separate target for node
|
||||
@ -12,9 +11,9 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
class KScienceNodePlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) = target.run {
|
||||
//Apply multiplatform plugin is not applied, apply it
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
||||
}
|
||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||
|
@ -1,8 +1,7 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import kotlinx.atomicfu.plugin.gradle.sourceSets
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.findByType
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.invoke
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
|
||||
@ -23,7 +22,7 @@ internal fun Project.useDependency(
|
||||
dependencyConfiguration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
||||
) {
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
sourceSets {
|
||||
pairs.forEach { (target, dep) ->
|
||||
val name = target + dependencySourceSet.suffix
|
||||
@ -38,8 +37,7 @@ internal fun Project.useDependency(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pairs.find { it.first == "jvm" }?.let { dep ->
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
@ -70,15 +68,18 @@ internal fun Project.useDependency(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Project.useCommonDependency(
|
||||
dep: String,
|
||||
dependencySourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
dependencyConfiguration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
||||
): Unit = pluginManager.run{
|
||||
withPlugin("org.jetbrains.kotlin.multiplatform"){
|
||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
||||
): Unit = pluginManager.run {
|
||||
withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
sourceSets.findByName("common${dependencySourceSet.suffix}")?.apply {
|
||||
dependencies {
|
||||
when (dependencyConfiguration) {
|
||||
@ -88,8 +89,7 @@ internal fun Project.useCommonDependency(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||
dependencies.apply {
|
||||
@ -114,4 +114,6 @@ internal fun Project.useCommonDependency(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user