| /* |
| * Copyright 2020 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("com.android.application") |
| id("org.jetbrains.kotlin.android") |
| id("com.google.protobuf") |
| alias(libs.plugins.kotlinSerialization) |
| } |
| |
| dependencies { |
| // For DataStore with Preferences |
| implementation(project(":datastore:datastore-preferences")) |
| |
| // For DataStore with protos |
| implementation(project(":datastore:datastore")) |
| |
| |
| implementation(libs.protobufLite) |
| implementation(libs.kotlinStdlib) |
| implementation("androidx.appcompat:appcompat:1.2.0") |
| implementation("androidx.activity:activity-ktx:1.2.0") |
| |
| // For settings fragment |
| implementation("androidx.preference:preference:1.1.1") |
| |
| implementation(libs.constraintLayout) |
| implementation("androidx.navigation:navigation-fragment-ktx:2.3.2") |
| |
| // For kotlin serialization |
| implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") |
| } |
| |
| protobuf { |
| protoc { |
| artifact = libs.protobufCompiler.get() |
| } |
| |
| // Generates the java proto-lite code for the protos in this project. See |
| // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation |
| // for more information. |
| generateProtoTasks { |
| all().each { task -> |
| task.builtins { |
| java { |
| option "lite" |
| } |
| } |
| } |
| } |
| } |
| |
| android { |
| namespace "com.example.datastoresampleapp" |
| } |
| |
| // Allow usage of Kotlin's @OptIn. |
| tasks.withType(KotlinCompile).configureEach { |
| kotlinOptions { |
| freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] |
| } |
| } |