Skip to content

Commit 8635402

Browse files
Migrated to KSP from Kapt
Added legacy kapt instead of kotlin kapt for Migration Codelab Merge branch 'main' into renovate/main-all Merge pull request #562 from raystatic/update/toml-versioning-compose-basics-codelab
1 parent ac0988d commit 8635402

5 files changed

Lines changed: 22 additions & 21 deletions

File tree

AdvancedStateAndSideEffectsCodelab/app/build.gradle

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616

1717
plugins {
1818
id 'com.android.application'
19-
id 'kotlin-android'
20-
id 'kotlin-kapt'
21-
id 'dagger.hilt.android.plugin'
19+
id 'com.google.devtools.ksp'
2220
id 'org.jetbrains.kotlin.plugin.compose'
21+
id 'dagger.hilt.android.plugin'
2322
}
2423

2524
// Reads the Google maps key that is used in the AndroidManifest
@@ -29,6 +28,7 @@ if (rootProject.file("local.properties").exists()) {
2928
}
3029

3130
android {
31+
namespace "androidx.compose.samples.crane"
3232
compileSdkVersion 36
3333
namespace "androidx.compose.samples.crane"
3434
defaultConfig {
@@ -69,10 +69,6 @@ android {
6969
targetCompatibility JavaVersion.VERSION_1_8
7070
}
7171

72-
kotlinOptions {
73-
jvmTarget = "1.8"
74-
}
75-
7672
buildFeatures {
7773
compose true
7874

@@ -120,14 +116,14 @@ dependencies {
120116
debugImplementation "androidx.compose.ui:ui-tooling"
121117
debugImplementation "androidx.compose.ui:ui-test-manifest"
122118

123-
124119
def lifecycle_version = "2.10.0"
125120
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
126121
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
127122
implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version"
123+
128124
implementation "com.google.dagger:hilt-android:2.59.1"
129-
kapt "com.google.dagger:hilt-compiler:2.59.1"
130-
kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.9.0"
125+
ksp "com.google.dagger:hilt-compiler:2.59.1"
126+
ksp "org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.0"
131127

132128
implementation "io.coil-kt:coil-compose:2.7.0"
133129

@@ -140,6 +136,6 @@ dependencies {
140136
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2"
141137
androidTestImplementation "com.google.dagger:hilt-android:2.59.1"
142138
androidTestImplementation "com.google.dagger:hilt-android-testing:2.59.1"
143-
kaptAndroidTest "com.google.dagger:hilt-compiler:2.59.1"
144-
kaptAndroidTest "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.9.0"
139+
kspAndroidTest "com.google.dagger:hilt-compiler:2.59.1"
140+
kspAndroidTest "org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.0"
145141
}

AdvancedStateAndSideEffectsCodelab/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ buildscript {
2121
}
2222
dependencies {
2323
classpath "com.android.tools.build:gradle:9.0.0"
24-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.0"
2524
classpath "com.google.dagger:hilt-android-gradle-plugin:2.59.1"
26-
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.2.0"
25+
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.3.10"
2726
}
2827
}
2928

3029
plugins {
3130
id 'com.diffplug.spotless' version '8.2.1'
31+
id 'com.google.devtools.ksp' version '2.3.4' apply false
3232
}
3333

3434
subprojects {

MigrationCodelab/app/build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
*/
1616

1717
apply plugin: 'com.android.application'
18-
apply plugin: 'kotlin-android'
19-
apply plugin: 'kotlin-kapt'
2018
apply plugin: 'androidx.navigation.safeargs.kotlin'
2119
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
20+
apply plugin: 'com.android.legacy-kapt'
2221

2322

2423
android {
@@ -36,17 +35,14 @@ android {
3635
buildTypes {
3736
release {
3837
minifyEnabled false
39-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
38+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
4039
}
4140
}
4241
compileOptions {
4342
sourceCompatibility JavaVersion.VERSION_17
4443
targetCompatibility JavaVersion.VERSION_17
4544
}
46-
kotlinOptions {
47-
jvmTarget = "17"
48-
freeCompilerArgs = ['-Xjvm-default=all-compatibility']
49-
}
45+
5046
buildFeatures {
5147
dataBinding true
5248
compose true

MigrationCodelab/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ buildscript {
3030

3131
plugins {
3232
id 'com.diffplug.spotless' version '8.2.1'
33+
id 'com.android.legacy-kapt' version '9.0.0' apply false
3334
}
3435

3536
allprojects {

MigrationCodelab/settings.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17+
pluginManagement {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
gradlePluginPortal()
22+
}
23+
}
24+
1725
include ':app'

0 commit comments

Comments
 (0)