forked from couchbase/couchbase-lite-android
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
139 lines (116 loc) · 4.33 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
apply plugin: 'android-library'
apply plugin: 'maven'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
repositories {
mavenLocal()
maven { url 'http://files.couchbase.com/maven2/' }
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
// workaround for "duplicate files during packaging of APK" issue
// see https://groups.google.com/d/msg/adt-dev/bl5Rc4Szpzg/wC8cylTWuIEJ
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDir file('jniLibs')
}
}
}
def buildAndroidWithArtifacts = System.getProperty("buildAndroidWithArtifacts")
dependencies {
// this library is only needed by test code (95% certain), and therefore
// instrumentTestCompile is used rather than compile.
androidTestCompile 'commons-io:commons-io:2.0.1'
compile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-core') :
'com.couchbase.lite:couchbase-lite-java-core:' + System.getenv("MAVEN_UPLOAD_VERSION")
// temporary workaround to enable running tests against Couchbase Lite Listener.
// once tests are converted over to use mockwebserver, this can be ripped out.
// see https://github.com/couchbase/couchbase-lite-android/pull/300
androidTestCompile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-listener') :
'com.couchbase.lite:couchbase-lite-java-listener:' + System.getenv("MAVEN_UPLOAD_VERSION")
androidTestCompile 'com.squareup.okhttp:mockwebserver:1.2.1'
}
task generateJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
List<File> pathList = new ArrayList<File>();
pathList.add(file('extra/doclet/doclet.jar'))
options.docletpath = pathList
options.doclet = "ExcludeDoclet"
options.showFromPublic()
exclude "org/apache/http/**", "com/couchbase/touchdb/**"
}
task createMavenDirectory(type: Exec) {
ext {
uploadUser = System.getenv("MAVEN_UPLOAD_USERNAME") + ":" + System.getenv("MAVEN_UPLOAD_PASSWORD")
mkcolPath = System.getenv("MAVEN_UPLOAD_REPO_URL") + "com/couchbase/lite/couchbase-lite-android/" + System.getenv("MAVEN_UPLOAD_VERSION") + "/"
}
commandLine "curl", "--user", uploadUser, "-X", "MKCOL", mkcolPath
}
// this hack is only needed for apache mod_dav based Maven repo's like file.couchbase.com. otherwise, skip it
createMavenDirectory.onlyIf { System.getenv("MAVEN_UPLOAD_REPO_URL").contains("files") }
// first create the directory, then do the upload
task uploadArchivesWrapper(dependsOn: createMavenDirectory) << {
uploadArchives.execute()
}
def mavenPath() {
System.getenv("MAVEN_BUILD_LOCAL") == "true" ?
'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath :
System.getenv("MAVEN_UPLOAD_REPO_URL")
}
// this will upload, but will not first create a directory (which is needed on some servers)
uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenPath()) {
authentication(userName: System.getenv("MAVEN_UPLOAD_USERNAME"), password: System.getenv("MAVEN_UPLOAD_PASSWORD"))
}
pom.version = System.getenv("MAVEN_UPLOAD_VERSION")
pom.groupId = 'com.couchbase.lite'
pom.artifactId = 'couchbase-lite-android'
pom.project {
licenses {
license {
name 'Couchbase Community Edition License Agreement'
url 'http://www.couchbase.com/agreement/community'
distribution 'repo'
}
}
}
}
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives sourcesJar
}