-
Notifications
You must be signed in to change notification settings - Fork 205
/
build.gradle
201 lines (172 loc) · 6.88 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
apply plugin: 'com.android.library'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'kotlin-android'
repositories {
google()
jcenter()
}
android {
compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION)
defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK_VERSION)
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'proguard-rules.pro'
}
buildTypes {
debug {
testCoverageEnabled = true
}
}
lintOptions {
abortOnError true
warningsAsErrors true
checkAllWarnings true
baseline file("lint-baseline.xml")
}
// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
libraryVariants.all {
it.generateBuildConfig.enabled = false
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all" << "-Werror"
}
}
coveralls {
jacocoReportPath = "$buildDir/reports/coverage/debug/report.xml"
}
dependencies {
api "com.android.support:support-annotations:$supportLibVersion"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
androidTestImplementation "com.android.support.test:runner:$supportTestVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation "com.android.support.test:rules:$supportTestVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
}
if (project.hasProperty('infer')) {
implementation "com.facebook.infer.annotation:infer-annotation:0.11.2"
}
}
// Disable doclint:
// https://github.com/GPars/GPars/blob/312c5ae87605a0552bc72e22e3b2bd2fa1fdf98c/build.gradle#L208-L214
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
//noinspection SpellCheckingInspection
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task javadoc(type: Javadoc) {
description = "Generates javadocs, ignoring any doclint errors, and places the artefact in the root of the project"
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
destinationDir = file("docs")
failOnError false
}
version = "${project.VERSION_NAME}"
group = "${project.GROUP}"
archivesBaseName = "bugsnag-android" // rename aars from 'sdk' to 'bugsnag-android'
task sourceJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier "sources"
}
publishing {
repositories {
maven {
if (VERSION_NAME.contains("SNAPSHOT")) {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
} else {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
credentials {
username = project.hasProperty("NEXUS_USERNAME") ? "$NEXUS_USERNAME" : System.getenv("NEXUS_USERNAME")
password = project.hasProperty("NEXUS_PASSWORD") ? "$NEXUS_PASSWORD" : System.getenv("NEXUS_PASSWORD")
}
}
}
publications {
SDK(MavenPublication) {
groupId 'com.bugsnag'
artifactId 'bugsnag-android'
version "${project.VERSION_NAME}"
artifact(sourceJar)
artifact("$buildDir/outputs/aar/bugsnag-android-release.aar")
pom.withXml {
Node root = asNode()
// top-level metadata
Node packaging = root.get('packaging').first()
packaging.value = project.POM_PACKAGING
root.appendNode('name', project.POM_NAME)
root.appendNode('description', project.POM_DESCRIPTION)
root.appendNode('url', project.POM_URL)
// licenses
Node licenseNode = root.appendNode('licenses').appendNode('license')
licenseNode.appendNode('name', project.POM_LICENCE_NAME)
licenseNode.appendNode('url', project.POM_LICENCE_URL)
licenseNode.appendNode('distribution', project.POM_LICENCE_DIST)
// developers
Node devNode = root.appendNode('developers').appendNode('developer')
devNode.appendNode('id', project.POM_DEVELOPER_ID)
devNode.appendNode('name', project.POM_DEVELOPER_NAME)
// scm
Node scmNode = root.appendNode('scm')
scmNode.appendNode('connection', project.POM_SCM_CONNECTION)
scmNode.appendNode('developerConnection', project.POM_SCM_DEV_CONNECTION)
scmNode.appendNode('url', project.POM_SCM_URL)
def dependenciesNode = root.appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', 'compile')
}
}
}
}
}
}
signing {
sign publishing.publications
}
// Bintray upload
bintray {
user = project.hasProperty("bintray_user") ? "$bintray_user" : System.getenv("bintray_user")
key = project.hasProperty("bintray_api_key") ? "$bintray_api_key" : System.getenv("bintray_api_key")
publications = ['SDK']
configurations = ['archives']
pkg {
repo = 'maven'
name = 'bugsnag-android'
userOrg = 'bugsnag'
licenses = ['MIT']
vcsUrl = 'https://github.com/bugsnag/bugsnag-android.git'
version {
name = "${project.VERSION_NAME}"
vcsTag = "v${project.VERSION_NAME}"
}
}
}
apply from: "../checkstyle.gradle"
dexcount {
includeClasses = true
includeClassCount = true
includeFieldCount = true
includeTotalMethodCount = true
orderByMethodCount = true
verbose true
}