Add application clause to the Extension

This commit is contained in:
Alexander Nozik 2020-09-01 20:21:41 +03:00
parent 02cd531800
commit a066953872

View File

@ -1,10 +1,10 @@
package ru.mipt.npm.gradle
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.findPlugin
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
class KScienceExtension(val project: Project) {
@ -45,6 +45,25 @@ class KScienceExtension(val project: Project) {
SerializationTargets(sourceSet, configuration).apply(block)
}
/**
* Mark this module as an application module. JVM application should be enabled separately
*/
fun application() {
project.extensions.configure<KotlinProjectExtension> {
explicitApi = null
}
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
js {
binaries.executable()
}
}
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
js{
binaries.executable()
}
}
}
/**
* Activate publishing and configure it
*/