-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbuild.gradle
88 lines (71 loc) · 2.65 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
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
repositories {
mavenLocal()
maven { url 'http://files.couchbase.com/maven2/' }
mavenCentral()
}
sourceSets {
main {
java.srcDirs = [
'src/main/java',
'vendor/tjws/src/java'
]
}
}
def buildListenerWithArtifacts = System.getProperty("buildListenerWithArtifacts")
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.couchbase.cblite:servlet:2-3'
compile buildListenerWithArtifacts == null ?
project(':libraries:couchbase-lite-java-core') :
'com.couchbase.lite:couchbase-lite-java-core:' + System.getenv("MAVEN_UPLOAD_VERSION")
}
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-java-listener/" + 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") }
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")
}
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-java-listener'
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 sourceSets.main.java.srcDirs
}
artifacts {
archives sourcesJar
}