forked from mongodb/mongo-hadoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
142 lines (118 loc) · 3.78 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
apply plugin: 'java'
def configDir = new File(rootDir, 'config')
def cdh4rel = 'cdh4.3.0'
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath 'me.trnl:clirr-gradle-plugin:0.4'
classpath 'me.trnl:github-release-gradle-plugin:0.1'
}
}
configure(subprojects.findAll { it.name != 'util' }) {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
group = 'org.mongodb'
version = '1.2.0'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repository.cloudera.com/artifactory/cloudera-repos/" }
}
dependencies {
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
/*
sourceSets {
main { java.srcDirs = ['src/main'] }
test { java.srcDirs = ['src/test'] }
}
*/
/* Compiling */
tasks.withType(AbstractCompile) {
options.encoding = 'ISO-8859-1'
options.fork = true
options.debug = true
// options.compilerArgs = ['-Xlint:all', '-Xlint:-options']
onlyIf { JavaVersion.current().isJava7Compatible() }
}
project.ext.buildingWith = { n ->
project.hasProperty(n) && project.property(n).toBoolean()
}
/* Testing */
tasks.withType(Test) {
maxParallelForks = 1
jacoco { enabled = false }
beforeTest { descr ->
logger.info("[Test ${descr.className} > ${descr.name}]")
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(check)) {
tasks.withType(Test) { jacoco { enabled = true } }
}
}
task testAll(dependsOn: tasks.withType(Test))
check.dependsOn testAll
/* Code quality */
checkstyle {
configFile = new File("$configDir/checkstyle.xml")
}
findbugs {
excludeFilter = new File("$configDir/findbugs-exclude.xml")
sourceSets = [sourceSets.main]
}
tasks.withType(FindBugs) {
reports {
xml.enabled = project.buildingWith('xmlReports.enabled')
html.enabled = !project.buildingWith('xmlReports.enabled')
}
}
task listDependencies << {
configurations.compile.each { File file -> println file }
}
}
project(":core") {
archivesBaseName = "mongo-hadoop-core"
dependencies {
compile "org.mongodb:mongo-java-driver:2.11.3"
switch (project.property('hadoop.version')) {
case ("0.23"):
compile "org.apache.hadoop:hadoop-common:0.23.10"
mapReduceDeps(it, "0.23.10")
break
case ("1.0"):
compile "org.apache.hadoop:hadoop-core:1.0.4"
break
case ("1.1"):
compile "org.apache.hadoop:hadoop-core:1.1.2"
break
case ("cdh4"):
compile "org.apache.hadoop:hadoop-common:2.0.0-${cdh4rel}"
mapReduceDeps(it, "2.0.0-${cdh4rel}")
break
case ("2.2"):
compile "org.apache.hadoop:hadoop-common:2.2.0"
mapReduceDeps(it, "2.2.0")
break
default:
throw new GradleException("Unknown hadoop version: ${project.property('hadoop.version')}")
break
}
}
}
def mapReduceDeps(it, version) {
["core", "common", "shuffle", "app", "jobclient"].each { module ->
it.compile("org.apache.hadoop:hadoop-mapreduce-client-${module}:${version}") {
exclude group: "org.apache.hadoop", module: "hadoop-hdfs"
}
}
}