forked from woocommerce/woocommerce-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
214 lines (183 loc) · 6.46 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
import com.automattic.android.measure.MeasureBuildsExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'io.gitlab.arturbosch.detekt'
id 'com.automattic.android.measure-builds'
id 'com.android.application' apply false
id 'org.jetbrains.kotlin.android' apply false
id 'com.google.dagger.hilt.android' apply false
id 'com.google.gms.google-services' apply false
id 'com.google.devtools.ksp' apply false
}
measureBuilds {
enable = findProperty('tracksEnabled')?.toBoolean() ?: false
automatticProject = MeasureBuildsExtension.AutomatticProject.WooCommerce
attachGradleScanId = true
authToken = findProperty('appsMetricsToken')
}
allprojects {
apply plugin: 'io.gitlab.arturbosch.detekt'
repositories {
google()
mavenCentral()
}
tasks.withType(KotlinCompile).all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
allWarningsAsErrors = true
freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn",
"-Xjvm-default=all-compatibility",
]
}
}
}
subprojects {
configurations {
compile.exclude group: 'org.jetbrains', module: 'annotations-java5'
}
}
def detektAll = tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
description = "Custom DETEKT build for all modules"
parallel = true
ignoreFailures = false
buildUponDefaultConfig = true
setSource(file(projectDir))
baseline.set(file("$rootDir/config/detekt/baseline.xml"))
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
include("**/*.kt")
exclude("**/resources/**", "**/build/**")
reports {
html.enabled = true
xml.enabled = true
txt.enabled = false
}
}
def detektAutoCorrectPrompt = tasks.register("detektAutoCorrectPrompt") {
doLast {
def detektTask = detektAll.get()
if (detektTask.state.failure != null && !detektTask.autoCorrect) {
println ".-----------------------------------------------------------------------------------------------------------------------------------.\n" +
"| 🛠 Did you know: you can ask Detekt to automatically resolve some of the issues by running `./gradlew detektAll --auto-correct` |\n" +
"'-----------------------------------------------------------------------------------------------------------------------------------'"
}
}
}
detektAll.configure{
finalizedBy detektAutoCorrectPrompt
}
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$gradle.ext.detektVersion"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
/**
* Copies git-hooks from the `tools/team-props/git-hooks' directory to the `.git/hooks` folder
* at the root of this project.
*/
tasks.register("installGitHooks", Copy) {
println "Copying git-hooks scripts from tools/team-props/git-hooks to .git/hooks"
from new File(rootProject.rootDir, 'tools/team-props/git-hooks')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0777
}
ext {
fluxCVersion = '2.68.0'
glideVersion = '4.16.0'
coilVersion = '2.1.0'
constraintLayoutVersion = '1.2.0'
libaddressinputVersion = '0.0.2'
eventBusVersion = '3.3.1'
googlePlayCoreVersion = '1.10.3'
coroutinesVersion = '1.7.3'
lifecycleVersion = '2.6.2'
aztecVersion = 'v1.3.45'
flipperVersion = '0.176.1'
stateMachineVersion = '0.2.0'
coreKtxVersion = '1.12.0'
appCompatVersion = '1.4.2'
materialVersion = '1.6.1'
hiltJetpackVersion = '1.1.0'
wordPressUtilsVersion = '3.5.0'
mediapickerVersion = '0.3.0'
wordPressLoginVersion = '1.13.0'
aboutAutomatticVersion = '0.0.6'
automatticTracksVersion = '3.2.0'
workManagerVersion = '2.7.1'
billingVersion = '5.0.0'
stripeTerminalVersion = '3.1.1'
mlkitBarcodeScanningVersion = '17.2.0'
mlkitTextRecognitionVersion = '16.0.0'
androidxCameraVersion = '1.2.3'
guavaVersion = '31.0.1-android'
// Apache
commonsText = '1.10.0'
commonsIO = '2.11.0'
httpClientAndroidVersion = '4.3.5.1'
// Compose and its module versions need to be consistent with each other (for example 'compose-theme-adapter')
composeBOMVersion = "2023.10.01"
composeCompilerVersion = "1.5.9"
composeAccompanistVersion = "0.32.0"
// Testing
jUnitVersion = '4.13.2'
jUnitExtVersion = '1.1.5'
androidxTestCoreVersion = '1.4.0'
assertjVersion = '3.24.1'
espressoVersion = '3.4.0'
mockitoKotlinVersion = '4.0.0'
mockitoVersion = '4.6.1'
}
// Onboarding and dev env setup tasks
task checkBundler(type: Exec) {
doFirst {
println "Check Bundler"
}
workingDir = './'
executable "sh"
args "-c", "if ! type 'bundle' > /dev/null; then gem install bundler; fi"
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method checkBundler.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
task checkBundle(type: Exec, dependsOn: checkBundler) {
doFirst {
println "Check Bundle"
}
workingDir = './'
executable "sh"
args "-c", "bundle check --path=\${BUNDLE_PATH:-vendor/bundle} > /dev/null || bundle install --jobs=3 --retry=3 --path=\${BUNDLE_PATH:-vendor/bundle}"
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method checkBundle.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
task applyCredentials(type: Exec, dependsOn: checkBundle) {
doFirst {
println "Apply credentials for this branch"
}
workingDir = './'
executable "sh"
args "-c", "FASTLANE_SKIP_UPDATE_CHECK=1 FASTLANE_ENV_PRINTER=1 bundle exec fastlane run configure_apply force:true"
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method checkBundle.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
tasks.register("configureApply") {
group = 'Onboarding'
description = 'Install dependencies for debug and production builds'
dependsOn applyCredentials
doLast {
println("Done")
}
}
apply from: './config/gradle/jacoco.gradle'
apply from: './config/gradle/gradle_build_scan.gradle'