|
| 1 | +/* |
| 2 | + * Copyright 2020 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 | + * 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 | + |
| 17 | +plugins { |
| 18 | + id 'com.android.application' |
| 19 | + id 'kotlin-android' |
| 20 | +} |
| 21 | + |
| 22 | +android { |
| 23 | + compileSdkVersion 29 |
| 24 | + |
| 25 | + defaultConfig { |
| 26 | + applicationId "com.example.jetsnack" |
| 27 | + minSdkVersion 21 |
| 28 | + targetSdkVersion 29 |
| 29 | + versionCode 1 |
| 30 | + versionName "1.0" |
| 31 | + |
| 32 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| 33 | + } |
| 34 | + |
| 35 | + buildTypes { |
| 36 | + release { |
| 37 | + minifyEnabled false |
| 38 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + compileOptions { |
| 43 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 44 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 45 | + } |
| 46 | + |
| 47 | + kotlinOptions { |
| 48 | + jvmTarget = "1.8" |
| 49 | + apiVersion = "1.3" |
| 50 | + allWarningsAsErrors = true |
| 51 | + } |
| 52 | + |
| 53 | + buildFeatures { |
| 54 | + compose true |
| 55 | + } |
| 56 | + |
| 57 | + composeOptions { |
| 58 | + kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424" |
| 59 | + kotlinCompilerExtensionVersion compose_version |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +configurations { |
| 64 | + ktlint |
| 65 | +} |
| 66 | + |
| 67 | +dependencies { |
| 68 | + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
| 69 | + implementation('androidx.core:core-ktx:1.1.0') // don't update yet b/152023266 |
| 70 | + implementation 'androidx.appcompat:appcompat:1.1.0' |
| 71 | + |
| 72 | + implementation("androidx.ui:ui-core:$compose_version") |
| 73 | + implementation("androidx.ui:ui-layout:$compose_version") |
| 74 | + implementation("androidx.ui:ui-material:$compose_version") |
| 75 | + implementation("androidx.ui:ui-tooling:$compose_version") |
| 76 | + |
| 77 | + ktlint "com.pinterest:ktlint:0.37.0" |
| 78 | +} |
| 79 | + |
| 80 | +task ktlint(type: JavaExec, group: "verification") { |
| 81 | + description = "Check Kotlin code style." |
| 82 | + main = "com.pinterest.ktlint.Main" |
| 83 | + classpath = configurations.ktlint |
| 84 | + args "src/**/*.kt" |
| 85 | +} |
| 86 | + |
| 87 | +check.dependsOn ktlint |
| 88 | + |
| 89 | +task ktlintFormat(type: JavaExec, group: "formatting") { |
| 90 | + description = "Fix Kotlin code style deviations." |
| 91 | + main = "com.pinterest.ktlint.Main" |
| 92 | + classpath = configurations.ktlint |
| 93 | + args "-F", "src/**/*.kt" |
| 94 | +} |
0 commit comments