Skip to content

Commit

Permalink
Update deps and some fixes (#19)
Browse files Browse the repository at this point in the history
* build: update all dependencies

* build: android sdk 33

* build: bump version

* build: use android namespace

* build: update android gradle

* fix: opt-in material3 api

* fix(android): remember derived state

* build(shared): fix gradle

* build: some fixes

* chore: readme kotlin 1.7.20

* test(flowredux): fix turbine test

* Update ios-build.yml

* ci: try to fix ci

* ci: try to fix ci
  • Loading branch information
hoc081098 authored Oct 12, 2022
1 parent 3972b3d commit 2fc3e25
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 75 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,8 @@ jobs:
restore-keys: |
${{ runner.os }}-konan-
- name: Cache Pods
uses: actions/cache@v3.0.10
with:
path: ${{ github.workspace }}/iosApp/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Gen pod
run: ./gradlew :shared:podGenIOS --parallel

- name: Gen KSwift
run: ./gradlew kSwiftsharedPodspec
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Github Repos Search - Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI
[![iOS Build CI](https://github.com/hoc081098/GithubSearchKMM/actions/workflows/ios-build.yml/badge.svg)](https://github.com/hoc081098/GithubSearchKMM/actions/workflows/ios-build.yml)
[![Validate Gradle Wrapper](https://github.com/hoc081098/GithubSearchKMM/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/hoc081098/GithubSearchKMM/actions/workflows/gradle-wrapper-validation.yml)
[![API](https://img.shields.io/badge/API-23%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=23)
[![Kotlin](https://img.shields.io/badge/kotlin-1.6.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-1.7.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fhoc081098%2FGithubSearchKMM&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/gh/hoc081098/GithubSearchKMM/branch/master/graph/badge.svg?token=qzSAFkj09P)](https://codecov.io/gh/hoc081098/GithubSearchKMM)
Expand Down
5 changes: 3 additions & 2 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ hilt {
}

android {
namespace = "com.hoc081098.github_search_kmm.android"
compileSdk = appConfig.compileSdkVersion
defaultConfig {
applicationId = appConfig.applicationId
Expand All @@ -31,8 +32,8 @@ android {
isCoreLibraryDesugaringEnabled = true

// Sets Java compatibility to Java 11
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_11
targetCompatibility = org.gradle.api.JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
3 changes: 1 addition & 2 deletions androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hoc081098.github_search_kmm.android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".MyApp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Clear
import androidx.compose.material.icons.outlined.Search
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
Expand All @@ -26,14 +27,15 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun GithubSearchTermBox(
modifier: Modifier = Modifier,
initialTerm: String,
onTermChanged: (String) -> Unit,
) {
var term by remember { mutableStateOf(initialTerm) }
val isClearIconVisible by derivedStateOf { term.isNotEmpty() }
val isClearIconVisible by remember { derivedStateOf { term.isNotEmpty() } }
val localFocusManager = LocalFocusManager.current

TextField(
Expand Down
10 changes: 8 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}")
classpath(kotlin("serialization", version = versions.kotlin))
classpath("org.jetbrains.kotlinx:kover:0.5.1")
classpath("org.jetbrains.kotlinx:kover:0.6.1")
classpath("com.android.tools.build:gradle:${versions.agp}")
classpath("com.google.dagger:hilt-android-gradle-plugin:${deps.dagger.version}")
classpath("com.diffplug.spotless:spotless-plugin-gradle:${versions.spotless}")
classpath("com.github.ben-manes:gradle-versions-plugin:${versions.gradleVersions}")
classpath("com.squareup:javapoet:1.13.0")
classpath("dev.icerock.moko:kswift-gradle-plugin:${versions.mokoKSwift}")
classpath("org.jetbrains.kotlinx:kover:0.5.1")
}
}

Expand Down Expand Up @@ -54,6 +53,13 @@ allprojects {
}
}

allprojects {
apply<KoverPlugin>()
configure<kotlinx.kover.api.KoverMergedConfig> {
enable()
}
}

subprojects {
apply<SpotlessPlugin>()
apply<KoverPlugin>()
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/buildSrc/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ org.gradle.configureondemand=true
org.gradle.caching=true

#MPP
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
#kotlin.mpp.enableGranularSourceSetsMetadata=true
#kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true

# Enable Kotlin incremental compilation
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ org.gradle.configureondemand=true
org.gradle.caching=true

#MPP
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
#kotlin.mpp.enableGranularSourceSetsMetadata=true
#kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true

# Enable Kotlin incremental compilation
Expand Down
54 changes: 27 additions & 27 deletions buildSrc/src/main/kotlin/deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,39 @@ import org.gradle.plugin.use.PluginDependencySpec
object versions {
const val spotless = "6.7.2"
const val ktlint = "0.45.2"
const val kotlin = "1.6.21"
const val agp = "7.2.1"
const val kotlin = "1.7.20"
const val agp = "7.3.0"
const val gradleVersions = "0.42.0"
const val mokoKSwift = "0.5.0"
const val mokoKSwift = "0.6.0"
}

object appConfig {
const val applicationId = "com.hoc081098.github_search_kmm.android"

const val compileSdkVersion = 32
const val buildToolsVersion = "32.0.0"
const val compileSdkVersion = 33
const val buildToolsVersion = "33.0.0"

const val minSdkVersion = 23
const val targetSdkVersion = 32
const val targetSdkVersion = 33

private const val MAJOR = 0
private const val MINOR = 0
private const val PATCH = 1
private const val PATCH = 2
const val versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
const val versionName = "$MAJOR.$MINOR.$PATCH"
const val versionName = "$MAJOR.$MINOR.$PATCH-SNAPSHOT"
}

object deps {
object androidx {
const val appCompat = "androidx.appcompat:appcompat:1.4.1"
const val coreKtx = "androidx.core:core-ktx:1.7.0"
const val material = "com.google.android.material:material:1.6.0"
const val activityCompose = "androidx.activity:activity-compose:1.4.0"
const val appCompat = "androidx.appcompat:appcompat:1.5.1"
const val coreKtx = "androidx.core:core-ktx:1.9.0"
const val material = "com.google.android.material:material:1.6.1"
const val activityCompose = "androidx.activity:activity-compose:1.6.0"
const val hiltNavigationCompose = "androidx.hilt:hilt-navigation-compose:1.0.0"
}

object lifecycle {
private const val version = "2.6.0-alpha01"
private const val version = "2.6.0-alpha02"

const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" // viewModelScope
const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version" // lifecycleScope
Expand All @@ -59,21 +59,21 @@ object deps {
}

object coroutines {
private const val version = "1.6.2"
private const val version = "1.6.4"

const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version"
}

object serialization {
private const val version = "1.3.3"
private const val version = "1.4.0"
const val json = "org.jetbrains.kotlinx:kotlinx-serialization-json:$version"
const val core = "org.jetbrains.kotlinx:kotlinx-serialization-core:$version"
}

object ktor {
private const val version = "2.0.3"
private const val version = "2.1.2"
const val core = "io.ktor:ktor-client-core:$version"
const val clientJson = "io.ktor:ktor-client-json:$version"
const val logging = "io.ktor:ktor-client-logging:$version"
Expand All @@ -86,9 +86,9 @@ object deps {
}

object compose {
const val androidxComposeCompilerVersion = "1.2.0-rc02"
private const val version = "1.2.0-rc02"
private const val androidxComposeMaterial3Version = "1.0.0-alpha13"
const val androidxComposeCompilerVersion = "1.3.2"
private const val version = "1.3.0-beta03"
private const val androidxComposeMaterial3Version = "1.0.0-beta03"

const val foundation = "androidx.compose.foundation:foundation:$version"
const val foundationLayout = "androidx.compose.foundation:foundation-layout:$version"
Expand All @@ -105,35 +105,35 @@ object deps {
}

object koin {
private const val version = "3.2.0"
private const val version = "3.2.2"

const val core = "io.insert-koin:koin-core:$version"
const val testJunit4 = "io.insert-koin:koin-test-junit4:$version"
const val test = "io.insert-koin:koin-test:$version"
}

object dagger {
const val version = "2.42"
const val version = "2.44"
const val hiltAndroid = "com.google.dagger:hilt-android:$version"
const val hiltAndroidCompiler = "com.google.dagger:hilt-android-compiler:$version"
}

const val mokoKSwiftRuntime = "dev.icerock.moko:kswift-runtime:${versions.mokoKSwift}"
const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.3.2"
const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0"

const val coilCompose = "io.coil-kt:coil-compose:2.1.0"
const val coilCompose = "io.coil-kt:coil-compose:2.2.2"
const val flowExt = "io.github.hoc081098:FlowExt:0.4.0"

const val atomicfu = "org.jetbrains.kotlinx:atomicfu:0.17.3"
const val atomicfu = "org.jetbrains.kotlinx:atomicfu:0.18.3"
const val immutableCollections = "org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.5"

object arrow {
private const val version = "1.1.2"
private const val version = "1.1.3"
const val core = "io.arrow-kt:arrow-core:$version"
const val fx = "io.arrow-kt:arrow-fx-coroutines:$version"
}

const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:1.1.5"
const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:1.2.2"
const val napier = "io.github.aakira:napier:2.6.1"

object test {
Expand All @@ -150,7 +150,7 @@ object deps {

const val mockk = "io.mockk:mockk:1.12.4"
const val kotlinJUnit = "org.jetbrains.kotlin:kotlin-test-junit:${versions.kotlin}"
const val turbine = "app.cash.turbine:turbine:0.8.0"
const val turbine = "app.cash.turbine:turbine:0.11.0"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hoc081098.flowredux

import app.cash.turbine.FlowTurbine
import app.cash.turbine.ReceiveTurbine
import app.cash.turbine.test
import kotlin.test.Test
import kotlin.test.assertContentEquals
Expand Down Expand Up @@ -421,6 +421,7 @@ class FlowReduxStoreTest {
.buffer(Channel.UNLIMITED)
.map {
sideEffect1Started = true
println("sideEffect1 delay...")
delay(2_000)
sideEffect1Ended = true

Expand All @@ -432,6 +433,7 @@ class FlowReduxStoreTest {
.buffer(Channel.UNLIMITED)
.map {
sideEffect2Started = true
println("sideEffect2 delay...")
delay(2_000)
sideEffect2Ended = true

Expand All @@ -444,6 +446,12 @@ class FlowReduxStoreTest {
}
)

launch {
delay(200)
println("Cancelling scope")
scope.cancel()
}

store.stateFlow
.onSubscription {
store.dispatch(1)
Expand All @@ -455,9 +463,6 @@ class FlowReduxStoreTest {
awaitComplete()
}

delay(200)
scope.cancel()

assertTrue { sideEffect1Started && sideEffect2Started }
assertFalse { sideEffect1Ended }
assertFalse { sideEffect2Ended }
Expand All @@ -466,13 +471,13 @@ class FlowReduxStoreTest {

@ExperimentalCoroutinesApi
suspend fun <T> Flow<T>.testWithTestCoroutineScheduler(
validate: suspend FlowTurbine<T>.() -> Unit,
validate: suspend ReceiveTurbine<T>.() -> Unit,
) {
val testScheduler = currentCoroutineContext()[TestCoroutineScheduler]

if (testScheduler == null) {
test(validate)
test(validate = validate)
} else {
flowOn(UnconfinedTestDispatcher(testScheduler)).test(validate)
flowOn(UnconfinedTestDispatcher(testScheduler)).test(validate = validate)
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ org.gradle.configureondemand=true
org.gradle.caching=true

#MPP
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
#kotlin.mpp.enableGranularSourceSetsMetadata=true
#kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true

# Enable Kotlin incremental compilation
Expand Down
2 changes: 1 addition & 1 deletion iosApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ target 'iosApp' do
use_frameworks!
platform :ios, '14.1'

pod 'sharedSwift', :path => '../shared'
pod 'shared', :path => '../shared'
pod 'sharedSwift', :path => '../shared'

pod 'Kingfisher', '~> 7.0'
end
6 changes: 3 additions & 3 deletions iosApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Kingfisher (7.3.0)
- shared (0.0.1)
- shared (0.0.2-SNAPSHOT)
- sharedSwift (1.0):
- shared

Expand All @@ -21,9 +21,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Kingfisher: cdb1189a9223b1bc028816bd47c8b8101a58831c
shared: 26593bcebdb020429392f3ce88e6209b07fe87f5
shared: 0281bee957937b7e908057c45bbd824e2001f96c
sharedSwift: 069e6019f6963d18ae01d1d772429c854db2fe1e

PODFILE CHECKSUM: f3ed113972b96474d784f1c3f8d63d921d63a6fa
PODFILE CHECKSUM: 42e9abcd0de83560b82796c5d325b3626db87b31

COCOAPODS: 1.11.2
Loading

0 comments on commit 2fc3e25

Please sign in to comment.