forked from Tapadoo/Alerter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
171 lines (139 loc) · 4.62 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
//Plugins
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: "maven-publish"
//Quality Standards
apply from: rootProject.file('quality.gradle')
def final String PACKAGE_NAME = "com.tapadoo.android"
def final String VERSION = "2.0.2"
def final String DESCRIPTION = "An Android Alerting Library"
def final String GITHUB_URL = "https://github.com/Tapadoo/Alerter"
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName VERSION
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError true
}
buildToolsVersion '26.0.2'
}
//BinTray configuration - credentials stored in user's gradle.properties
bintray {
user = getBinTrayUser()
key = getBinTrayKey()
publications = ['Alerter']
pkg {
repo = 'maven'
name = project.getName()
desc = DESCRIPTION
vcsUrl = GITHUB_URL + '.git'
websiteUrl = GITHUB_URL
issueTrackerUrl = GITHUB_URL + '/issues'
licenses = ['MIT']
publish = true
version {
name = VERSION // Version name i.e. "1.0"
desc = DESCRIPTION
vcsTag = VERSION
released = new Date()
}
}
}
// Create the POM configuration - required for jCenter uploading
def pomConfig = {
licenses {
license {
name "MIT License"
url "https://opensource.org/licenses/MIT"
distribution "repo"
}
}
}
// Create the publication with the pom configuration:
publishing {
publications {
Alerter(MavenPublication) {
groupId PACKAGE_NAME
version VERSION
artifactId project.getName()
//from components.android
artifact sourcesJar
artifact javadocJar
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
pom.withXml {
def root = asNode()
root.appendNode('description', DESCRIPTION)
root.appendNode('name', project.getName())
root.appendNode('url', GITHUB_URL)
root.children().last() + pomConfig
}
}
}
}
configurations {
javadocDeps
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile rootProject.ext.libs.support_v4
compile rootProject.ext.libs.appcompat_v7
compile rootProject.ext.libs.support_annotations
// Local Unit Tests - in src/test
testCompile rootProject.ext.libs.junit
// Instrumentation Tests - in src/androidTest
androidTestCompile rootProject.ext.libs.junit
androidTestCompile rootProject.ext.libs.rules
androidTestCompile rootProject.ext.libs.hamcrest
androidTestCompile rootProject.ext.libs.espresso
androidTestCompile rootProject.ext.libs.runner
androidTestCompile rootProject.ext.libs.uiautomator
androidTestCompile(rootProject.ext.libs.espresso, {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Javadocs References
javadocDeps rootProject.ext.libs.support_annotations
javadocDeps rootProject.ext.libs.support_v4
javadocDeps rootProject.ext.libs.appcompat_v7
}
bintrayUpload.dependsOn 'generatePomFileForAlerterPublication'
task showBintrayProps {
doLast {
println "Bintray user/password: ${getBinTrayUser()}/${getBinTrayKey()}"
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError true
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
def final getBinTrayUser() {
def final String BINTRAY_USER = "BINTRAY_USER"
return project.hasProperty(BINTRAY_USER)? project.getProperty(BINTRAY_USER) : null
}
def final getBinTrayKey() {
def final String BINTRAY_KEY = "BINTRAY_KEY"
return project.hasProperty(BINTRAY_KEY)? project.getProperty(BINTRAY_KEY) : null
}