forked from gmxtian/strong-remoting-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
151 lines (128 loc) · 4.47 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
group = 'com.strongloop';
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
apply plugin: 'android-library'
apply plugin: 'android-maven'
apply plugin: 'signing'
def sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def isJenkinsBuild = System.getenv("BUILD_NUMBER")
def isReleaseBuild = !version.contains("SNAPSHOT")
def shouldPublishToMavenCentral = isReleaseBuild
def mavenLocalUrl
repositories {
mavenLocal();
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 14
}
}
dependencies {
compile 'com.loopj.android:android-async-http:1.4.4'
androidTestCompile 'com.google.guava:guava:15.0'
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
// define androidReleaseJar task
task("android${name.capitalize()}Jar", type: Jar) {
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir
}
// define androidReleaseJavadoc task
task("generate${name.capitalize()}Javadoc", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
}
}
afterEvaluate { project ->
task androidJavadocsJar(type: Jar, dependsOn: generateReleaseJavadoc) {
classifier = 'javadoc'
from generateReleaseJavadoc.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.allSource
}
artifacts {
archives androidReleaseJar
archives androidSourcesJar
archives androidJavadocsJar
}
uploadArchives {
repositories {
mavenDeployer {
if (shouldPublishToMavenCentral) {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
repository(url: sonatypeRepositoryUrl) {
authentication(
userName: sonatypeUserName,
password: sonatypePassword);
}
}
pom.project {
name 'strong-remoting-android'
description 'Android client for strong-remoting'
url 'https://github.com/strongloop/strong-remoting-android'
licenses {
license {
name 'The MIT License'
url 'http://opensource.org/licenses/mit-license.php'
distribution 'repo'
}
}
scm {
connection 'scm:[email protected]:strongloop/strong-remoting-android.git'
developerConnection 'scm:[email protected]:strongloop/strong-remoting-android.git'
url 'https://github.com/strongloop/strong-remoting-android'
}
developers {
developer {
id 'bajtos'
name 'Miroslav Bajtos'
email '[email protected]'
organization = 'StrongLoop, Inc.'
organizationUrl 'http://strongloop.com/'
}
}
}
pom.withXml {
def root = asNode()
root.appendNode('packaging', 'jar');
}
}
}
}
// Task for Jenkins build that will conditionally
// call uploadArchives, but only if there is something
// to upload
task publishToMavenCentral {
if (shouldPublishToMavenCentral)
dependsOn uploadArchives
}
if (shouldPublishToMavenCentral) {
signing {
required {
gradle.taskGraph.hasTask("uploadArchives")
}
sign configurations.archives
}
}
}