Build refactoring

This commit is contained in:
Alexander Nozik 2019-04-23 22:05:47 +03:00
commit 56c23109b3
13 changed files with 116 additions and 229 deletions

View File

@ -21,7 +21,7 @@ dependencies {
//jmh project(':kmath-core')
}
jmh{
jmh {
warmupIterations = 1
}

View File

@ -1,36 +1,33 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
val kmathVersion by extra("0.1.2-dev-1")
allprojects {
// apply(plugin = "maven")
// apply(plugin = "maven-publish")
// apply(plugin = "com.jfrog.artifactory")
repositories {
jcenter()
maven("https://kotlin.bintray.com/kotlinx")
}
group = "scientifik"
version = kmathVersion
}
subprojects {
// Actually, probably we should apply it to plugins explicitly
// We also can merge them to single kmath-publish plugin
if (name.startsWith("kmath")) {
// apply bintray configuration
apply(plugin = "bintray-config")
//apply artifactory configuration
apply(plugin = "artifactory-config")
}
plugins.withType<KotlinMultiplatformPlugin> {
apply(plugin = "multiplatform-config")
// dokka {
// outputFormat = "html"
// outputDirectory = javadoc.destinationDir
// }
//
// task dokkaJar (type: Jar, dependsOn: dokka) {
// from javadoc . destinationDir
// classifier = "javadoc"
// dokka {
// outputFormat = "html"
// outputDirectory = javadoc.destinationDir
// }
//
// task dokkaJar (type: Jar, dependsOn: dokka) {
// from javadoc . destinationDir
// classifier = "javadoc"
// }
}
}

View File

@ -4,7 +4,7 @@
object Ver {
val ioVersion = "0.1.5"
val coroutinesVersion = "1.1.1"
val atomicfuVersion = "0.12.1"
val atomicfuVersion = "0.12.4"
// This version is not used and IDEA shows this property as unused
val dokkaVersion = "0.9.17"
}

View File

@ -1,7 +1,6 @@
import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.npm.NpmTask
import com.moowork.gradle.node.task.NodeTask
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
plugins {
@ -9,45 +8,37 @@ plugins {
kotlin("multiplatform")
}
configure<NodeExtension> {
node {
nodeModulesDir = file("$buildDir/node_modules")
}
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
inline fun <reified T : Task> TaskContainer.registering(
crossinline action: T.() -> Unit
): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> =
RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() })
val populateNodeModules by tasks.registering(Copy::class) {
dependsOn(compileKotlinJs)
from(compileKotlinJs.destinationDir)
configure<KotlinMultiplatformExtension> {
val populateNodeModules by tasks.registering(Copy::class) {
dependsOn(compileKotlinJs)
from(compileKotlinJs.destinationDir)
js().compilations["test"].runtimeDependencyFiles.forEach {
if (it.exists() && !it.isDirectory) {
from(zipTree(it.absolutePath).matching { include("*.js") })
}
kotlin.js().compilations["test"].runtimeDependencyFiles.forEach {
if (it.exists() && !it.isDirectory) {
from(zipTree(it.absolutePath).matching { include("*.js") })
}
into("$buildDir/node_modules")
}
val installMocha by tasks.registering<NpmTask> {
setWorkingDir(buildDir)
setArgs(listOf("install", "mocha"))
}
val runMocha by tasks.registering(NodeTask::class) {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
setArgs(listOf(compileTestKotlinJs.outputFile))
}
tasks["jsTest"].dependsOn(runMocha)
into("$buildDir/node_modules")
}
val installMocha by tasks.registering(NpmTask::class) {
setWorkingDir(buildDir)
setArgs(listOf("install", "mocha"))
}
val runMocha by tasks.registering(NodeTask::class) {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
setArgs(listOf(compileTestKotlinJs.outputFile))
}
tasks["jsTest"].dependsOn(runMocha)

View File

@ -11,6 +11,8 @@ kotlin {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
// This was used in kmath-koma, but probably if we need it better to apply it for all modules
freeCompilerArgs += "-progressive"
}
}
}
@ -71,7 +73,7 @@ kotlin {
sourceSets.all {
languageSettings.progressiveMode = true
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("ExperimentalContracts")
//languageSettings.useExperimentalAnnotation("ExperimentalContracts")
//languageSettings.enableLanguageFeature("Contracts")
}
}
@ -116,4 +118,3 @@ kotlin {
}
}

View File

@ -1,23 +1,14 @@
plugins {
kotlin("multiplatform")
`multiplatform-config`
}
val ioVersion: String by rootProject.extra
kotlin {
jvm()
js()
sourceSets {
commonMain {
dependencies {
api(project(":kmath-memory"))
}
kotlin.sourceSets {
commonMain {
dependencies {
api(project(":kmath-memory"))
}
// mingwMain {
// }
// mingwTest {
// }
}
//mingwMain {}
//mingwTest {}
}

View File

@ -1,44 +1,22 @@
plugins {
kotlin("multiplatform")
`multiplatform-config`
}
kotlin {
jvm()
js()
sourceSets.invoke {
commonMain {
dependencies {
api(project(":kmath-core"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Ver.coroutinesVersion}")
}
kotlin.sourceSets {
commonMain {
dependencies {
api(project(":kmath-core"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Ver.coroutinesVersion}")
}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
jvmMain {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Ver.coroutinesVersion}")
}
"jvmMain" {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Ver.coroutinesVersion}")
}
}
"jvmTest" {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
"jsMain" {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Ver.coroutinesVersion}")
}
}
"jsTest" {
dependencies {
implementation(kotlin("test-js"))
}
}
jsMain {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Ver.coroutinesVersion}")
}
}
}

View File

@ -1,33 +1,10 @@
plugins {
kotlin("multiplatform")
`multiplatform-config`
}
kotlin {
jvm()
js()
sourceSets.invoke {
commonMain {
dependencies {
api(project(":kmath-core"))
}
}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
"jvmTest" {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
"jsTest" {
dependencies {
implementation(kotlin("test-js"))
}
}
// Just an example how we can collapse nested DSL for simple declarations
kotlin.sourceSets.commonMain {
dependencies {
api(project(":kmath-core"))
}
}

View File

@ -1,57 +1,31 @@
plugins {
kotlin("multiplatform")
`multiplatform-config`
}
repositories {
maven("http://dl.bintray.com/kyonifer/maven")
}
kotlin {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += "-progressive"
}
kotlin.sourceSets {
commonMain {
dependencies {
api(project(":kmath-core"))
api("com.kyonifer:koma-core-api-common:0.12")
}
}
js()
sourceSets {
val commonMain by getting {
dependencies {
api(project(":kmath-core"))
api("com.kyonifer:koma-core-api-common:0.12")
}
jvmMain {
dependencies {
api("com.kyonifer:koma-core-api-jvm:0.12")
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
jvmTest {
dependencies {
implementation("com.kyonifer:koma-core-ejml:0.12")
}
val jvmMain by getting {
dependencies {
api("com.kyonifer:koma-core-api-jvm:0.12")
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("com.kyonifer:koma-core-ejml:0.12")
}
}
val jsMain by getting {
dependencies {
api("com.kyonifer:koma-core-api-js:0.12")
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
jsMain {
dependencies {
api("com.kyonifer:koma-core-api-js:0.12")
}
}
}

View File

@ -1,16 +1,3 @@
plugins {
kotlin("multiplatform")
}
val ioVersion: String by rootProject.extra
kotlin {
jvm()
js()
// mingwMain {
// }
// mingwTest {
// }
`multiplatform-config`
}

View File

@ -1,34 +1,27 @@
plugins {
kotlin("multiplatform")
id("kotlinx-atomicfu")
`multiplatform-config`
id("kotlinx-atomicfu") version Ver.atomicfuVersion
}
val atomicfuVersion: String by rootProject.extra
kotlin {
jvm ()
js()
sourceSets {
val commonMain by getting {
dependencies {
api(project(":kmath-core"))
api(project(":kmath-coroutines"))
compileOnly("org.jetbrains.kotlinx:atomicfu-common:${Ver.atomicfuVersion}")
}
kotlin.sourceSets {
commonMain {
dependencies {
api(project(":kmath-core"))
api(project(":kmath-coroutines"))
compileOnly("org.jetbrains.kotlinx:atomicfu-common:${Ver.atomicfuVersion}")
}
val jvmMain by getting {
dependencies {
compileOnly("org.jetbrains.kotlinx:atomicfu:${Ver.atomicfuVersion}")
}
}
val jsMain by getting {
dependencies {
compileOnly("org.jetbrains.kotlinx:atomicfu-js:${Ver.atomicfuVersion}")
}
}
}
jvmMain {
dependencies {
compileOnly("org.jetbrains.kotlinx:atomicfu:${Ver.atomicfuVersion}")
}
}
jsMain {
dependencies {
compileOnly("org.jetbrains.kotlinx:atomicfu-js:${Ver.atomicfuVersion}")
}
}
}
atomicfu {

View File

@ -1,9 +1,9 @@
plugins {
kotlin("multiplatform")
id("kotlinx-atomicfu")
id("kotlinx-atomicfu") version Ver.atomicfuVersion
}
val atomicfuVersion: String by rootProject.extra
kotlin {
jvm ()

View File

@ -8,9 +8,7 @@ pluginManagement {
eachPlugin {
when (requested.id.id) {
"kotlinx-atomicfu" -> {
// Just hardcode version here,
// because anyway different submodules cannot use different versions
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.12.1")
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
}
}
}