Skip to content

Commit f17bec0

Browse files
authored
Merge pull request #448 from android/jdk/adaptive-codelab/gradle-updates
[Adaptive UI Codelab] migrate to version catalog and kts build scripts (main)
2 parents 0cb58eb + 6b9a579 commit f17bec0

File tree

6 files changed

+144
-100
lines changed

6 files changed

+144
-100
lines changed

AdaptiveUiCodelab/app/build.gradle

Lines changed: 0 additions & 89 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
alias(libs.plugins.android.application)
19+
alias(libs.plugins.kotlin.android)
20+
}
21+
22+
android {
23+
namespace = "com.example.reply"
24+
compileSdk = 34
25+
26+
defaultConfig {
27+
applicationId = "com.example.reply"
28+
minSdk = 21
29+
targetSdk = 33
30+
versionCode = 1
31+
versionName = "1.0"
32+
33+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
34+
vectorDrawables {
35+
useSupportLibrary = true
36+
}
37+
}
38+
39+
buildTypes {
40+
release {
41+
isMinifyEnabled = false
42+
proguardFiles(
43+
getDefaultProguardFile("proguard-android-optimize.txt"),
44+
"proguard-rules.pro"
45+
)
46+
}
47+
}
48+
compileOptions {
49+
sourceCompatibility = JavaVersion.VERSION_1_8
50+
targetCompatibility = JavaVersion.VERSION_1_8
51+
}
52+
kotlinOptions {
53+
jvmTarget = "1.8"
54+
}
55+
buildFeatures {
56+
compose = true
57+
}
58+
composeOptions {
59+
kotlinCompilerExtensionVersion = "1.5.13"
60+
}
61+
packaging {
62+
resources {
63+
excludes += "/META-INF/AL2.0"
64+
excludes += "/META-INF/LGPL2.1"
65+
}
66+
}
67+
}
68+
69+
dependencies {
70+
val composeBom = platform(libs.androidx.compose.bom)
71+
implementation(composeBom)
72+
androidTestImplementation(composeBom)
73+
74+
implementation(libs.androidx.material3)
75+
implementation(libs.androidx.material.icons.extended)
76+
implementation(libs.androidx.ui.tooling.preview)
77+
androidTestImplementation(libs.androidx.ui.test.junit4)
78+
debugImplementation(libs.androidx.ui.tooling)
79+
debugImplementation(libs.androidx.ui.test.manifest)
80+
81+
implementation(libs.androidx.lifecycle.viewmodel.compose)
82+
implementation(libs.androidx.lifecycle.runtime.ktx)
83+
implementation(libs.androidx.activity.compose)
84+
implementation(libs.androidx.core.ktx)
85+
implementation(libs.androidx.window)
86+
implementation(libs.kotlinx.coroutines.android)
87+
88+
testImplementation(libs.junit)
89+
androidTestImplementation(libs.androidx.junit)
90+
androidTestImplementation(libs.androidx.espresso.core)
91+
}

AdaptiveUiCodelab/app/proguard-rules.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add project specific ProGuard rules here.
22
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
3+
# proguardFiles setting in build.gradle.kts.
44
#
55
# For more details, see
66
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -18,4 +18,4 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
buildscript {
17+
repositories {
18+
google()
19+
mavenCentral()
20+
}
21+
}
1622

17-
rootProject.name = "Reply"
18-
include ':app'
23+
plugins {
24+
alias(libs.plugins.android.application) apply false
25+
alias(libs.plugins.kotlin.android) apply false
26+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[versions]
2+
androidGradlePlugin = "8.4.0"
3+
composeBom = "2024.05.00"
4+
coreKtx = "1.13.1"
5+
activityCompose = "1.9.0"
6+
espressoCore = "3.5.1"
7+
junit = "4.13.2"
8+
junitVersion = "1.1.5"
9+
kotlin = "1.9.23"
10+
kotlinxCoroutinesAndroid = "1.8.0"
11+
lifecycleViewmodelCompose = "2.7.0"
12+
lifecycleRuntimeKtx = "2.7.0"
13+
window = "1.2.0"
14+
15+
[libraries]
16+
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
17+
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
18+
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
19+
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
20+
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
21+
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
22+
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
23+
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
24+
androidx-material3 = { module = "androidx.compose.material3:material3" }
25+
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
26+
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
27+
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
28+
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
29+
androidx-window = { module = "androidx.window:window", version.ref = "window" }
30+
junit = { module = "junit:junit", version.ref = "junit" }
31+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
32+
33+
[plugins]
34+
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
35+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
buildscript {
16+
pluginManagement {
1717
repositories {
1818
google()
1919
mavenCentral()
20-
}
21-
dependencies {
22-
classpath "com.android.tools.build:gradle:8.4.0"
23-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23"
20+
gradlePluginPortal()
2421
}
2522
}
26-
27-
subprojects {
23+
dependencyResolutionManagement {
2824
repositories {
2925
google()
3026
mavenCentral()
3127
}
3228
}
29+
30+
rootProject.name = "Reply"
31+
include(":app")

0 commit comments

Comments
 (0)