aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: da12231e14b8fc5cbfb51f89bdefecc335854f8a (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
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
/*
 * 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.
 */
def final langLevel = "1.7"

allprojects {
  apply plugin: 'java'
  apply plugin: 'maven'

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

  description = """Bigtop"""

  sourceCompatibility = langLevel
  targetCompatibility = langLevel

  repositories {
    maven { url "http://repository.apache.org/snapshots" }
    maven { url "http://repo.maven.apache.org/maven2" }
    mavenCentral()
  }
}

subprojects {
  apply plugin: 'groovy'
}

project(':itest-common') {
  description = """iTest: system and integration testing in the cloud"""

  dependencies {
    compile group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.1.8'
    compile group: 'junit', name: 'junit', version:'4.11'
    compile group: 'commons-logging', name: 'commons-logging', version:'1.1'
    compile group: 'org.apache.ant', name: 'ant', version:'1.8.2'
    compile group: 'org.apache.ant', name: 'ant-junit', version:'1.8.2'
  }

  task packageITest(type: Jar) {
    from sourceSets.main.output
    //classifier = 'tests'
  }

  artifacts.archives packageITest

  test {
    exclude '**/Dummy*'
  }
}

def TESTARTIFACTS_GROUP = 'test artifacts'
def DEVENV_GROUP = 'development tools'

// All packaging logic is separated into its own build module
apply from: 'packages.gradle'

task toolchain(type:Exec,
    description: 'Setup dev. env via toolchain; Requires: Puppet, sudo',
    group: DEVENV_GROUP) {
  def command = [
      'sudo', 'puppet', 'apply', '-d',
      "--modulepath=${projectDir.absolutePath}", '-e',
      'include bigtop_toolchain::installer'
  ]
  workingDir '.'
  commandLine command
}

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 = "$BASE_DIR/bigtop-tests/test-artifacts"

  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 = "${TEST_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'
  }
}