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 {
`kotlin-dsl`
`maven-publish`
// id("com.gradle.plugin-publish") version "0.10.1"
id("com.jfrog.bintray") version "1.8.4"
}
group = "scientifik"
version = "0.1.3"
version = "0.1.4"
repositories {
gradlePluginPortal()

View File

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

View File

@ -1,8 +1,16 @@
package scientifik
import org.gradle.api.Project
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.findByType
open class ScientifikExtension {
var githubProject: String? = null
var vcs: String? = null
var bintrayRepo: String? = null
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.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.getting
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
open class ScientifikMPPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.plugins.apply("org.jetbrains.kotlin.multiplatform")
val extension = project.scientifik
project.configure<KotlinMultiplatformExtension> {
jvm {
compilations.all {
@ -31,6 +30,11 @@ open class ScientifikMPPlugin : Plugin<Project> {
}
}
if(extension.enableNative){
linuxX64()
mingwX64()
}
sourceSets.invoke {
val commonMain by getting {
dependencies {
@ -64,12 +68,25 @@ open class ScientifikMPPlugin : Plugin<Project> {
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 {
sourceSets.all {
languageSettings.apply{
progressiveMode = true
this.
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("ExperimentalUnsignedType")
}

View File

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