Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
1.6.0 - Gradle 5.2 - Kotlin 1.3.21 - custom kotlinx.coroutines 1.1.1-…
Browse files Browse the repository at this point in the history
…1.3.21-no-metadata - klock 1.2.0 - kds,kmem 1.6.0 - no metadata
  • Loading branch information
soywiz committed Feb 6, 2019
1 parent fceb5ec commit ad710ba
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 36 deletions.
9 changes: 7 additions & 2 deletions build.gradle.kts
Expand Up @@ -16,7 +16,6 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:3.3.0")
classpath(kotlin("gradle-plugin", version = "1.3.20"))
}
}

Expand All @@ -31,7 +30,7 @@ if (!hasAndroid) {
}

plugins {
id("kotlin-multiplatform").version("1.3.20")
id("kotlin-multiplatform").version("1.3.21")
id("com.moowork.node").version("1.2.0")
}

Expand All @@ -49,6 +48,12 @@ allprojects {
excludeGroup("Kotlin/Native")
}
}
maven {
url = uri("https://dl.bintray.com/kotlin/kotlinx")
content {
excludeGroup("Kotlin/Native")
}
}
jcenter() {
content {
excludeGroup("Kotlin/Native")
Expand Down
70 changes: 48 additions & 22 deletions build.project.gradle.kts
Expand Up @@ -4,7 +4,7 @@ val pname = "korio"

File(projectDir, "$pname/src/commonMain/kotlin/com/soywiz/$pname/internal/${pname.capitalize()}Version.kt").apply {
parentFile.mkdirs()
val newText = "package com.soywiz.$pname.internal\n\ninternal const val ${pname.toUpperCase()}_VERSION = \"${project.property("projectVersion")}\""
val newText = "package com.soywiz.$pname.internal\n\ninternal const val ${pname.toUpperCase()}_VERSION = \"${project.version}\""
if (!exists() || (readText() != newText)) writeText(newText)
}

Expand All @@ -19,23 +19,25 @@ class Deps {
val klock = DepKorlib("klock")
val kmem = DepKorlib("kmem")
val kds = DepKorlib("kds")
val kotlinxCoroutines = Dep {
val coroutinesVersion: String by project
val coroutines = "kotlinx-coroutines-core"
add("commonMainApi", "org.jetbrains.kotlinx:$coroutines-common:$coroutinesVersion")
add("jvmMainApi", "org.jetbrains.kotlinx:$coroutines:$coroutinesVersion")
add("jsMainApi", "org.jetbrains.kotlinx:$coroutines-js:$coroutinesVersion")
if (hasAndroid) {
add("androidMainApi", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
add("androidTestImplementation", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
}
add("linuxX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_linux_x64:$coroutinesVersion")
add("mingwX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_mingw_x64:$coroutinesVersion")
add("macosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_macos_x64:$coroutinesVersion")
add("iosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_x64:$coroutinesVersion")
add("iosArm32MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm32:$coroutinesVersion")
add("iosArm64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm64:$coroutinesVersion")
}
val kotlinxCoroutines = DepKorlib("kotlinx-coroutines")
//val kotlinxCoroutines = Dep {
// val coroutinesVersion: String by project
// val coroutines = "kotlinx-coroutines-core"
// add("commonMainApi", "org.jetbrains.kotlinx:$coroutines-common:$coroutinesVersion")
// add("jvmMainApi", "org.jetbrains.kotlinx:$coroutines:$coroutinesVersion")
// add("jsMainApi", "org.jetbrains.kotlinx:$coroutines-js:$coroutinesVersion")
// if (hasAndroid) {
// add("androidMainApi", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
// add("androidTestImplementation", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
// }
// add("linuxX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_linux_x64:$coroutinesVersion")
// add("mingwX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_mingw_x64:$coroutinesVersion")
// add("macosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_macos_x64:$coroutinesVersion")
// add("iosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_x64:$coroutinesVersion")
// add("iosArm32MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm32:$coroutinesVersion")
// add("iosArm64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm64:$coroutinesVersion")
// addCommon("org.jetbrains", "kotlinx:atomicfu", "0.12.1", commonRename = true, androidIsJvm = true)
//}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -44,18 +46,42 @@ class Deps {
fun DepKorlib(name: String) = Dep("com.soywiz:$name:${project.property("${name}Version")}")
class Dep(val commonName: String? = null, val project: String ? = null, val register: (DependencyHandlerScope.() -> Unit)? = null)

val ALL_TARGETS = listOf("android", "iosArm64", "iosArm32", "iosX64", "js", "jvm", "linuxX64", "macosX64", "mingwX64", "metadata")

fun DependencyHandler.addCommon(group: String, name: String, version: String, targets: List<String> = ALL_TARGETS, suffixCommonRename: Boolean = false, androidIsJvm: Boolean = true) {
for (target in targets) {
val base = when (target) {
"metadata" -> "common"
else -> target
}
val suffix = when {
target == "android" && androidIsJvm -> "-jvm"
target == "metadata" && suffixCommonRename -> "-common"
else -> "-${target.toLowerCase()}"
}

val packed = "$group:$name$suffix:$version"
add("${base}MainApi", packed)
add("${base}TestImplementation", packed)
}
}

fun DependencyHandler.addCommon(dependency: String, targets: List<String> = ALL_TARGETS) {
val (group, name, version) = dependency.split(":", limit = 3)
return addCommon(group, name, version, targets)
}

subprojects {
val deps = projDeps[project.name]
if (deps != null) {
dependencies {
for (dep in deps) {
if (dep.commonName != null) {
add("commonMainApi", dep.commonName)
add("commonTestImplementation", dep.commonName)
addCommon(dep.commonName)
}
if (dep.project != null) {
add("commonMainApi", project(dep.project))
add("commonTestImplementation", project(dep.project))
add("commonMainApi", rootProject.project(dep.project))
add("commonTestImplementation", rootProject.project(dep.project))
}
dep.register?.invoke(this)
}
Expand Down
12 changes: 7 additions & 5 deletions gradle.properties
Expand Up @@ -2,15 +2,17 @@
kotlin.code.style=official

# version
projectVersion=1.5.0
group=com.soywiz
version=1.6.0

# kotlinx
coroutinesVersion=1.1.1
#coroutinesVersion=1.1.1
kotlinx-coroutinesVersion=1.1.1-1.3.21-no-metadata

# korlibs
klockVersion=1.1.1
kdsVersion=1.5.0
kmemVersion=1.5.0
klockVersion=1.2.0
kdsVersion=1.6.0
kmemVersion=1.6.0

# project info
project.package=korio
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
@@ -1,3 +1,3 @@
package com.soywiz.korio.internal

internal const val KORIO_VERSION = "1.5.0"
internal const val KORIO_VERSION = "1.6.0"
3 changes: 0 additions & 3 deletions settings.gradle.kts
Expand Up @@ -11,12 +11,9 @@ pluginManagement {
mavenLocal()
mavenCentral()
maven { url = uri("https://plugins.gradle.org/m2/") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-eap") }
}
}

enableFeaturePreview("GRADLE_METADATA")

rootProject.name = java.util.Properties().apply { load(File(rootProject.projectDir, "gradle.properties").readText().reader()) }.getProperty("project.name")

include(":korio")

0 comments on commit ad710ba

Please sign in to comment.