|
| 1 | +/* |
| 2 | + * Copyright 2019 Google, Inc. |
| 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 | +apply plugin: 'com.android.application' |
| 18 | +apply plugin: 'kotlin-android' |
| 19 | + |
| 20 | +android { |
| 21 | + compileSdkVersion 29 |
| 22 | + defaultConfig { |
| 23 | + applicationId "com.example.jetnews" |
| 24 | + minSdkVersion 21 |
| 25 | + targetSdkVersion 29 |
| 26 | + versionCode 1 |
| 27 | + versionName "1.0" |
| 28 | + vectorDrawables.useSupportLibrary = true |
| 29 | + } |
| 30 | + buildTypes { |
| 31 | + release { |
| 32 | + minifyEnabled false |
| 33 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + compileOptions { |
| 38 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 39 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 40 | + } |
| 41 | + |
| 42 | + kotlinOptions { |
| 43 | + jvmTarget = "1.8" |
| 44 | + } |
| 45 | + |
| 46 | + buildFeatures { |
| 47 | + compose true |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +configurations { |
| 52 | + ktlint |
| 53 | +} |
| 54 | + |
| 55 | +dependencies { |
| 56 | + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") |
| 57 | + implementation("androidx.compose:compose-runtime:$compose_version") |
| 58 | + implementation("androidx.ui:ui-framework:$compose_version") |
| 59 | + implementation("androidx.ui:ui-layout:$compose_version") |
| 60 | + implementation("androidx.ui:ui-material:$compose_version") |
| 61 | + implementation "androidx.ui:ui-tooling:$compose_version" |
| 62 | + implementation('androidx.appcompat:appcompat:1.1.0') |
| 63 | + implementation('androidx.activity:activity-ktx:1.0.0') |
| 64 | + implementation "androidx.core:core-ktx:1.1.0" |
| 65 | + ktlint "com.pinterest:ktlint:0.35.0" |
| 66 | +} |
| 67 | + |
| 68 | +task ktlint(type: JavaExec, group: "verification") { |
| 69 | + description = "Check Kotlin code style." |
| 70 | + main = "com.pinterest.ktlint.Main" |
| 71 | + classpath = configurations.ktlint |
| 72 | + args "src/**/*.kt" |
| 73 | +} |
| 74 | + |
| 75 | +check.dependsOn ktlint |
| 76 | + |
| 77 | +task ktlintFormat(type: JavaExec, group: "formatting") { |
| 78 | + description = "Fix Kotlin code style deviations." |
| 79 | + main = "com.pinterest.ktlint.Main" |
| 80 | + classpath = configurations.ktlint |
| 81 | + args "-F", "src/**/*.kt" |
| 82 | +} |
0 commit comments