forked from couchbase/couchbase-lite-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
157 lines (133 loc) · 5.39 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
apply plugin: 'android-library'
apply plugin: 'maven'
// This property value is for couchbase-lite-java-forestdb
ext.spec = "android"
version = System.getenv("MAVEN_UPLOAD_VERSION")
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
repositories {
mavenLocal()
maven { url 'http://files.couchbase.com/maven2/' }
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
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'
}
}
def buildAndroidWithArtifacts = System.getProperty("buildAndroidWithArtifacts")
dependencies {
compile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-core') :
'com.couchbase.lite:couchbase-lite-java-core:' + version
compile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-native:sqlite-default') :
'com.couchbase.lite:couchbase-lite-android-sqlite-default:' + version
// Libraries required for tests only:
androidTestCompile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-native:sqlite-custom') :
'com.couchbase.lite:couchbase-lite-android-sqlite-custom:' + version
androidTestCompile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-native:sqlcipher') :
'com.couchbase.lite:couchbase-lite-android-sqlcipher:' + version
androidTestCompile buildAndroidWithArtifacts == null ?
project(':libraries:couchbase-lite-java-forestdb') :
'com.couchbase.lite:couchbase-lite-android-forestdb:' + version
androidTestCompile 'commons-io:commons-io:2.0.1'
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.0.0'
}
task generateJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
List<File> pathList = new ArrayList<File>();
pathList.add(file('./libraries/couchbase-lite-java-core/extra/doclet/doclet.jar'))
options.docletpath = pathList
options.doclet = "ExcludeDoclet"
options.showFromPublic()
exclude "org/apache/http/**", "com/couchbase/touchdb/**"
}
task createMavenDirectory(type: Exec) {
//these envs are required only to upload maven artifacts
print project.getGradle()
if(project.getGradle().toString().contains("createMavenDirectory")) {
if (System.getenv("MAVEN_UPLOAD_REPO_URL") == null) {
throw new GradleException("Please set MAVEN_UPLOAD_REPO_URL !!!")
}
if (System.getenv("MAVEN_UPLOAD_USERNAME") == null) {
throw new GradleException("Please set MAVEN_UPLOAD_USERNAME !!!")
}
if (System.getenv("MAVEN_UPLOAD_PASSWORD") == null) {
throw new GradleException("Please set MAVEN_UPLOAD_PASSWORD !!!")
}
if (System.getenv("MAVEN_UPLOAD_VERSION") == null) {
throw new GradleException("Please set MAVEN_UPLOAD_VERSION !!!")
}
}
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") != null ? 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
}