-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
187 lines (166 loc) · 5.51 KB
/
build.gradle
File metadata and controls
187 lines (166 loc) · 5.51 KB
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
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
buildscript {
ext {
deps = [
advrecyclerview : '1.0.0',
gtoSupport : libs.versions.gtoSupport.get(),
hamcrest : '2.2',
junit : '4.13.2',
mpChart : '3.1.0',
picasso : '2.8',
picassoTransforms : '2.4.0',
realmAdapters : '4.0.0',
realmFieldNames : '2.0.0',
retrofit : '2.9.0',
splitties : '3.0.0',
timber : '5.0.1',
]
deps.androidX = [
biometric : '1.1.0',
cardView : '1.0.0',
multidex : '2.0.1',
swipeRefreshLayout: '1.1.0',
testJUnit : '1.1.4',
]
deps.firebase = [
id : '21.1.0',
]
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath libs.android.gradlePlugin
classpath libs.firebase.appdistribution.gradlePlugin
classpath libs.firebase.perf.gradlePlugin
classpath libs.firebase.crashlytics.gradlePlugin
classpath libs.google.services.gradlePlugin
classpath libs.realm.gradlePlugin
}
}
plugins {
alias libs.plugins.grgit apply false
alias libs.plugins.hilt apply false
alias libs.plugins.kotlin apply false
alias libs.plugins.ktlint
}
allprojects {
repositories {
maven {
url 'https://jitpack.io'
content { includeGroupByRegex 'com\\.github\\..*' }
}
maven {
url 'https://cruglobal.jfrog.io/cruglobal/list/maven-locals/'
content {
includeGroup 'org.ccci.gto.android'
includeGroup 'org.ccci.gto.android.testing'
includeGroup 'org.cru.mpdx.android'
}
}
google()
mavenCentral()
jcenter {
content {
includeModule("com.ochim", "recyclertablayout-androidx")
includeModule("dk.ilios", "realmfieldnameshelper")
includeModule("io.realm", "android-adapters")
}
}
}
version '3.0.4' + (project.hasProperty('snapshotBuild') ? '-SNAPSHOT' : '')
// increase number of javac logged errors so that dagger errors are always logged
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "9999"
}
}
configurations.all {
resolutionStrategy {
force libs.okhttp3
// HACK: force an older version of Realm than what is referenced in gto-support
force libs.realm
}
}
}
// common config
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
dependencies {
implementation libs.kotlin.stdlib
implementation libs.timber
}
}
}
}
// configure ktlint
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
android = true
version = libs.versions.ktlint.get()
reporters {
reporter(ReporterType.PLAIN_GROUP_BY_FILE)
reporter(ReporterType.CHECKSTYLE)
}
}
// HACK: workaround https://github.com/JLLeitschuh/ktlint-gradle/issues/524
afterEvaluate {
if (project.hasProperty('android')) {
android.sourceSets.configureEach {
java.srcDirs("src/$name/kotlin")
}
}
}
}
// configure checkstyle
subprojects {
apply plugin: 'checkstyle'
checkstyle {
toolVersion '8.0'
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java', '**/*.xml'
exclude '**/gen/**'
classpath = files()
}
afterEvaluate {
project.tasks.findByName("check")?.dependsOn('checkstyle')
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Accept the buildScan TOS if we indicate we want to publish a build scan
if (extensions.findByName("buildScan") != null) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}
// Enforce that there are no snapshot dependencies in the project
// logic copied and modified from: researchgate gradle-release plugin (id: net.researchgate.release)
// see: https://github.com/researchgate/gradle-release/blob/master/src/main/groovy/net/researchgate/release/ReleasePlugin.groovy#L197-L214
task enforceNoSnapshotDependencies {
def matcher = { Dependency d -> d.version?.contains('SNAPSHOT') }
def collector = { Dependency d -> "${d.group ?: ''}:${d.name}:${d.version ?: ''}" }
doLast {
def message = ""
allprojects.each { project ->
def snapshotDependencies = [] as Set
project.configurations.each { cfg ->
snapshotDependencies += cfg.dependencies?.matching(matcher)?.collect(collector)
}
project.buildscript.configurations.each { cfg ->
snapshotDependencies += cfg.dependencies?.matching(matcher)?.collect(collector)
}
if (snapshotDependencies.size() > 0) {
message += "\n\t${project.name}: ${snapshotDependencies}"
}
}
if (message) throw new GradleException("Snapshot dependencies detected: ${message}")
}
}