Skip to content

Commit

Permalink
Kotlin 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekpl committed May 23, 2024
1 parent ac7f702 commit fc0d984
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 48 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pokédex using Jetpack Compose

A Pokémon list project that exhibits the next generation way for us to build our multi-module Android Applications using Jetpack Compose, Hilt, Clean Architecture, Kotlin Flow and more...
A Pokémon list project that exhibits the next generation way for us to build our multi-module Android Applications using Kotlin 2.0.0, Jetpack Compose, Hilt, Clean Architecture, and more...

<p align="center">
<img src="https://raw.githubusercontent.com/mike14u/pokedex/main/images/showcase.png" />
Expand Down Expand Up @@ -44,16 +44,15 @@ Each feature module is built with a sub-module that follows Domain, Data and UI
* **Coil Image Loading:** Attempt to load an image using Coil with or without loading animation
* **CI/CD Using Github:** Utilizing Github Actions and Github Releases page for pipelines and deployment (uses debug apk but you can build release or sign as you like)
* **R8:** Release and R8 ready, just make sure to generate your own keystore / signing capability
* **Lib Versions Catalog:** Uses new lib.versions.toml versions catalog to manage dependencies and their versions

## Built With

This project is built using next generation tools supported by the latest Canary version of **Android Studio Jellyfish | 2023.3.1 Canary 4:**. It is very important that your Kotlin, K2 Compiler, Jetpack Compose Compiler and Hilt versions aligned. In this case I used **(Kotlin 1.9.22, Jetpack Compose Compiler 1.5.8, Hilt 2.47+)**
This project is built using next generation tools supported by the latest Canary version of **Android Studio Koala Feature Drop | 2024.1.2 Canary 2:**. Kotlin 2.0.0 with Compose Compiler Gradle Ready!

* **Android Studio Jellyfish:** IDE used
* **Android Studio Koala:** IDE used
* **Kotlin:** Programming Language
* **K2 Compiler:** In preparation for Kotlin 2.0
* **K2 Compiler:** Enabled
* **KSP:** Uses KSP for hilt
* **Jetpack Compose:** UI Toolkit
* **Jetpack Libraries:** Lifecycle, View Model, Material 3, Navigation Compose etc.
Expand Down
17 changes: 10 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.kotlinKsp)
alias(libs.plugins.compose.compiler)
}

android {
Expand All @@ -16,8 +17,8 @@ android {
applicationId = "com.mikelau.pokedex"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0.0"
versionCode = 2
versionName = "2.0.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand All @@ -27,8 +28,8 @@ android {
buildTypes {
release {
isDebuggable = false
isMinifyEnabled = true
isShrinkResources = true
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand All @@ -51,16 +52,18 @@ android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.8"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
}

dependencies {
// Core Common
implementation(project(":core:common"))
Expand Down
2 changes: 0 additions & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
Expand Down
3 changes: 2 additions & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"minSdkVersionForDexing": 24,
"versionCode": 1,
"versionName": "1.0",
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ plugins {
alias(libs.plugins.hilt) apply false
alias(libs.plugins.kotlinSerialization) apply false
alias(libs.plugins.kotlinKsp) apply false
alias(libs.plugins.compose.compiler) apply false
}
true // Needed to make the Suppress annotation work for the plugins block
5 changes: 1 addition & 4 deletions feature/pokemon/data/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
2 changes: 0 additions & 2 deletions feature/pokemon/domain/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
Expand Down
9 changes: 6 additions & 3 deletions feature/pokemon/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinKsp)
alias(libs.plugins.compose.compiler)
}

android {
Expand Down Expand Up @@ -42,16 +43,18 @@ android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.8"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
}

dependencies {
implementation(project(":feature:pokemon:domain"))
implementation(project(":core:feature"))
Expand Down
3 changes: 0 additions & 3 deletions feature/pokemon/ui/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
Expand Down
9 changes: 6 additions & 3 deletions feature/pokemondetails/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinKsp)
alias(libs.plugins.compose.compiler)
}

android {
Expand Down Expand Up @@ -39,16 +40,18 @@ android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.8"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
}

dependencies {
implementation(project(":feature:pokemondetails:domain"))
implementation(project(":core:feature"))
Expand Down
5 changes: 1 addition & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,4 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Kotlin K2 Compiler Support, Preparation for Kotlin 2.0
kotlin.experimental.tryK2=true
android.lint.useK2Uast=true
android.nonTransitiveRClass=true
27 changes: 14 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[versions]
agp = "8.4.0-alpha04"
kotlin = "1.9.22"
kotlinKsp = "1.9.22-1.0.16"
core-ktx = "1.12.0"
agp = "8.6.0-alpha02"
kotlin = "2.0.0"
kotlinKsp = "2.0.0-1.0.21"
core-ktx = "1.13.1"
junit = "4.13.2"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
lifecycle-runtime-ktx = "2.7.0"
activity-compose = "1.8.2"
compose-bom = "2023.10.01"
lifecycle-runtime-ktx = "2.8.0"
activity-compose = "1.9.0"
compose-bom = "2024.05.00"
appcompat = "1.6.1"
material = "1.11.0"
material = "1.12.0"
retrofit = "2.9.0"
retrofit-kotlinx-adapter = "0.8.0"
okhttp = "4.12.0"
hilt = "2.50"
navigation-compose = "2.7.6"
hilt-navigation-compose = "1.1.0"
coil = "2.5.0"
material-icons-extended = "1.5.4"
hilt = "2.51.1"
navigation-compose = "2.7.7"
hilt-navigation-compose = "1.2.0"
coil = "2.6.0"
material-icons-extended = "1.6.7"
splashscreen = "1.0.1"
kotlinx-serialization-json = "1.6.2"
kotlin-plugin-serialization = "1.9.22"
Expand Down Expand Up @@ -62,3 +62,4 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinKsp = { id = "com.google.devtools.ksp", version.ref = "kotlinKsp" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-plugin-serialization"}
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt"}
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jul 26 01:49:56 SGT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit fc0d984

Please sign in to comment.