Skip to content

Commit

Permalink
Merge pull request #11 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
Alex009 authored Dec 6, 2020
2 parents e4361fe + 608e2c0 commit 1110320
Show file tree
Hide file tree
Showing 27 changed files with 1,402 additions and 24 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![moko-graphics](img/logo.png)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/icerockdev/moko/moko-graphics/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-graphics/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.0-orange)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/icerockdev/moko/moko-graphics/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-graphics/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.20-orange)

# Mobile Kotlin graphics
This is a Kotlin Multiplatform library that provides graphics primitives to common code.
Expand Down Expand Up @@ -32,6 +32,8 @@ This is a Kotlin Multiplatform library that provides graphics primitives to comm
- 0.3.0
- kotlin 1.4.0
- 0.4.0
- kotlin 1.4.20
- 0.5.0

## Installation
root build.gradle
Expand All @@ -46,7 +48,7 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:graphics:0.4.0")
commonMainApi("dev.icerock.moko:graphics:0.5.0")
}
```

Expand Down
8 changes: 4 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

plugins {
id("org.jetbrains.kotlin.jvm") version("1.4.0")
id("org.jetbrains.kotlin.jvm") version("1.4.20")
}

repositories {
Expand All @@ -14,7 +14,7 @@ repositories {
}

dependencies {
implementation("dev.icerock:mobile-multiplatform:0.7.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0")
implementation("com.android.tools.build:gradle:4.0.1")
implementation("dev.icerock:mobile-multiplatform:0.9.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20")
implementation("com.android.tools.build:gradle:4.1.1")
}
13 changes: 5 additions & 8 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

object Deps {
private const val kotlinVersion = "1.4.0"
private const val kotlinVersion = "1.4.20"

private const val androidAppCompatVersion = "1.2.0"
private const val androidAnnotationVersion = "1.1.0"

const val mokoGraphicsVersion = "0.4.0"
const val mokoGraphicsVersion = "0.5.0"

object Android {
const val compileSdk = 28
Expand All @@ -26,7 +26,7 @@ object Deps {
val kotlinMultiPlatform = GradlePlugin(id = "org.jetbrains.kotlin.multiplatform")
val kotlinAndroid = GradlePlugin(id = "kotlin-android")
val mobileMultiPlatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform")
val iosFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.ios-framework")
val appleFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.apple-framework")
val mavenPublish = GradlePlugin(id = "maven-publish")
}

Expand All @@ -39,11 +39,8 @@ object Deps {
}

object MultiPlatform {
val mokoGraphics = MultiPlatformLibrary(
common = "dev.icerock.moko:graphics:$mokoGraphicsVersion",
iosX64 = "dev.icerock.moko:graphics-iosx64:$mokoGraphicsVersion",
iosArm64 = "dev.icerock.moko:graphics-iosarm64:$mokoGraphicsVersion"
)
val mokoGraphics = "dev.icerock.moko:graphics:$mokoGraphicsVersion"
.defaultMPL(android = true, ios = true, macos = true)
}
}
}
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-6.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 4 additions & 0 deletions graphics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ dependencies {
androidMainImplementation(Deps.Libs.Android.annotation)
}

kotlin {
macosX64()
}

publishing {
repositories.maven("https://api.bintray.com/maven/icerockdev/moko/moko-graphics/;publish=1") {
name = "bintray"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ package dev.icerock.moko.graphics

import platform.UIKit.UIColor

@Suppress("unused")
// Used in iOS targets
fun Color.toUIColor(): UIColor {
val maxColorValue: Int = 0xFF
val maxColorValue = 0xFF
return UIColor(
red = red.toDouble() / maxColorValue,
green = green.toDouble() / maxColorValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.icerock.moko.graphics

import platform.AppKit.NSColor

@Suppress("unused")
// Used in macOS targets
fun Color.toNSColor(): NSColor {
val maxColorValue = 0xFF
return NSColor.colorWithCalibratedRed(
red = red.toDouble() / maxColorValue,
green = green.toDouble() / maxColorValue,
blue = blue.toDouble() / maxColorValue,
alpha = alpha.toDouble() / maxColorValue
)
}
7 changes: 4 additions & 3 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
subprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
listOf(
listOfNotNull(
Deps.Libs.MultiPlatform.mokoGraphics.common,
Deps.Libs.MultiPlatform.mokoGraphics.iosX64!!,
Deps.Libs.MultiPlatform.mokoGraphics.iosArm64!!
Deps.Libs.MultiPlatform.mokoGraphics.iosX64,
Deps.Libs.MultiPlatform.mokoGraphics.iosArm64,
Deps.Libs.MultiPlatform.mokoGraphics.macosX64
).forEach {
substitute(module(it)).with(project(":graphics"))
}
Expand Down
4 changes: 2 additions & 2 deletions sample/ios-app/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../mpp-library"

SPEC CHECKSUMS:
MultiPlatformLibrary: 176fb8ade516666cd47e93de1b71ba0441a541bb
MultiPlatformLibrary: 0317a99a1dff77765bdd4ec5a77568f8a96897f0

PODFILE CHECKSUM: 4fe4be1b815729054ce80d124b3c324811469f77

COCOAPODS: 1.9.3
COCOAPODS: 1.10.0
2 changes: 2 additions & 0 deletions sample/ios-app/TestProj.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
buildSettings = {
CURRENT_PROJECT_VERSION = 0;
DEFINES_MODULE = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_VERSION = 4.0;
};
name = Debug;
Expand All @@ -258,6 +259,7 @@
buildSettings = {
CURRENT_PROJECT_VERSION = 0;
DEFINES_MODULE = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_VERSION = 4.0;
};
name = Release;
Expand Down
22 changes: 22 additions & 0 deletions sample/macos-app/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
source 'https://github.com/CocoaPods/Specs.git'

# ignore all warnings from all pods
inhibit_all_warnings!

use_frameworks!
platform :osx, '10.6'

pre_install do |installer|
# We represent a Kotlin/Native module to CocoaPods as a vendored framework.
# CocoaPods needs access to such frameworks during installation process to obtain
# their type (static or dynamic) and configure the Xcode project accordingly.
# Build MultiPlatformLibrary framework to correct install Pod
puts "prepare MultiPlatformLibrary.framework (requires some time...)"
`cd .. && ./gradlew :sample:mpp-library:syncMultiPlatformLibraryDebugFrameworkMacosX64`
puts "preparing MultiPlatformLibrary.framework complete"
end

target 'macos-app' do
# MultiPlatformLibrary
pod 'MultiPlatformLibrary', :path => '../mpp-library'
end
16 changes: 16 additions & 0 deletions sample/macos-app/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- MultiPlatformLibrary (0.1.0)

DEPENDENCIES:
- MultiPlatformLibrary (from `../mpp-library`)

EXTERNAL SOURCES:
MultiPlatformLibrary:
:path: "../mpp-library"

SPEC CHECKSUMS:
MultiPlatformLibrary: 0317a99a1dff77765bdd4ec5a77568f8a96897f0

PODFILE CHECKSUM: 093688805caa68eef74b1e9f93486f94144d88ea

COCOAPODS: 1.10.0
Loading

0 comments on commit 1110320

Please sign in to comment.