-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
163 lines (139 loc) · 5.32 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
/*
* Copyright 2022 Nikolai Kotchetkov.
* 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
* http://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.
*/
plugins {
alias(libs.plugins.android.app) apply(false)
alias(libs.plugins.android.lib) apply(false)
alias(libs.plugins.kotlin.multiplatform) apply(false)
alias(libs.plugins.kotlin.jvm) apply(false)
alias(libs.plugins.kotlin.android) apply(false)
alias(libs.plugins.kotlin.kapt) apply(false)
alias(libs.plugins.compose) apply(false)
alias(libs.plugins.kotlin.dokka) apply(false)
alias(libs.plugins.hilt) apply(false)
alias(libs.plugins.nexus.publish)
alias(libs.plugins.git)
}
apply from: 'gradle/versioning.gradle'
apply from: 'gradle/maven-publish-config.gradle'
setVersion(buildVersionName())
group = "com.motorro.commonstatemachine"
setDescription("Multiplatform state machine for mobile applications")
allprojects {
ext {
versionCode = buildVersionCode()
versionName = buildVersionName()
androidBuildToolsVersion = '34.0.0'
androidMinSdkVersion = 24
androidTargetSdkVersion = 34
androidCompileSdkVersion = 34
developerId = 'motorro'
developerName = 'Nikolai Kotchetkov'
developerEmail = '[email protected]'
projectScm = 'https://github.com/motorro/CommonStateMachine.git'
projectUrl = 'https://github.com/motorro/CommonStateMachine'
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn",
"-Xinline-classes"
]
}
}
tasks.withType(Test).configureEach {
forkEvery = 100
testLogging {
// set options for log level LIFECYCLE
events "skipped", "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = ' ', endItem = ' '
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
}
tasks.register('runStateMachineTests', Task) {
dependsOn[':commonstatemachine:allTests']
description 'Run unit tests for the common state machine layer.'
}
tasks.register('runCoroutinesTests', Task) {
dependsOn[':coroutines:allTests']
description 'Run unit tests for the coroutines extension layer.'
}
tasks.register('runRegisterUnitTests', Task) {
dependsOn[':examples:welcome:commonregister:allTests']
description 'Run unit tests for the common register layer.'
}
tasks.register('runLoginUnitTests', Task) {
dependsOn[':examples:welcome:login:testDebugUnitTest']
description 'Run unit tests for the login module.'
}
tasks.register('runLceUnitTests', Task) {
dependsOn[':examples:lce:testDebugUnitTest']
description 'Run unit tests for LCE app.'
}
tasks.register('runWelcomeUnitTests', Task) {
dependsOn[':examples::welcome:testDebugUnitTest']
description 'Run unit tests for welcome app.'
}
tasks.register('runTimerUnitTests', Task) {
dependsOn[':examples:timer:allTests']
description 'Run unit tests for welcome app.'
}
tasks.register('displayVersion', Task) {
description 'Display application version name'
doLast {
println("Application version: ${versionName}")
}
}
task runUnitTests(
type: Task,
dependsOn: [
'runStateMachineTests',
'runCoroutinesTests',
'runLoginUnitTests',
'runRegisterUnitTests',
'runLceUnitTests',
'runWelcomeUnitTests',
'runTimerUnitTests'
],
group: 'verification'
) {
description 'Run unit tests for all modules.'
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = ossrhUsername
password = ossrhPassword
}
}
}