Skip to content

Commit cd27d70

Browse files
authored
Merge pull request #449 from android/jdk/adaptive-codelab-end/gradle-updates
[Adaptive UI Codelab] migrate to version catalog and kts build scripts (end)
2 parents 46e5c62 + c36e017 commit cd27d70

File tree

6 files changed

+148
-102
lines changed

6 files changed

+148
-102
lines changed

AdaptiveUiCodelab/app/build.gradle

Lines changed: 0 additions & 90 deletions
This file was deleted.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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.material3.windowSizeClass)
76+
implementation(libs.androidx.material.icons.extended)
77+
implementation(libs.androidx.ui.tooling.preview)
78+
androidTestImplementation(libs.androidx.ui.test.junit4)
79+
debugImplementation(libs.androidx.ui.tooling)
80+
debugImplementation(libs.androidx.ui.test.manifest)
81+
82+
implementation(libs.androidx.lifecycle.viewmodel.compose)
83+
implementation(libs.androidx.lifecycle.runtime.ktx)
84+
implementation(libs.androidx.activity.compose)
85+
implementation(libs.androidx.core.ktx)
86+
implementation(libs.androidx.window)
87+
implementation(libs.kotlinx.coroutines.android)
88+
89+
testImplementation(libs.junit)
90+
androidTestImplementation(libs.androidx.junit)
91+
androidTestImplementation(libs.androidx.espresso.core)
92+
}

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: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
rootProject.name = "Reply"
18-
include ':app'
17+
buildscript {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
}
22+
}
23+
24+
plugins {
25+
alias(libs.plugins.android.application) apply false
26+
alias(libs.plugins.kotlin.android) apply false
27+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
material3WindowSizeClass = "1.2.1"
14+
window = "1.2.0"
15+
16+
[libraries]
17+
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
18+
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
19+
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
20+
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
21+
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
22+
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
23+
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
24+
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
25+
androidx-material3 = { module = "androidx.compose.material3:material3" }
26+
androidx-material3-windowSizeClass = { module = "androidx.compose.material3:material3-window-size-class", version.ref = "material3WindowSizeClass" }
27+
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
28+
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
29+
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
30+
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
31+
androidx-window = { module = "androidx.window:window", version.ref = "window" }
32+
junit = { module = "junit:junit", version.ref = "junit" }
33+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
34+
35+
[plugins]
36+
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
37+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
17-
buildscript {
16+
pluginManagement {
1817
repositories {
1918
google()
2019
mavenCentral()
21-
}
22-
dependencies {
23-
classpath "com.android.tools.build:gradle:8.4.0"
24-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23"
20+
gradlePluginPortal()
2521
}
2622
}
27-
28-
subprojects {
23+
dependencyResolutionManagement {
2924
repositories {
3025
google()
3126
mavenCentral()
3227
}
3328
}
29+
30+
rootProject.name = "Reply"
31+
include(":app")

0 commit comments

Comments
 (0)