forked from kasem-sm/SlimeKT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
113 lines (104 loc) · 3.74 KB
/
build.gradle
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
105
106
107
108
109
110
111
112
113
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath AndroidX.gradle
classpath Jetbrains.gradle
classpath Hilt.gradle
classpath Spotless.gradle
classpath Jetbrains.serializationGradle
classpath Extras.dependencyUpdates
classpath Firebase.gmsGoogleService
}
}
apply from: "gradle/project-dependency-graph.gradle"
task clean(type: Delete) {
delete rootProject.buildDir
}
def provideAndroidXWorkerDeps(project) {
project.dependencies {
implementation "androidx.work:work-runtime-ktx:2.8.0-alpha02"
implementation "androidx.hilt:hilt-work:1.0.0"
kapt "androidx.hilt:hilt-compiler:1.0.0"
}
}
def provideHiltDeps(project) {
project.dependencies {
// Hilt
implementation Hilt.library
kapt Hilt.compiler
}
}
// Will later migrate to Ktor 2.0
def provideKtorAndroidDeps(project) {
project.dependencies {
implementation "io.ktor:ktor-client-android:2.0.2"
implementation "io.ktor:ktor-client-serialization:2.0.2"
implementation "io.ktor:ktor-client-content-negotiation:2.0.2"
implementation "io.ktor:ktor-serialization-kotlinx-json:2.0.2"
}
}
def provideUnitTestDeps(project) {
project.dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.2")
testImplementation("com.google.truth:truth:1.1.3")
testImplementation("junit:junit:4.13.2")
testImplementation("app.cash.turbine:turbine:0.8.0")
testImplementation("io.mockk:mockk:1.12.4")
}
}
def provideUiTestDeps(project) {
project.dependencies {
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.2.0-beta02"
androidTestImplementation "androidx.test.ext:junit:1.1.4-alpha06"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.0-alpha06"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.1.1"
androidTestImplementation "com.google.truth:truth:1.1.3"
debugImplementation "androidx.compose.ui:ui-test-manifest:1.2.0-beta02"
}
}
subprojects {
apply plugin: 'com.diffplug.spotless'
apply plugin: 'com.github.ben-manes.versions'
spotless {
kotlin {
licenseHeaderFile project.rootProject.file('spotless/copyright.kt')
target "**/*.kt"
ktlint().userData(['android': 'true', 'max_line_length': '200'])
}
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
trimTrailingWhitespace()
indentWithTabs()
}
}
// https://chris.banes.dev/composable-metrics/ for more information
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
if (project.findProperty("enableComposeCompilerReports") == "true") {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
]
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
]
}
}
}
}
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}