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