blob: 6d5a9574ba11401afc32d3d9dab68d516ab257d7 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: "java"
apply plugin: "eclipse"
// TODO add idea module config.
apply plugin: "idea"
apply plugin: "scala"
apply plugin: 'com.github.johnrengelman.shadow'
buildscript {
repositories { jcenter() }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.0.2'
}
}
// Read the groupId and version properties from the "parent" bigtop project.
// It would be better if there was some better way of doing this. Howvever,
// at this point, we have to do this (or some variation thereof) since gradle
// projects can't have maven projects as parents (AFAIK. If there is a way to do it,
// it doesn't seem to be well-documented).
def setProjectProperties() {
Node xml = new XmlParser().parse("../../pom.xml")
group = xml.groupId.first().value().first()
version = xml.version.first().value().first()
}
setProjectProperties()
description = """"""
// We are using 1.7 as gradle can't play well when java 8 and scala are combined.
// There is an open issue here: http://issues.gradle.org/browse/GRADLE-3023
// There is talk of this being resolved in the next version of gradle. Till then,
// we are stuck with java 7. But we do have scala if we want more syntactic sugar.
sourceCompatibility = 1.7
targetCompatibility = 1.7
// Specify any additional project properties.
ext {
sparkVersion = "1.3.0"
scalaVersion = "2.10"
}
shadowJar {
zip64 true
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/rnowling/bigpetstore"
}
}
tasks.withType(AbstractCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:all"
}
tasks.withType(ScalaCompile) {
// Enables incremental compilation.
// http://www.gradle.org/docs/current/userguide/userguide_single.html#N12F78
scalaCompileOptions.useAnt = false
}
tasks.withType(Test) {
testLogging {
// Uncomment this if you want to see the console output from the tests.
// showStandardStreams = true
events "passed", "skipped", "failed"
// show standard out and standard error of the test JVM(s) on the console
//showStandardStreams = true
}
}
// Create a separate source-set for the src/integrationTest set of classes. The convention here
// is that gradle will look for a directory with the same name as that of the specified source-set
// under the 'src' directory.
sourceSets {
main {
java.srcDirs = [];
scala.srcDirs = ["src/main/scala", "src/main/java"]
}
}
// To see the API that is being used here, consult the following docs
// http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
def updateDependencyVersion(dependencyDetails, dependencyString) {
def parts = dependencyString.split(':')
def group = parts[0]
def name = parts[1]
def version = parts[2]
if (dependencyDetails.requested.group == group
&& dependencyDetails.requested.name == name) {
dependencyDetails.useVersion version
}
}
dependencies {
compile "org.apache.spark:spark-core_${scalaVersion}:${sparkVersion}"
compile "org.apache.spark:spark-mllib_${scalaVersion}:${sparkVersion}"
compile "org.apache.spark:spark-network-shuffle_${scalaVersion}:${sparkVersion}"
compile "org.apache.spark:spark-sql_${scalaVersion}:${sparkVersion}"
compile "org.apache.spark:spark-graphx_${scalaVersion}:${sparkVersion}"
compile "org.apache.spark:spark-hive_${scalaVersion}:${sparkVersion}"
compile "com.github.rnowling.bigpetstore:bigpetstore-data-generator:0.2.1"
compile "joda-time:joda-time:2.7"
compile "org.json4s:json4s-jackson_2.10:3.1.0"
testCompile "junit:junit:4.11"
testCompile "org.hamcrest:hamcrest-all:1.3"
testCompile "org.scalatest:scalatest_${scalaVersion}:2.2.1"
testCompile "joda-time:joda-time:2.7"
}
task listJars << {
configurations.shadow.each { println it.name }
}
eclipse {
classpath {
// Comment out the following two lines if you want to generate an eclipse project quickly.
downloadSources = true
downloadJavadoc = false
}
}