Added basic native support

This commit is contained in:
Alexander Nozik 2019-07-17 16:04:39 +03:00
parent 1fbf08cbfc
commit 9fdb8ea25b
5 changed files with 36 additions and 12 deletions

View File

@ -3,12 +3,11 @@ import java.util.*
plugins { plugins {
`kotlin-dsl` `kotlin-dsl`
`maven-publish` `maven-publish`
// id("com.gradle.plugin-publish") version "0.10.1"
id("com.jfrog.bintray") version "1.8.4" id("com.jfrog.bintray") version "1.8.4"
} }
group = "scientifik" group = "scientifik"
version = "0.1.3" version = "0.1.4"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()

View File

@ -2,8 +2,8 @@
* Build constants * Build constants
*/ */
object Scientifik { object Scientifik {
val ioVersion = "0.1.10" const val ioVersion = "0.1.11"
val coroutinesVersion = "1.2.2" const val coroutinesVersion = "1.2.2"
val atomicfuVersion = "0.12.9" const val atomicfuVersion = "0.12.9"
val serializationVersion = "0.11.1" const val serializationVersion = "0.11.1"
} }

View File

@ -1,8 +1,16 @@
package scientifik package scientifik
import org.gradle.api.Project
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.findByType
open class ScientifikExtension { open class ScientifikExtension {
var githubProject: String? = null var githubProject: String? = null
var vcs: String? = null var vcs: String? = null
var bintrayRepo: String? = null var bintrayRepo: String? = null
var kdoc: Boolean = true var kdoc: Boolean = true
var enableNative = false
} }
internal val Project.scientifik: ScientifikExtension
get() = extensions.findByType() ?: extensions.create("scientifik")

View File

@ -2,16 +2,15 @@ package scientifik
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.configure import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.getting
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
open class ScientifikMPPlugin : Plugin<Project> { open class ScientifikMPPlugin : Plugin<Project> {
override fun apply(project: Project) { override fun apply(project: Project) {
project.plugins.apply("org.jetbrains.kotlin.multiplatform") project.plugins.apply("org.jetbrains.kotlin.multiplatform")
val extension = project.scientifik
project.configure<KotlinMultiplatformExtension> { project.configure<KotlinMultiplatformExtension> {
jvm { jvm {
compilations.all { compilations.all {
@ -31,6 +30,11 @@ open class ScientifikMPPlugin : Plugin<Project> {
} }
} }
if(extension.enableNative){
linuxX64()
mingwX64()
}
sourceSets.invoke { sourceSets.invoke {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
@ -64,12 +68,25 @@ open class ScientifikMPPlugin : Plugin<Project> {
implementation(kotlin("test-js")) implementation(kotlin("test-js"))
} }
} }
if(extension.enableNative){
val native by creating {
dependsOn(commonMain)
}
mingwX64().compilations["main"].defaultSourceSet {
dependsOn(native)
}
linuxX64().compilations["main"].defaultSourceSet {
dependsOn(native)
}
}
} }
targets.all { targets.all {
sourceSets.all { sourceSets.all {
languageSettings.apply{ languageSettings.apply{
progressiveMode = true progressiveMode = true
this.
enableLanguageFeature("InlineClasses") enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType") useExperimentalAnnotation("ExperimentalUnsignedType")
} }

View File

@ -43,7 +43,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
override fun apply(project: Project) { override fun apply(project: Project) {
project.plugins.apply("maven-publish") project.plugins.apply("maven-publish")
val extension = project.extensions.create<ScientifikExtension>("scientifik") val extension = project.scientifik
if (extension.kdoc) { if (extension.kdoc) {
project.plugins.apply("org.jetbrains.dokka") project.plugins.apply("org.jetbrains.dokka")