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

Update to kotlin 2.0.21 and new compose compiler #550

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
25 changes: 22 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -21,8 +22,8 @@
android:usesCleartextTraffic="true">

<activity
android:name="com.igorwojda.showcase.app.presentation.NavHostActivity"
android:exported="true">
android:name="com.igorwojda.showcase.app.presentation.NavHostActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand All @@ -31,6 +32,24 @@
</intent-filter>
</activity>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="com.igorwojda.showcase.app.initializer.DynamicColorInitializer"
android:value="androidx.startup" />

<meta-data
android:name="com.igorwojda.showcase.app.initializer.KoinInitializer"
android:value="androidx.startup" />

<meta-data
android:name="com.igorwojda.showcase.app.initializer.TimberInitializer"
android:value="androidx.startup" />
</provider>

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
package com.igorwojda.showcase.app

import android.app.Application
import com.google.android.material.color.DynamicColors
import com.igorwojda.showcase.BuildConfig
import com.igorwojda.showcase.base.baseModule
import com.igorwojda.showcase.favourite.featureFavouriteModules
import com.igorwojda.showcase.profile.featureProfilesModules
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.GlobalContext
import timber.log.Timber

class ShowcaseApplication : Application() {

override fun onCreate() {
super.onCreate()

initKoin()
initTimber()
initDynamicColorScheme()
}

private fun initDynamicColorScheme() {
// Apply dynamic colors to all Activities, Fragments, Views
// (Material 3 library helper class)
DynamicColors.applyToActivitiesIfAvailable(this)
}

private fun initKoin() {
GlobalContext.startKoin {
androidLogger()
androidContext(this@ShowcaseApplication)

modules(appModule)
modules(baseModule)
modules(featureFavouriteModules)
modules(com.igorwojda.showcase.album.featureAlbumModules)
modules(featureProfilesModules)
}
}

private fun initTimber() {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
}
class ShowcaseApplication : Application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.igorwojda.showcase.app.initializer

import android.app.Application
import android.content.Context
import androidx.startup.Initializer
import com.google.android.material.color.DynamicColors

class DynamicColorInitializer : Initializer<Unit> {
override fun create(context: Context) {
// Apply dynamic colors to all Activities, Fragments, Views
// (Material 3 library helper class)
DynamicColors.applyToActivitiesIfAvailable(context.applicationContext as Application)
}

override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.igorwojda.showcase.app.initializer

import android.content.Context
import androidx.startup.Initializer
import com.igorwojda.showcase.app.appModule
import com.igorwojda.showcase.base.baseModule
import com.igorwojda.showcase.favourite.featureFavouriteModules
import com.igorwojda.showcase.profile.featureProfilesModules
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.KoinApplication
import org.koin.core.context.GlobalContext

class KoinInitializer : Initializer<KoinApplication> {
override fun create(context: Context): KoinApplication {
return GlobalContext.startKoin {
androidLogger()
androidContext(context)

modules(appModule)
modules(baseModule)
modules(featureFavouriteModules)
modules(com.igorwojda.showcase.album.featureAlbumModules)
modules(featureProfilesModules)
}
}

override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.igorwojda.showcase.app.initializer

import android.content.Context
import androidx.startup.Initializer
import com.igorwojda.showcase.BuildConfig
import timber.log.Timber

class TimberInitializer : Initializer<Unit> {
override fun create(context: Context) {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}

override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
}
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies {
implementation(plugin(libs.plugins.detekt))
implementation(plugin(libs.plugins.junit5Android))
implementation(plugin(libs.plugins.safeArgs))
implementation(plugin(libs.plugins.compose.compiler))
}

kotlin {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/local.app.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ plugins {
id("local.kotlin")
id("local.spotless")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.plugin.compose")
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/local.library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id("local.test")
id("androidx.navigation.safeargs.kotlin")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
Expand Down
1 change: 1 addition & 0 deletions feature_base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
api(libs.bundles.lifecycle)
api(libs.bundles.room)
api(libs.bundles.compose)
api(libs.androidStartUp)

testImplementation(projects.libraryTestUtils)
testImplementation(libs.bundles.test)
Expand Down
7 changes: 5 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
kotlin = "1.9.25"
kotlin = "2.0.21"

# KSP depends on specific Kotlin version, so it must be upgraded together with Kotlin (disabled in Renovate)
# https://repo.maven.apache.org/maven2/com/google/devtools/ksp/symbol-processing-gradle-plugin/
kotlinSymbolProcessing = "1.9.25-1.0.20"
kotlinSymbolProcessing = "2.0.21-1.0.25"

# Compose compiler depends on specific Kotlin version, so it must be upgraded together with Kotlin (disabled in Renovate)
# https://developer.android.com/jetpack/androidx/releases/compose-kotlin
Expand Down Expand Up @@ -38,6 +38,7 @@ fragmentKtx = "1.8.4"
# Info https://google.github.io/accompanist/flowlayout/
# Repo https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-flowlayout/
accompanistFlowLayout = "0.32.0"
androidStartUp = "1.2.0"

spotless = "6.25.0"

Expand Down Expand Up @@ -91,6 +92,7 @@ roomCompiler = { module = "androidx.room:room-compiler", version.ref = "room" }
accompanistFlowLayout = { module = "com.google.accompanist:accompanist-flowlayout", version.ref = "accompanistFlowLayout" }
detektFormatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
konsist = "com.lemonappdev:konsist:0.16.0"
androidStartUp = { module = "androidx.startup:startup-runtime", version.ref = "androidStartUp" }

# Test dependencies
junit = { module = "junit:junit", version.ref = "junit" }
Expand Down Expand Up @@ -125,3 +127,4 @@ spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
safeArgs = { id = "androidx.navigation.safeargs.kotlin", version.ref = "navigation" }
junit5Android = { id = "de.mannodermaus.android-junit5", version.ref = "androidJUnit5" }
testLogger = { id = "com.adarshr.test-logger", version.ref = "testLogger" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Loading