Added JVM and JS plugins
This commit is contained in:
parent
1a98759c2b
commit
64eaabb443
@ -12,6 +12,7 @@ version = "0.1.4-dev"
|
|||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven("https://kotlin.bintray.com/kotlinx")
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ val kotlinVersion = "1.3.50-eap-5"
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.12.9")
|
||||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
||||||
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
||||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18")
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18")
|
||||||
@ -33,11 +35,24 @@ gradlePlugin {
|
|||||||
description = "The publication plugin for bintray and artifactory"
|
description = "The publication plugin for bintray and artifactory"
|
||||||
implementationClass = "scientifik.ScientifikPublishPlugin"
|
implementationClass = "scientifik.ScientifikPublishPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("scientifik-mpp") {
|
create("scientifik-mpp") {
|
||||||
id = "scientifik.mpp"
|
id = "scientifik.mpp"
|
||||||
description = "Pre-configured multiplatform project"
|
description = "Pre-configured multiplatform project"
|
||||||
implementationClass = "scientifik.ScientifikMPPlugin"
|
implementationClass = "scientifik.ScientifikMPPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create("scientifik-jvm") {
|
||||||
|
id = "scientifik.jvm"
|
||||||
|
description = "Pre-configured JVM project"
|
||||||
|
implementationClass = "scientifik.ScientifikJVMPlugin"
|
||||||
|
}
|
||||||
|
|
||||||
|
create("scientifik-js") {
|
||||||
|
id = "scientifik.js"
|
||||||
|
description = "Pre-configured JS project"
|
||||||
|
implementationClass = "scientifik.ScientifikJSPlugin"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ open class ScientifikExtension {
|
|||||||
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 native = false
|
internal var native = false
|
||||||
var serialization = false
|
var serialization = false
|
||||||
|
var atomicfu = false
|
||||||
|
var io = false
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val Project.scientifik: ScientifikExtension
|
internal val Project.scientifik: ScientifikExtension
|
||||||
|
62
src/main/kotlin/scientifik/ScientifikJSPlugin.kt
Normal file
62
src/main/kotlin/scientifik/ScientifikJSPlugin.kt
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package scientifik
|
||||||
|
|
||||||
|
import Scientifik
|
||||||
|
import kotlinx.atomicfu.plugin.gradle.sourceSets
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
|
||||||
|
open class ScientifikJSPlugin : Plugin<Project> {
|
||||||
|
override fun apply(project: Project) {
|
||||||
|
val extension = project.scientifik
|
||||||
|
|
||||||
|
with(project) {
|
||||||
|
plugins.apply("org.jetbrains.kotlin.js")
|
||||||
|
plugins.apply("kotlinx-serialization")
|
||||||
|
plugins.apply("kotlinx-atomicfu")
|
||||||
|
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
maven("https://kotlin.bintray.com/kotlinx")
|
||||||
|
maven("https://dl.bintray.com/mipt-npm/dev")
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<KotlinJsProjectExtension>{
|
||||||
|
target{
|
||||||
|
browser()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets["main"].apply {
|
||||||
|
this as KotlinSourceSet
|
||||||
|
languageSettings.apply {
|
||||||
|
progressiveMode = true
|
||||||
|
enableLanguageFeature("InlineClasses")
|
||||||
|
useExperimentalAnnotation("ExperimentalUnsignedType")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
this as KotlinDependencyHandler
|
||||||
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
if (extension.serialization) {
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
|
||||||
|
}
|
||||||
|
if (extension.atomicfu) {
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu-js:${Scientifik.atomicfuVersion}")
|
||||||
|
}
|
||||||
|
if (extension.io) {
|
||||||
|
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
61
src/main/kotlin/scientifik/ScientifikJVMPlugin.kt
Normal file
61
src/main/kotlin/scientifik/ScientifikJVMPlugin.kt
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package scientifik
|
||||||
|
|
||||||
|
import Scientifik
|
||||||
|
import kotlinx.atomicfu.plugin.gradle.sourceSets
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
open class ScientifikJVMPlugin : Plugin<Project> {
|
||||||
|
override fun apply(project: Project) {
|
||||||
|
val extension = project.scientifik
|
||||||
|
|
||||||
|
with(project) {
|
||||||
|
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||||
|
plugins.apply("kotlinx-serialization")
|
||||||
|
plugins.apply("kotlinx-atomicfu")
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
maven("https://kotlin.bintray.com/kotlinx")
|
||||||
|
maven("https://dl.bintray.com/mipt-npm/dev")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile> {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets["main"].apply {
|
||||||
|
this as KotlinSourceSet
|
||||||
|
languageSettings.apply {
|
||||||
|
progressiveMode = true
|
||||||
|
enableLanguageFeature("InlineClasses")
|
||||||
|
useExperimentalAnnotation("ExperimentalUnsignedType")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
this as KotlinDependencyHandler
|
||||||
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
if (extension.serialization) {
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
|
||||||
|
}
|
||||||
|
if (extension.atomicfu) {
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
|
||||||
|
}
|
||||||
|
if (extension.io) {
|
||||||
|
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ open class ScientifikMPPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
project.plugins.apply("org.jetbrains.kotlin.multiplatform")
|
project.plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
project.plugins.apply("kotlinx-serialization")
|
project.plugins.apply("kotlinx-serialization")
|
||||||
|
project.plugins.apply("kotlinx-atomicfu")
|
||||||
|
|
||||||
project.repositories {
|
project.repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -45,7 +46,13 @@ open class ScientifikMPPlugin : Plugin<Project> {
|
|||||||
api(kotlin("stdlib"))
|
api(kotlin("stdlib"))
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
if (extension.serialization) {
|
if (extension.serialization) {
|
||||||
api("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
|
||||||
|
}
|
||||||
|
if(extension.atomicfu){
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu-common:${Scientifik.atomicfuVersion}")
|
||||||
|
}
|
||||||
|
if(extension.io){
|
||||||
|
api("org.jetbrains.kotlinx:kotlinx-io-common:${Scientifik.ioVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,6 +66,12 @@ open class ScientifikMPPlugin : Plugin<Project> {
|
|||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("stdlib-jdk8"))
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
if(extension.atomicfu){
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
|
||||||
|
}
|
||||||
|
if(extension.io){
|
||||||
|
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jvmTest by getting {
|
val jvmTest by getting {
|
||||||
@ -70,6 +83,12 @@ open class ScientifikMPPlugin : Plugin<Project> {
|
|||||||
val jsMain by getting {
|
val jsMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("stdlib-js"))
|
api(kotlin("stdlib-js"))
|
||||||
|
if(extension.atomicfu){
|
||||||
|
implementation("org.jetbrains.kotlinx:atomicfu-common-js:${Scientifik.atomicfuVersion}")
|
||||||
|
}
|
||||||
|
if(extension.io){
|
||||||
|
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsTest by getting {
|
val jsTest by getting {
|
||||||
|
Loading…
Reference in New Issue
Block a user