Skip to content

Commit c34aef0

Browse files
authored
Migrate to Kotlin DSL (#8)
1 parent 90ff1ed commit c34aef0

10 files changed

Lines changed: 141 additions & 93 deletions

File tree

app/build.gradle

Lines changed: 0 additions & 79 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (C) 2023 The Android Open Source Project
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+
plugins {
17+
id("com.android.application")
18+
id("org.jetbrains.kotlin.android")
19+
}
20+
21+
android {
22+
namespace = "com.example.dessertrelease"
23+
compileSdk = 33
24+
25+
defaultConfig {
26+
applicationId = "com.example.dessertrelease"
27+
minSdk = 24
28+
targetSdk = 33
29+
versionCode = 1
30+
versionName = "1.0"
31+
32+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
33+
vectorDrawables {
34+
useSupportLibrary = true
35+
}
36+
}
37+
38+
buildTypes {
39+
release {
40+
isMinifyEnabled = false
41+
proguardFiles(
42+
getDefaultProguardFile("proguard-android-optimize.txt"),
43+
"proguard-rules.pro"
44+
)
45+
}
46+
}
47+
compileOptions {
48+
sourceCompatibility = JavaVersion.VERSION_1_8
49+
targetCompatibility = JavaVersion.VERSION_1_8
50+
}
51+
kotlinOptions {
52+
jvmTarget = "1.8"
53+
freeCompilerArgs += "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api"
54+
}
55+
buildFeatures {
56+
compose = true
57+
}
58+
composeOptions {
59+
kotlinCompilerExtensionVersion = "1.4.7"
60+
}
61+
packaging {
62+
resources {
63+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
64+
}
65+
}
66+
}
67+
68+
dependencies {
69+
70+
implementation(platform("androidx.compose:compose-bom:2023.05.01"))
71+
implementation("androidx.activity:activity-compose:1.7.2")
72+
implementation("androidx.compose.material3:material3")
73+
implementation("androidx.compose.ui:ui")
74+
implementation("androidx.compose.ui:ui-graphics")
75+
implementation("androidx.compose.ui:ui-tooling-preview")
76+
implementation("androidx.core:core-ktx:1.10.1")
77+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
78+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:${rootProject.extra["lifecycle_version"]}")
79+
80+
debugImplementation("androidx.compose.ui:ui-test-manifest")
81+
debugImplementation("androidx.compose.ui:ui-tooling")
82+
}

app/src/main/res/drawable/ic_launcher_background.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
Copyright (C) 2022 The Android Open Source Project
3+
Copyright (C) 2023 The Android Open Source Project
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
77
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
https://www.apache.org/licenses/LICENSE-2.0
1010
1111
Unless required by applicable law or agreed to in writing, software
1212
distributed under the License is distributed on an "AS IS" BASIS,

app/src/main/res/drawable/ic_launcher_foreground.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
Copyright (C) 2022 The Android Open Source Project
3+
Copyright (C) 2023 The Android Open Source Project
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
77
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
https://www.apache.org/licenses/LICENSE-2.0
1010
1111
Unless required by applicable law or agreed to in writing, software
1212
distributed under the License is distributed on an "AS IS" BASIS,
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2023 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
318
<background android:drawable="@drawable/ic_launcher_background"/>
419
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
5-
</adaptive-icon>
20+
</adaptive-icon>
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2023 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
318
<background android:drawable="@drawable/ic_launcher_background"/>
419
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
5-
</adaptive-icon>
20+
</adaptive-icon>

app/src/main/res/values/dimens.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2023 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<resources>
318
<dimen name="padding_medium">16dp</dimen>
419
<dimen name="padding_small">8dp</dimen>
5-
</resources>
20+
</resources>

build.gradle renamed to build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1717
buildscript {
18-
ext {
19-
lifecycle_version = "2.6.1"
18+
extra.apply {
19+
set("lifecycle_version", "2.6.1")
2020
}
2121
}
2222
plugins {
23-
id 'com.android.application' version '8.0.1' apply false
24-
id 'com.android.library' version '8.0.1' apply false
25-
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
23+
id("com.android.application") version "8.0.2" apply false
24+
id("com.android.library") version "8.0.2" apply false
25+
id("org.jetbrains.kotlin.android") version "1.8.21" apply false
2626
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sun Mar 19 16:43:37 PDT 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

settings.gradle renamed to settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ dependencyResolutionManagement {
2828
}
2929
}
3030
rootProject.name = "Dessert Release"
31-
include ':app'
31+
include(":app")

0 commit comments

Comments
 (0)