forked from AltBeacon/android-beacon-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
180 lines (149 loc) · 4.9 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
ext {
isSnapshot = !project.hasProperty('release')
isSnapCi = System.getenv('SNAP_CI') != null
isSnapPullRequest = System.getenv('SNAP_PULL_REQUEST_NUMBER') != null
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName = {
def stdout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
catch (e) {
println("Can't get version from git: " + e);
return "adhoc"
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'
apply from: 'gradle/eclipse.gradle'
allprojects {
version = "${getVersionName()}${isSnapshot == true ? "-SNAPSHOT" : ""}"
group = "org.altbeacon"
repositories {
jcenter()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23"
defaultConfig {
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName version
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
androidTest {
setRoot('src/test')
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree ( dir: 'libs', include: ['*.jar'] )
testCompile 'org.hamcrest:hamcrest-integration:1.3'
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile('junit:junit:4.12') {
exclude module: 'hamcrest-core'
}
testCompile('com.squareup:fest-android:1.0.+@aar') {
exclude group: 'com.android.support', module: 'support-v4'
}
testCompile('org.robolectric:robolectric:3.0') {
exclude module: 'classworlds'
exclude module: 'commons-logging'
exclude module: 'httpclient'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-provider-api'
exclude group: 'com.android.support', module: 'support-v4'
}
testCompile 'com.android.support:support-v4:21.0.2'
testCompile 'org.mockito:mockito-core:1.10.19'
}
apply plugin: 'idea'
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
task renameAarForRelease(type: Copy, dependsOn: build) {
description = "Rename the aar for easy release publishing"
from "$buildDir/outputs/aar/" //${project.name}-release.aar
into "$buildDir/outputs/aar/" //${project.name}-${project.version}.aar"
include "${project.name}-release.aar"
rename { String fileName ->
fileName = "${project.name}-${project.version}.aar"
}
}
task distribution(dependsOn: [bundleEclipse, build, clean, renameAarForRelease]) << {
println "Building with version=$version"
}
task release(dependsOn: 'distribution') << {
println('Doing release build')
}
android.libraryVariants.all { variant ->
task("generate${variant.name}Javadoc", type: Javadoc) {
title = "Android Beacon Library $version API"
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, ext.androidJar)
options.linksOffline "http://d.android.com/reference/", "${android.sdkDirectory}/docs/reference"
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
}
build.mustRunAfter clean
apply from: 'gradle/credentials.gradle'
apply from: 'gradle/compile.gradle'
apply from: 'gradle/publishing.gradle'
apply from: 'gradle/bintray.gradle'
apply from: 'gradle/artifactory.gradle'
artifactoryPublish {
// Skip deploying to artifactory if building a pull request
onlyIf { !isSnapPullRequest }
}