Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.9.0 #30

Merged
merged 6 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ build
Pods
xcuserdata
local.properties
local.gradle
local.gradle
kotlin-js-store/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
```

Expand Down
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ allprojects {
version = libs.versions.mokoGraphicsVersion.get()
}
}

// temporary fix for Apple Silicon (remove after 1.6.20 update)
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.0.0"
}
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ kotlin.mpp.enableCompatibilityMetadataVariant=true
kotlin.native.enableDependencyPropagation=false

android.useAndroidX=true

mobile.multiplatform.iosTargetWarning=false
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions graphics-build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ repositories {
}

dependencies {
api("dev.icerock:mobile-multiplatform:0.12.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")
api("dev.icerock:mobile-multiplatform:0.13.0")
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
api("com.android.tools.build:gradle:7.0.4")
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ plugins {
}

android {
dexOptions {
javaMaxHeapSize = "2g"
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
Expand All @@ -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")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Detekt>().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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ plugins {
}

kotlin {
ios()
android {
publishLibraryVariants("release", "debug")
}
ios()
iosSimulatorArm64()
macosX64()
macosArm64()
tvos()
tvosSimulatorArm64()
watchos()
watchosSimulatorArm64()
jvm()
js(BOTH) {
nodejs()
Expand All @@ -25,6 +29,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() {
Expand Down
6 changes: 2 additions & 4 deletions graphics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -15,5 +13,5 @@ group = "dev.icerock.moko"
version = libs.versions.mokoGraphicsVersion.get()

dependencies {
"androidMainImplementation"(libs.annotation)
androidMainImplementation(libs.annotation)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
}
2 changes: 2 additions & 0 deletions sample/mpp-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ dependencyResolutionManagement {
repositories {
mavenCentral()
google()

jcenter {
content {
includeGroup("org.jetbrains.kotlinx")
}
}
}
}

Expand Down