|
| 1 | +/* |
| 2 | + * Copyright (C) 2023. Uber Technologies |
| 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 | + * http://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 | +@file:Suppress("UnstableApiUsage") |
| 17 | + |
| 18 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 19 | + |
| 20 | +plugins { |
| 21 | + kotlin("android") |
| 22 | + id("com.android.library") |
| 23 | + id("ribs.spotless-convention") |
| 24 | +} |
| 25 | + |
| 26 | +kotlin { |
| 27 | + jvmToolchain(11) |
| 28 | +} |
| 29 | + |
| 30 | +android { |
| 31 | + compileSdk = 33 |
| 32 | + |
| 33 | + defaultConfig { |
| 34 | + minSdk = 21 |
| 35 | + } |
| 36 | + |
| 37 | + // This can be removed on AGP 8.1.0-alpha09 onwards, since we are using JVM Toolchain |
| 38 | + compileOptions { |
| 39 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 40 | + targetCompatibility = JavaVersion.VERSION_11 |
| 41 | + } |
| 42 | + |
| 43 | + buildFeatures { |
| 44 | + buildConfig = false |
| 45 | + } |
| 46 | + |
| 47 | + sourceSets { |
| 48 | + getByName("main").java.srcDir("src/main/kotlin") |
| 49 | + getByName("test").java.srcDir("src/test/kotlin") |
| 50 | + getByName("androidTest").java.srcDir("src/androidTest/kotlin") |
| 51 | + } |
| 52 | + |
| 53 | + testOptions { |
| 54 | + unitTests { |
| 55 | + isIncludeAndroidResources = true |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +androidComponents { |
| 61 | + beforeVariants { variantBuilder -> |
| 62 | + if (variantBuilder.buildType == "debug") { |
| 63 | + variantBuilder.enable = false |
| 64 | + } |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +tasks.withType<KotlinCompile>().configureEach { |
| 69 | + compilerOptions { |
| 70 | + freeCompilerArgs.addAll( |
| 71 | + "-Xexplicit-api=warning", |
| 72 | + "-Xjvm-default=enable", |
| 73 | + "-opt-in=kotlin.RequiresOptIn", |
| 74 | + ) |
| 75 | + } |
| 76 | +} |
0 commit comments