From 77fea96b61be0a5959fa850142fdd76ad8d29c7c Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Tue, 18 Jan 2022 11:38:15 +0200 Subject: [PATCH 1/5] Update mobile-multiplatform dependency to "0.13.0" --- graphics-build-logic/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics-build-logic/build.gradle.kts b/graphics-build-logic/build.gradle.kts index 84cbae3..aefce80 100644 --- a/graphics-build-logic/build.gradle.kts +++ b/graphics-build-logic/build.gradle.kts @@ -10,7 +10,7 @@ repositories { } dependencies { - api("dev.icerock:mobile-multiplatform:0.12.0") + api("dev.icerock:mobile-multiplatform:0.13.0") api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20") api("com.android.tools.build:gradle:4.2.1") api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") From 68f75736b21ed6b930393f817f07f291fbedeff1 Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Wed, 19 Jan 2022 09:41:39 +0200 Subject: [PATCH 2/5] Update kotlin to "1.5.31" --- graphics-build-logic/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics-build-logic/build.gradle.kts b/graphics-build-logic/build.gradle.kts index aefce80..038f0a1 100644 --- a/graphics-build-logic/build.gradle.kts +++ b/graphics-build-logic/build.gradle.kts @@ -11,7 +11,7 @@ repositories { dependencies { api("dev.icerock:mobile-multiplatform:0.13.0") - api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20") + api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31") api("com.android.tools.build:gradle:4.2.1") api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") } From 689ce7efed3787901d57898c86b156f60b351e6a Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Wed, 19 Jan 2022 10:19:10 +0200 Subject: [PATCH 3/5] Update kotlin to "1.6.10" --- graphics-build-logic/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics-build-logic/build.gradle.kts b/graphics-build-logic/build.gradle.kts index 038f0a1..67d810e 100644 --- a/graphics-build-logic/build.gradle.kts +++ b/graphics-build-logic/build.gradle.kts @@ -11,7 +11,7 @@ repositories { dependencies { api("dev.icerock:mobile-multiplatform:0.13.0") - api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31") + api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") api("com.android.tools.build:gradle:4.2.1") api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") } From 6856d38cb45e5f6071d6f3f46d8fcfe59a3e62c3 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Fri, 21 Jan 2022 14:45:04 +0700 Subject: [PATCH 4/5] update versions, fix detekt --- .github/workflows/compilation-check.yml | 2 +- .gitignore | 3 ++- README.md | 2 +- build.gradle.kts | 5 ++++ gradle.properties | 2 -- gradle/libs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- graphics-build-logic/build.gradle.kts | 4 ++-- .../kotlin/android-app-convention.gradle.kts | 10 +++----- .../main/kotlin/detekt-convention.gradle.kts | 9 ++++--- ...ultiplatform-library-convention.gradle.kts | 24 ++++++++++++++++++- graphics/build.gradle.kts | 6 ++--- .../kotlin/dev/icerock/moko/graphics/Color.kt | 15 +++++++----- .../dev/icerock/moko/graphics/ColorHEX.kt | 13 +++++----- .../dev/icerock/moko/graphics/ColorExt.kt | 0 sample/mpp-library/build.gradle.kts | 2 ++ settings.gradle.kts | 6 ----- 17 files changed, 65 insertions(+), 42 deletions(-) rename graphics/src/{macosX64Main => macosMain}/kotlin/dev/icerock/moko/graphics/ColorExt.kt (100%) diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index 4e582b6..8d04602 100644 --- a/.github/workflows/compilation-check.yml +++ b/.github/workflows/compilation-check.yml @@ -19,7 +19,7 @@ jobs: with: java-version: 11 - name: Check build - run: ./gradlew build publishToMavenLocal + run: ./gradlew detektWithoutTests build publishToMavenLocal - name: Install pods run: cd sample/ios-app && pod install if: matrix.os == 'macOS-latest' diff --git a/.gitignore b/.gitignore index 77fd544..2441fad 100755 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build Pods xcuserdata local.properties -local.gradle \ No newline at end of file +local.gradle +kotlin-js-store/ \ No newline at end of file diff --git a/README.md b/README.md index 9cfb1ef..7c6bef8 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:graphics:0.8.0") + commonMainApi("dev.icerock.moko:graphics:0.9.0") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index d16dfa9..22a3788 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,3 +18,8 @@ allprojects { version = libs.versions.mokoGraphicsVersion.get() } } + +// temporary fix for Apple Silicon (remove after 1.6.20 update) +rootProject.plugins.withType { + rootProject.the().nodeVersion = "16.0.0" +} diff --git a/gradle.properties b/gradle.properties index a327f19..ab84add 100755 --- a/gradle.properties +++ b/gradle.properties @@ -10,5 +10,3 @@ kotlin.mpp.enableCompatibilityMetadataVariant=true kotlin.native.enableDependencyPropagation=false android.useAndroidX=true - -mobile.multiplatform.iosTargetWarning=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4290d93..ff5defc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] androidAppCompatVersion = "1.2.0" androidAnnotationVersion = "1.1.0" -mokoGraphicsVersion = "0.8.0" +mokoGraphicsVersion = "0.9.0" [libraries] appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf..2e6e589 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/graphics-build-logic/build.gradle.kts b/graphics-build-logic/build.gradle.kts index 67d810e..e8b30b4 100644 --- a/graphics-build-logic/build.gradle.kts +++ b/graphics-build-logic/build.gradle.kts @@ -12,6 +12,6 @@ repositories { dependencies { api("dev.icerock:mobile-multiplatform:0.13.0") api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") - api("com.android.tools.build:gradle:4.2.1") - api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") + api("com.android.tools.build:gradle:7.0.4") + api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0") } diff --git a/graphics-build-logic/src/main/kotlin/android-app-convention.gradle.kts b/graphics-build-logic/src/main/kotlin/android-app-convention.gradle.kts index 2859874..5a69dab 100644 --- a/graphics-build-logic/src/main/kotlin/android-app-convention.gradle.kts +++ b/graphics-build-logic/src/main/kotlin/android-app-convention.gradle.kts @@ -9,10 +9,6 @@ plugins { } android { - dexOptions { - javaMaxHeapSize = "2g" - } - buildTypes { getByName("release") { isMinifyEnabled = true @@ -25,8 +21,8 @@ android { } packagingOptions { - exclude("META-INF/*.kotlin_module") - exclude("META-INF/AL2.0") - exclude("META-INF/LGPL2.1") + resources.excludes.add("META-INF/*.kotlin_module") + resources.excludes.add("META-INF/AL2.0") + resources.excludes.add("META-INF/LGPL2.1") } } diff --git a/graphics-build-logic/src/main/kotlin/detekt-convention.gradle.kts b/graphics-build-logic/src/main/kotlin/detekt-convention.gradle.kts index 68343a8..7d7c654 100644 --- a/graphics-build-logic/src/main/kotlin/detekt-convention.gradle.kts +++ b/graphics-build-logic/src/main/kotlin/detekt-convention.gradle.kts @@ -2,14 +2,17 @@ * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ +import io.gitlab.arturbosch.detekt.Detekt + plugins { id("io.gitlab.arturbosch.detekt") } -detekt { - input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin", "src/main/kotlin") +tasks.register("detektWithoutTests") { + group = "verification" + dependsOn(tasks.withType().matching { it.name.contains("Test").not() }) } dependencies { - "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0") + "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.19.0") } diff --git a/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts b/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts index 161a7e7..0f08e2b 100644 --- a/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts +++ b/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts @@ -1,3 +1,5 @@ +import gradle.kotlin.dsl.accessors._62b456da1d13c24405f15ede2977b266.sourceSets + /* * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ @@ -10,13 +12,17 @@ plugins { } kotlin { - ios() android { publishLibraryVariants("release", "debug") } + ios() + iosSimulatorArm64() macosX64() + macosArm64() tvos() + tvosSimulatorArm64() watchos() + watchosSimulatorArm64() jvm() js(BOTH) { nodejs() @@ -25,6 +31,22 @@ kotlin { linux() windows() wasm32() + + sourceSets { + val commonMain by getting + + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) + + val macosMain by creating + macosMain.dependsOn(commonMain) + + val macosX64Main by getting + val macosArm64Main by getting + macosX64Main.dependsOn(macosMain) + macosArm64Main.dependsOn(macosMain) + } } fun org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension.linux() { diff --git a/graphics/build.gradle.kts b/graphics/build.gradle.kts index 71b0c12..c0606c4 100644 --- a/graphics/build.gradle.kts +++ b/graphics/build.gradle.kts @@ -2,11 +2,9 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ -import java.util.Base64 -import kotlin.text.String - plugins { id("multiplatform-library-convention") + id("detekt-convention") id("dev.icerock.mobile.multiplatform.android-manifest") id("publication-convention") } @@ -15,5 +13,5 @@ group = "dev.icerock.moko" version = libs.versions.mokoGraphicsVersion.get() dependencies { - "androidMainImplementation"(libs.annotation) + androidMainImplementation(libs.annotation) } diff --git a/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/Color.kt b/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/Color.kt index dbe4910..0c33bba 100755 --- a/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/Color.kt +++ b/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/Color.kt @@ -10,16 +10,19 @@ data class Color( val blue: Int, val alpha: Int ) { + @Suppress("MagicNumber") val rgba: Long = alpha.toLong() or - blue.toLong().shl(8) or - green.toLong().shl(16) or - red.toLong().shl(24) + blue.toLong().shl(8) or + green.toLong().shl(16) or + red.toLong().shl(24) + @Suppress("MagicNumber") val argb: Long = blue.toLong() or - green.toLong().shl(8) or - red.toLong().shl(16) or - alpha.toLong().shl(24) + green.toLong().shl(8) or + red.toLong().shl(16) or + alpha.toLong().shl(24) + @Suppress("MagicNumber") constructor(colorRGBA: Long) : this( red = (colorRGBA.shr(24) and 0xFF).toInt(), green = (colorRGBA.shr(16) and 0xFF).toInt(), diff --git a/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/ColorHEX.kt b/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/ColorHEX.kt index e4575a7..58aefb3 100644 --- a/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/ColorHEX.kt +++ b/graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/ColorHEX.kt @@ -4,18 +4,19 @@ package dev.icerock.moko.graphics +@Suppress("MagicNumber") fun Color.Companion.parseColor(colorHEX: String): Color { if (colorHEX[0] != '#') throw IllegalArgumentException("Unknown color") - var ARGB = colorHEX.substring(1).toLong(16) + var colorARGB = colorHEX.substring(1).toLong(16) if (colorHEX.length == 7) { - ARGB = ARGB or 0x00000000ff000000 + colorARGB = colorARGB or 0x00000000ff000000 } else if (colorHEX.length != 9) { throw IllegalArgumentException("Unknown color") } return Color( - alpha = (ARGB.shr(24) and 0xFF).toInt(), - red = (ARGB.shr(16) and 0xFF).toInt(), - green = (ARGB.shr(8) and 0xFF).toInt(), - blue = (ARGB.shr(0) and 0xFF).toInt(), + alpha = (colorARGB.shr(24) and 0xFF).toInt(), + red = (colorARGB.shr(16) and 0xFF).toInt(), + green = (colorARGB.shr(8) and 0xFF).toInt(), + blue = (colorARGB.shr(0) and 0xFF).toInt(), ) } diff --git a/graphics/src/macosX64Main/kotlin/dev/icerock/moko/graphics/ColorExt.kt b/graphics/src/macosMain/kotlin/dev/icerock/moko/graphics/ColorExt.kt similarity index 100% rename from graphics/src/macosX64Main/kotlin/dev/icerock/moko/graphics/ColorExt.kt rename to graphics/src/macosMain/kotlin/dev/icerock/moko/graphics/ColorExt.kt diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index a82de92..2c142c8 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -14,7 +14,9 @@ plugins { kotlin { android() ios() + iosSimulatorArm64() macosX64() + macosArm64() targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java).all { binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all { export(projects.graphics) diff --git a/settings.gradle.kts b/settings.gradle.kts index 6b64ae4..527ec2d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,12 +9,6 @@ dependencyResolutionManagement { repositories { mavenCentral() google() - - jcenter { - content { - includeGroup("org.jetbrains.kotlinx") - } - } } } From fee5f10f699777575c25a7ac969887885a66f482 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Fri, 21 Jan 2022 14:47:31 +0700 Subject: [PATCH 5/5] remove invalid import --- .../src/main/kotlin/multiplatform-library-convention.gradle.kts | 2 -- 1 file changed, 2 deletions(-) diff --git a/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts b/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts index 0f08e2b..8598940 100644 --- a/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts +++ b/graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts @@ -1,5 +1,3 @@ -import gradle.kotlin.dsl.accessors._62b456da1d13c24405f15ede2977b266.sourceSets - /* * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */