-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
167 lines (148 loc) · 4.94 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
mavenLocal()
google()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jaredsburrows:gradle-license-plugin:0.8.1'
classpath 'com.novoda:bintray-release:0.9.2'
classpath 'org.jacoco:org.jacoco.core:0.8.7'
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
classpath "com.karumi:shot:5.13.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// If you're using the Google Play Services Gradle plugin,
// you will also need to add this to your build.gradle to
// avoid a dependency resolution issue:
components.all {
allVariants {
withDependencies { deps ->
deps.each { dep ->
if (dep.group == 'net.minidev' && dep.name =='json-smart') {
dep.version {
prefer "2.3"
}
dep.because "resolving dependencies issue"
}
}
}
}
}
}
}
plugins {
id("io.gitlab.arturbosch.detekt").version("1.17.1")
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
maven { url "https://jitpack.io" }
}
apply from: "$rootDir/detekt.gradle"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
supportLibVersion = "28.0.0"
archLifecycleVersion = "1.1.1"
}
ext.enableJacoco = { Project project, String variant, String[] projectFileFilter ->
project.plugins.apply('jacoco')
final capVariant = variant.capitalize()
StringBuilder folderSb = new StringBuilder(variant.length() + 1)
for (int i = 0; i < variant.length(); i++) {
char c = variant.charAt(i)
if (Character.isUpperCase(c)) {
folderSb.append('/')
folderSb.append(Character.toLowerCase(c))
} else {
folderSb.append(c)
}
}
final folder = folderSb.toString()
project.android.testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
project.jacoco {
toolVersion = '0.8.4'
}
project.tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
project.tasks.create(
name: 'jacocoTestReport',
type: JacocoReport,
dependsOn: "test${capVariant}UnitTest"
) {
def buildDir = project.buildDir
def coverageSourceDirs = [
"src/main/java",
"src/main/kotlin"
]
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*'
]
fileFilter.addAll(projectFileFilter)
def javaClasses = fileTree(
dir: "$buildDir/intermediates/classes/$folder",
excludes: fileFilter
)
def kotlinClasses = fileTree(
dir: "$buildDir/tmp/kotlin-classes/$variant",
excludes: fileFilter
)
group = "Reporting"
description = "Generate Jacoco coverage reports for the ${project.name} with the " +
"$variant variant."
classDirectories.from files([ javaClasses ], [ kotlinClasses ])
additionalSourceDirs.from files(coverageSourceDirs)
sourceDirectories.from files(coverageSourceDirs)
executionData.from files("${project.buildDir}/jacoco/test${capVariant}UnitTest.exec")
reports {
xml.enabled = true
html.enabled = true
}
}
}