forked from kasem-sm/SlimeKT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
127 lines (114 loc) · 3.91 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
def versionPropsFile = file("version.properties")
Properties versionProps = new Properties()
if (versionPropsFile.exists())
versionProps.load(new FileInputStream(versionPropsFile))
def _patch = (versionProps["PATCH"] ?: "0").toInteger() + 1
def _major = (versionProps["MAJOR"] ?: "0").toInteger()
def _minor = (versionProps["MINOR"] ?: "0").toInteger()
List<String> runTasks = gradle.startParameter.getTaskNames()
def value = 0
for (String item : runTasks)
if (item.contains("assembleRelease")) {
value = 1
}
_versionCode = (versionProps["VERSION_CODE"] ?: "1").toInteger() + value
if (_patch == 99999) {
_patch = 0
_minor = _minor + 1
}
if (_major == 99) {
_major = 0
_major = _major + 1
}
versionProps["MAJOR"] = _major.toString()
versionProps["MINOR"] = _minor.toString()
versionProps["PATCH"] = _patch.toString()
versionProps["VERSION_CODE"] = _versionCode.toString()
versionProps.store(versionPropsFile.newWriter(), null)
}
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
}
}
plugins {
id "com.jraska.module.graph.assertion" version "2.2.0"
}
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
}
}
def provideKtorAndroidDeps(project) {
project.dependencies {
implementation "io.ktor:ktor-client-android:1.6.7"
implementation "io.ktor:ktor-client-serialization:1.6.7"
}
}
def provideUnitTestDeps(project) {
project.dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
testImplementation("com.google.truth:truth:1.1.3")
testImplementation("junit:junit:4.13.2")
testImplementation("app.cash.turbine:turbine:0.7.0")
testImplementation("io.mockk:mockk:1.12.3")
}
}
def provideUiTestDeps(project) {
project.dependencies {
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.2.0-alpha07"
androidTestImplementation "androidx.test.ext:junit:1.1.4-alpha05"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.0-alpha05"
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-alpha07"
}
}
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()
}
}
}
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}