forked from RadiusNetworks/android-ibeacon-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
161 lines (135 loc) · 3.99 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
defaultTasks 'distribution'
// TODO: figure out how to include source code in the generated jar file per http://stackoverflow.com/questions/11474729/how-to-build-sources-jar-with-gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: "android-library"
android {
compileSdkVersion 18
buildToolsVersion '18.0.1'
defaultConfig {
versionCode = 1
versionName = version
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
}
instrumentTest.setRoot('src/instrumentTest')
}
}
apply plugin: "maven"
apply plugin: "signing"
version = "0.7.3"
group = "com.radiusnetworks"
repositories {
mavenCentral()
}
sourceSets {
unitTest {
java.srcDir file('src/test')
}
}
dependencies {
unitTestCompile files("$project.buildDir/classes/debug")
unitTestCompile 'junit:junit:[4,)'
unitTestCompile 'org.robolectric:robolectric:2.1.1'
unitTestCompile 'com.google.android:android:4.0.1.2'
}
configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile
archives {
extendsFrom configurations.default
}
}
signing {
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: sonatypeRepo) {
authentication(userName: sonatypeUsername,
password: sonatypePassword)
}
pom.project {
name 'AndroidIBeaconLibrary'
packaging 'aar'
description 'IBeacon library for Android applications'
url 'https://github.com/RadiusNetworks/android-ibeacon-service'
scm {
url 'scm:git@github.com:RadiusNetworks/android-ibeacon-service.git'
connection 'scm:git@github.com:RadiusNetworks/android-ibeacon-service.git'
developerConnection 'scm:git@github.com:RadiusNetworks/android-ibeacon-service.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'davidgyoung'
name 'David Young'
email 'david@radiusnetworks.com'
}
}
}
}
}
task unitTest(type:Test, dependsOn: assemble) {
description = "run unit tests"
testClassesDir = project.sourceSets.unitTest.output.classesDir
classpath = project.sourceSets.unitTest.runtimeClasspath
}
unitTest {
testLogging {
exceptionFormat = 'full'
}
}
task bundleEclipse << {
exec {
executable 'scripts/bundle-eclipse'
}
}
task wrapper(type: org.gradle.api.tasks.wrapper.Wrapper) {
gradleVersion = '1.9'
}
task distribution(dependsOn: ["bundleEclipse", "build", "clean"]) << {
println "Building with version=$version"
}
task release(dependsOn: 'distribution') << {
println('Doing release build')
}
/*
* 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"
}
}
version = getVersionName()
build.mustRunAfter clean
bundleEclipse.mustRunAfter build