aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 02ac770fe34e951c484a7c1da48d3ae501e12c2b (plain)
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
/*
 * 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: 'maven'
// All packaging logic is separated into its own build module
apply from: 'packages.gradle'

group = 'org.apache.bigtop'
version = '0.9.0-SNAPSHOT'

description = """Bigtop"""

def TESTARTIFACTS_GROUP = 'test artifacts'

sourceCompatibility = 1.6
targetCompatibility = 1.6

task installTopLevel(type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f pom.xml'.split(" ")
}

task installiTest(type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f bigtop-test-framework/pom.xml -DskipTests'.split(" ")
}
task installTestArtifacts(type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f bigtop-tests/test-artifacts/pom.xml'.split(" ")
}
task installConf(type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f bigtop-tests/test-execution/conf/pom.xml'.split(" ")
}
task installCommon(type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f bigtop-tests/test-execution/common/pom.xml'.split(" ")
}
task installAllLocalArtifacts (
    description: "Prepare and locally install all test artifacts",
    group: TESTARTIFACTS_GROUP) {
}

/**
 * Allows user to specify which artifacts to install by dynamically generating tasks.
 */
def artifactToInstall = {
  def final BASE_DIR = projectDir.absolutePath
  def final TEST_DIR = "bigtop-tests/test-artifacts"
  def final ARTIFACT_DIR = "${BASE_DIR}/${TEST_DIR}"

  def project = new XmlSlurper().parse("$TEST_DIR/pom.xml")
  project.modules.module.each { artifact ->
    task "install-${artifact}" (description: "Installs ${artifact} artifact with Maven", group: TESTARTIFACTS_GROUP) << {
      def final PATH = "${ARTIFACT_DIR}/$artifact/pom.xml"
      def final WRAPPER = "mvn clean install -f " + PATH
      exec {
        workingDir '.'
        commandLine WRAPPER.split(" ")
      }
    }
  }
}

project.afterEvaluate{
  artifactToInstall(dependsOn: [installTopLevel, installCommon, installConf, installiTest])
}

installTestArtifacts.mustRunAfter installiTest
installiTest.mustRunAfter installTopLevel
installAllLocalArtifacts.dependsOn installTopLevel, installCommon, installConf, installiTest, installTestArtifacts

repositories {
  maven { url "http://repository.apache.org/snapshots" }
  maven { url "http://repo.maven.apache.org/maven2" }
}
buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'de.undercouch:gradle-download-task:1.0'
  }
}