-
Notifications
You must be signed in to change notification settings - Fork 378
Expand file tree
/
Copy pathbuild.gradle
More file actions
115 lines (103 loc) · 4.15 KB
/
Copy pathbuild.gradle
File metadata and controls
115 lines (103 loc) · 4.15 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildVersions = [
compileSdkVersion: 34,
targetSdkVersion: 34,
minSdkVersion: 21
]
androidGradlePluginVersion = '8.8.2'
detektVersion = '1.21.0'
googleServicesGradlePluginVersion = '4.4.2'
huaweiAgconnectVersion = '1.9.1.304'
huaweiHMSPushVersion = '6.3.0.304'
huaweiHMSLocationVersion = '4.0.0.300'
kotlinVersion = '1.9.25'
dokkaVersion = '1.9.10'
coroutinesVersion = '1.7.3'
kotlinxSerializationJsonVersion = '1.6.3'
kotestVersion = '5.8.0'
ioMockVersion = '1.13.2'
// AndroidX Lifecycle and Activity versions
lifecycleVersion = '2.6.2'
activityVersion = '1.7.2'
startupVersion = '1.1.1'
ktlintVersion = '0.50.0' // Used by Spotless for Kotlin formatting (compatible with Kotlin 1.7.10)
spotlessVersion = '6.25.0'
tdunningJsonForTest = '1.0' // DO NOT upgrade for tests, using an old version so it matches AOSP
sharedRepos = {
google()
mavenCentral()
gradlePluginPortal()
// Huawei maven
maven { url 'https://developer.huawei.com/repo/' }
}
sharedDeps = [
"com.android.tools.build:gradle:$androidGradlePluginVersion",
"com.google.gms:google-services:$googleServicesGradlePluginVersion",
"com.huawei.agconnect:agcp:$huaweiAgconnectVersion",
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion",
"org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion",
"io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion",
"com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion",
"com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.32.0"
]
}
repositories sharedRepos
dependencies {
classpath sharedDeps
}
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
// Huawei maven
maven { url 'https://developer.huawei.com/repo/' }
}
// Force all modules to use the same Kotlin version
configurations.all {
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
force "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
// Exclude deprecated jdk7/jdk8 variants
eachDependency { details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
if (details.requested.name == 'kotlin-stdlib-jdk7' ||
details.requested.name == 'kotlin-stdlib-jdk8') {
details.useTarget "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
}
}
}
}
// Aggregate Detekt tasks at the root so CI can call them once
gradle.projectsEvaluated {
def moduleDetektTasks = []
def moduleDetektBaselineTasks = []
subprojects.each { p ->
if (p.plugins.hasPlugin('io.gitlab.arturbosch.detekt')) {
def detektTask = p.tasks.findByName('detekt')
if (detektTask != null) moduleDetektTasks << detektTask.path
def detektBaselineTask = p.tasks.findByName('detektBaseline')
if (detektBaselineTask != null) moduleDetektBaselineTasks << detektBaselineTask.path
}
}
tasks.register('detekt') {
if (!moduleDetektTasks.isEmpty()) dependsOn moduleDetektTasks
group = 'verification'
description = 'Runs Detekt on all modules.'
}
tasks.register('detektBaseline') {
if (!moduleDetektBaselineTasks.isEmpty()) dependsOn moduleDetektBaselineTasks
group = 'verification'
description = 'Creates/updates Detekt baselines for all modules.'
}
}
// Apply JaCoCo configuration from separate file
apply from: 'coverage/jacoco.gradle'