Skip to content

Commit

Permalink
Merge pull request #39 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.7.0
  • Loading branch information
Alex009 authored Apr 7, 2021
2 parents 5fef4f4 + 5b9b4d8 commit 22d1705
Show file tree
Hide file tree
Showing 25 changed files with 733 additions and 323 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- develop

jobs:
build:
test:
runs-on: macOS-latest

steps:
Expand All @@ -16,5 +16,17 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Check build
run: ./gradlew build publishToMavenLocal
- name: Build K/N cache
run: ./gradlew :media:runCommonizer
- name: Build and test
run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64 -x linkMultiPlatformLibraryDebugFrameworkIosArm64 -x linkMultiPlatformLibraryReleaseFrameworkIosArm64 -x linkMultiPlatformLibraryReleaseFrameworkIosX64
- name: Install pods
run: cd sample/ios-app && pod install
- name: build ios sample
run: cd sample/ios-app && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
if: ${{ always() }}
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ TODO
### mavenCentral
- kotlin 1.4.31
- 0.6.2
- 0.7.0

## Installation
root build.gradle
Expand All @@ -57,7 +58,7 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:media:0.6.2")
commonMainApi("dev.icerock.moko:media:0.7.0")
}
```

Expand Down
77 changes: 77 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

import java.util.Base64

allprojects {
repositories {
mavenCentral()
Expand All @@ -26,6 +28,81 @@ allprojects {
}
}
}

plugins.withId(Deps.Plugins.mavenPublish.id) {
group = "dev.icerock.moko"
version = Deps.mokoMediaVersion

val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

configure<PublishingExtension> {
repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
name = "OSSRH"

credentials {
username = System.getenv("OSSRH_USER")
password = System.getenv("OSSRH_KEY")
}
}

publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())

// Provide artifacts information requited by Maven Central
pom {
name.set("MOKO media")
description.set("Media selection & presenting for mobile (android & ios) Kotlin Multiplatform development")
url.set("https://github.com/icerockdev/moko-media")
licenses {
license {
url.set("https://github.com/icerockdev/moko-media/blob/master/LICENSE.md")
}
}

developers {
developer {
id.set("Alex009")
name.set("Aleksey Mikhailov")
email.set("[email protected]")
}
developer {
id.set("Tetraquark")
name.set("Vladislav Areshkin")
email.set("[email protected]")
}
developer {
id.set("RezMike")
name.set("Mikhail Reznichenko")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:ssh://github.com/icerockdev/moko-media.git")
developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-media.git")
url.set("https://github.com/icerockdev/moko-media")
}
}
}

apply(plugin = Deps.Plugins.signing.id)

configure<SigningExtension> {
val signingKeyId: String? = System.getenv("SIGNING_KEY_ID")
val signingPassword: String? = System.getenv("SIGNING_PASSWORD")
val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key ->
String(Base64.getDecoder().decode(base64Key))
}
if (signingKeyId != null) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publications)
}
}
}
}
}

tasks.register("clean", Delete::class).configure {
Expand Down
18 changes: 10 additions & 8 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ object Deps {
private const val androidMediaFilePicker = "1.8"

private const val coroutinesVersion = "1.4.2"
private const val mokoMvvmVersion = "0.9.2"
private const val mokoPermissionsVersion = "0.8.0"
const val mokoMediaVersion = "0.6.2"
private const val mokoMvvmVersion = "0.10.0"
private const val mokoPermissionsVersion = "0.9.0"
private const val mokoTestVersion = "0.2.1"
const val mokoMediaVersion = "0.7.0"

object Android {
const val compileSdk = 28
Expand Down Expand Up @@ -47,11 +48,8 @@ object Deps {
object MultiPlatform {
const val coroutines =
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
val mokoPermissions = MultiPlatformLibrary(
common = "dev.icerock.moko:permissions:$mokoPermissionsVersion",
iosX64 = "dev.icerock.moko:permissions-iosx64:$mokoPermissionsVersion",
iosArm64 = "dev.icerock.moko:permissions-iosarm64:$mokoPermissionsVersion"
)
val mokoPermissions = "dev.icerock.moko:permissions:$mokoPermissionsVersion"
.defaultMPL(ios = true)
const val mokoMvvmCore = "dev.icerock.moko:mvvm-core:$mokoMvvmVersion"
const val mokoMvvmLiveData = "dev.icerock.moko:mvvm-livedata:$mokoMvvmVersion"
const val mokoMedia = "dev.icerock.moko:media:$mokoMediaVersion"
Expand All @@ -62,6 +60,10 @@ object Deps {
"org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
const val androidCoreTesting =
"androidx.arch.core:core-testing:$androidCoreTestingVersion"
const val mokoTest = "dev.icerock.moko:test:$mokoTestVersion"
const val mokoMvvmTest = "dev.icerock.moko:mvvm-test:$mokoMvvmVersion"
const val mokoPermissionsTest =
"dev.icerock.moko:permissions-test:$mokoPermissionsVersion"
}
}
}
18 changes: 18 additions & 0 deletions media-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
plugin(Deps.Plugins.androidLibrary)
plugin(Deps.Plugins.kotlinMultiplatform)
plugin(Deps.Plugins.mobileMultiplatform)
plugin(Deps.Plugins.mavenPublish)
}

dependencies {
commonMainApi(project(":media"))

androidMainImplementation(Deps.Libs.Android.appCompat)

commonTestImplementation(Deps.Libs.Tests.mokoTest)
}
2 changes: 2 additions & 0 deletions media-test/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="dev.icerock.moko.media.test"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import dev.icerock.moko.media.Bitmap
import dev.icerock.moko.media.FileMedia
import dev.icerock.moko.media.Media
import dev.icerock.moko.media.picker.MediaPickerController
import dev.icerock.moko.media.picker.MediaSource
import dev.icerock.moko.permissions.PermissionsController

actual open class MediaPickerControllerMock actual constructor(
actual override val permissionsController: PermissionsController
) : MediaPickerController {
actual override suspend fun pickImage(source: MediaSource): Bitmap {
TODO("Not yet implemented")
}

actual override suspend fun pickImage(
source: MediaSource,
maxWidth: Int,
maxHeight: Int
): Bitmap {
TODO("Not yet implemented")
}

actual override suspend fun pickMedia(): Media {
TODO("Not yet implemented")
}

actual override suspend fun pickFiles(): FileMedia {
TODO("Not yet implemented")
}

override fun bind(
lifecycle: androidx.lifecycle.Lifecycle,
fragmentManager: androidx.fragment.app.FragmentManager
) {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import dev.icerock.moko.media.Bitmap

actual fun createBitmapMock(): Bitmap {
return Bitmap(object : Bitmap.Delegate {
override fun getAndroidBitmap(): android.graphics.Bitmap {
TODO("Not yet implemented")
}

override fun getByteArray(): ByteArray {
return ByteArray(0)
}

override fun getResized(maxSize: Int): Bitmap {
return createBitmapMock()
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import dev.icerock.moko.media.Bitmap
import dev.icerock.moko.media.FileMedia
import dev.icerock.moko.media.Media
import dev.icerock.moko.media.picker.MediaPickerController
import dev.icerock.moko.media.picker.MediaSource
import dev.icerock.moko.permissions.PermissionsController

expect open class MediaPickerControllerMock constructor(
permissionsController: PermissionsController
) : MediaPickerController {
override val permissionsController: PermissionsController

override suspend fun pickImage(source: MediaSource): Bitmap
override suspend fun pickImage(
source: MediaSource,
maxWidth: Int,
maxHeight: Int
): Bitmap

override suspend fun pickMedia(): Media
override suspend fun pickFiles(): FileMedia
}

fun createMediaPickerControllerMock(
permissionsController: PermissionsController,
galleryImageResult: Bitmap,
cameraImageResult: Bitmap
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) {
override suspend fun pickImage(source: MediaSource): Bitmap {
return source.result()
}

override suspend fun pickImage(source: MediaSource, maxWidth: Int, maxHeight: Int): Bitmap {
return source.result()
}

private fun MediaSource.result() = when (this) {
MediaSource.GALLERY -> galleryImageResult
MediaSource.CAMERA -> cameraImageResult
}
}

fun createMediaPickerControllerMock(
permissionsController: PermissionsController,
mediaResult: Media
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) {
override suspend fun pickMedia(): Media {
return mediaResult
}
}

fun createMediaPickerControllerMock(
permissionsController: PermissionsController,
fileMediaResult: FileMedia
): MediaPickerControllerMock = object : MediaPickerControllerMock(permissionsController) {
override suspend fun pickFiles(): FileMedia {
return fileMediaResult
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import dev.icerock.moko.media.Bitmap

expect fun createBitmapMock(): Bitmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import kotlin.test.Test

class BitmapMockTests {
@Test
fun `bitmap byte array`() {
val bitmap = createBitmapMock()
val byteArray = bitmap.toByteArray()
// we should not throw any exceptions
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.media.test

import dev.icerock.moko.media.Bitmap
import dev.icerock.moko.media.FileMedia
import dev.icerock.moko.media.Media
import dev.icerock.moko.media.picker.MediaPickerController
import dev.icerock.moko.media.picker.MediaSource
import dev.icerock.moko.permissions.PermissionsController

actual open class MediaPickerControllerMock actual constructor(
actual override val permissionsController: PermissionsController
) : MediaPickerController {
actual override suspend fun pickImage(source: MediaSource): Bitmap {
TODO("Not yet implemented")
}

actual override suspend fun pickImage(
source: MediaSource,
maxWidth: Int,
maxHeight: Int
): Bitmap {
TODO("Not yet implemented")
}

actual override suspend fun pickMedia(): Media {
TODO("Not yet implemented")
}

actual override suspend fun pickFiles(): FileMedia {
TODO("Not yet implemented")
}
}
Loading

0 comments on commit 22d1705

Please sign in to comment.