blob: ff065b12de58002aab5a6efbb5fd07629762a249 [file] [log] [blame]
/*
* 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
import static androidx.build.dependencies.DependenciesKt.CONSTRAINT_LAYOUT
import static androidx.build.dependencies.DependenciesKt.MATERIAL
import static androidx.build.dependencies.DependenciesKt.PROTOBUF_COMPILER
import static androidx.build.dependencies.DependenciesKt.PROTOBUF_LITE
import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
plugins {
id("AndroidXPlugin")
id('com.android.application')
id('kotlin-android')
id("com.google.protobuf")
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.datastoresampleapp"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
// For DataStore with Preferences
implementation(project(":datastore:datastore-preferences"))
// For DataStore with protos
implementation(project(":datastore:datastore-core"))
api("androidx.preference:preference:1.1.0")
implementation(PROTOBUF_LITE)
implementation(KOTLIN_STDLIB)
implementation(MATERIAL)
implementation(CONSTRAINT_LAYOUT, { transitive = true })
implementation('androidx.navigation:navigation-fragment-ktx:2.2.2')
implementation project(":annotation:annotation-sampled")
}
protobuf {
protoc {
artifact = PROTOBUF_COMPILER
}
// 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'
}
}
}
}
}
// Allow usage of Kotlin's @OptIn.
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
}
}