forked from mixpanel/mixpanel-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (144 loc) · 5.19 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
apply plugin: 'android-library'
apply plugin: 'maven'
apply plugin: 'signing'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
// If you change minSdkVersion or targetSdkVersion below, you must also change
// the relevant attributes of the <uses-sdk> tag in AndroidManifest.xml
minSdkVersion 9
targetSdkVersion 23
testApplicationId "com.mixpanel.android.mpmetrics"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
lintOptions {
abortOnError true
warningsAsErrors true
disable "UnusedResources"
}
}
}
// Note- *all* dependencies are marked as optional in our final
// pom! If you need a transitive dependency in the library, you'll
// have to change the bit in uploadArchives that marks all dependencies as optional.
dependencies {
compile "com.google.android.gms:play-services:[3.1,)"
}
android.libraryVariants.all { variant ->
task("generate${variant.name}Javadoc", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
exclude(
'**/R.*',
'**/java_websocket/**',
'**/util/**',
'**/AlwaysSubmittableEditText.java',
'**/BuildConfig.java',
'**/CardCarouselLayout.java',
'**/FadeOnPressButton.java',
'**/FadingImageView.java',
'**/InAppFragment.java',
'**/MiniCircleImageView.java',
'**/ResourceIds.java',
'**/ResourceReader.java',
'**/SurveyActivity.java',
'**/SurveyChoiceView.java',
'**/SurveyCallbacks.java',
'**/TrackingDebug.java',
'**/Tweaks.java',
'**/UpdateDisplayState.java',
'**/UpdatesFromMixpanel.java',
'**/ViewCrawler.java'
)
options {
encoding = 'UTF-8'
docEncoding = 'UTF-8'
charSet = 'UTF-8'
}
}
}
android.buildTypes.all { buildType ->
buildType.buildConfigField "String", "MIXPANEL_VERSION", "\"${project.properties.version}\""
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
def isReleaseVersion() {
return !version.endsWith("SNAPSHOT");
}
if (isReleaseVersion()) {
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
}
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
pom.project {
name project.name
packaging 'aar'
description 'An Android library for Mixpanel Analytics \n' +
'http://mixpanel.com/android-analytics/'
url 'https://github.com/mixpanel/mixpanel-android'
scm {
url 'http://github.com/mixpanel/mixpanel-android'
connection 'scm:git:http://github.com/mixpanel/mixpanel-android'
developerConnection 'scm:git:[email protected]:mixpanel/mixpanel-android.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'mixpanel_dev'
name 'Mixpanel Developers'
email '[email protected]'
}
}
}
pom.whenConfigured { pom ->
pom.dependencies*.optional = true
}
if (isReleaseVersion() && project.hasProperty("sonatypeUsername")) {
/**
* In order to do nexus deploys, you'll need to setup a gradle.properties file in $HOME/.gradle
* with the following properties. You'll need the mixpanel.key file and then import it using GnuPG
* which will provide you with the keyId and the secring.gpg file
* signing.keyId=
* signing.password=
* signing.secretKeyRingFile=
*
* sonatypeRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2/
* sonatypeUsername=
* sonatypePassword=
*/
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
} else {
repository(url:'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath)
}
}
}