forked from google/iosched
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
104 lines (94 loc) · 3.88 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright 2020 Google LLC
*
* 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
*
* https://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.
*/
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
google()
mavenCentral()
jcenter()
// Android Build Server
maven { url = uri("../iosched-prebuilts/m2repository") }
}
dependencies {
classpath("com.android.tools.build:gradle:${Versions.ANDROID_GRADLE_PLUGIN}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}")
classpath("com.google.gms:google-services:${Versions.GOOGLE_SERVICES}")
classpath("androidx.benchmark:benchmark-gradle-plugin:${Versions.BENCHMARK}")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.NAVIGATION}")
classpath("com.google.firebase:firebase-crashlytics-gradle:${Versions.FIREBASE_CRASHLYTICS}")
classpath("com.google.dagger:hilt-android-gradle-plugin:${Versions.HILT_AGP}")
}
}
plugins {
id("com.diffplug.gradle.spotless") version "3.27.1"
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
// For Android Build Server
// - Material Design Components
maven { url = uri("${project.rootDir}/../iosched-prebuilts/repository") }
// - Other dependencies
maven { url = uri("${project.rootDir}/../iosched-prebuilts/m2repository") }
// - Support Libraries, etc
maven {
url = uri("${project.rootDir}/../../../prebuilts/fullsdk/linux/extras/support/m2repository")
}
flatDir {
dirs = setOf(file("libs"), project(":ar").file("libs"))
}
}
}
subprojects {
apply(plugin = "com.diffplug.gradle.spotless")
val ktlintVer = "0.40.0"
spotless {
kotlin {
target("**/*.kt")
ktlint(ktlintVer).userData(
mapOf("max_line_length" to "100", "disabled_rules" to "import-ordering")
)
licenseHeaderFile(project.rootProject.file("copyright.kt"))
}
kotlinGradle {
// same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts')
target("**/*.gradle.kts")
ktlint(ktlintVer)
licenseHeaderFile(project.rootProject.file("copyright.kt"), "(plugins |import |include)")
}
}
// `spotlessCheck` runs when a build includes `check`, notably during presubmit. In these cases
// we prefer `spotlessCheck` run as early as possible since it fails in seconds. This prevents a
// build from running for several minutes doing other intensive tasks (resource processing, code
// generation, compilation, etc) only to fail on a formatting nit.
// Using `mustRunAfter` avoids creating a task dependency. The order is enforced only if
// `spotlessCheck` is already scheduled to run, so we can still build and launch from the IDE
// while the code is "dirty".
tasks.whenTaskAdded {
if (name == "preBuild") {
mustRunAfter("spotlessCheck")
}
}
// TODO: Remove when the Coroutine and Flow APIs leave experimental/internal/preview.
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"
}
}