aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 6f0c8478048a6034f78527619a93c6d186e2017b (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
 * 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.
 */

//        Generated by  http://patorjk.com/software/taag/#p=display&f=Bloody&t=Apache%20Bigtop
def final ASCII_bigtop = '''
                                                     :aass..                                    
                                                       =XS22nai,>__. .                            
                                                       =n-- +!!!""^--                             
                                                      .vX>       .                                
                                                     .)e<o;.                                      
                                                   ._v2`-{S> .                                    
                                                 ..<de~..;)Sa,                                    
                                              .._aoX}:===>=-?Xo>, .  .                            
                                        . .__aaoZe!`=><i=s+s;~*XXos,,_ .   .  .                   
                  ...........______=iisaaoXXZY!"~._v(=d=:nc-1s,-~?SX#Xouass,,_____.:..........    
                 =XXoXXXSXXXXXXXXZUZXX21?!"^-.._au*`=u2` ]X>.+*a>,.-"!Y1XSSX##ZZXXXXXXXXXXXoXXc   
                 .{XXXXXX2*?!!"!"^~--- ...__aa2!^- =dX( .+XXc. ~!1nas,,.---~~^""!"!!!?YSXXXXX2+   
                  -"YSXXXo=.   ._=sssaaav1!!~-  ._aXXe`   )SXo>.  -~"?Yoouass_s,,    _vXXXX2}~    
                      -{XXZoai%%*XXSSSX>..    .<uXXX2~  .  {XXXXs,. .  .=dXXXZX2lii%uXXXXe-       
                      .<XXXXX%-  -<XXXXX1|==%vdXXXXXo;:. ._vXXXXXXos_=i|*XXXXX>   -<XXXXX`        
                       =SXXXZc   ..nXXX2> ---=2XXX2^-"|||}"--~{ZXXX1-- .:XXXXo;  . )XXXX2`        
                     . =XXXXZc     nXXXX>    =XXXXe..__s=>_...)XXXX1 . .:SXXXo;   .)XXXX2..       
                       <SXXXXc .  .nXXXS>    =XXXXosummmmBmma,)ZXXX1    :XXXX2;    )XXXXX.        
                      .<XXXXX(    :nXXXS;    <XXXXXm#mmmWmmmmmoZXXX1   ..3XXXo;. . )XXXXX;        
                     . nXXXXX;.   :XXXXX;   .=XXXXXmmmBmmmWmB#XXXXX1  . .nXXXX>    :XXXXXc .      
                    . =oZXXXe;   .<XXXX2` .  )XXXXZmBmBmWmmmW#2XXXX1 .  .vXXXXc     vXXXXo;       
                      +Y3S2Xz__...vXXXXe .  .)ZXXXZmmWmBmmBBm#XXXXXo..   {XXXXz:.___vSS2Y1=       
                    .     ---+"""*!!*Y1s|=_==uXSSSXZUXUXUXUXUXS2XX2n|_=||%Y*??!"""^~---           
                                         .--- - ---------------- - - -.       
      .o.                                  oooo                  oooooooooo.  o8o               .                     
     .888.                                 `888                  `888'   `Y8b `"'             .o8                     
    .8"888.    oo.ooooo.  .oooo.   .ooooo.  888 .oo.   .ooooo.    888     888oooo  .oooooooo.o888oo .ooooo. oo.ooooo. 
   .8' `888.    888' `88b`P  )88b d88' `"Y8 888P"Y88b d88' `88b   888oooo888'`888 888' `88b   888  d88' `88b 888' `88b
  .88ooo8888.   888   888 .oP"888 888       888   888 888ooo888   888    `88b 888 888   888   888  888   888 888   888
 .8'     `888.  888   888d8(  888 888   .o8 888   888 888    .o   888    .88P 888 `88bod8P'   888 .888   888 888   888
o88o     o8888o 888bod8P'`Y888""8o`Y8bod8P'o888o o888o`Y8bod8P'  o888bood8P' o888o`8oooooo.   "888"`Y8bod8P' 888bod8P'
                888                                                               d"     YD                  888      
               o888o                                                              "Y88888P'                 o888o     
'''

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'
def DEPLOY_GROUP = 'deployment'

// 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 "toolchain-puppetmodules"(type:Exec,
    description: 'Setup puppet modules via toolchain; Requires: Puppet, sudo',
    group: DEVENV_GROUP) {
  def command = [
      'sudo', 'puppet', 'apply', '-d',
      "--modulepath=${projectDir.absolutePath}", '-e',
      'include bigtop_toolchain::puppet-modules'
  ]
  workingDir '.'
  commandLine command
}
task "toolchain-devtools"(type:Exec,
    description: 'Setup additional dev. tools like Groovy SDK via toolchain; Requires: Puppet, sudo',
    group: DEVENV_GROUP) {
  def command = [
      'sudo', 'puppet', 'apply', '-d',
      "--modulepath=${projectDir.absolutePath}", '-e',
      'include bigtop_toolchain::development-tools'
  ]
  workingDir '.'
  commandLine command
}

task "docker-provisioner"(type:Exec,
    description: 'Provision a Bigtop cluster on Docker container(s). Default to CentOS and 1 node.\nCreate a 3 node cluster:\n  $ ./gradlew -Pnum_instances=3 docker-provisioner\nRun smoke tests on 3 node cluster:\n  $ ./gradlew -Pnum_instances=3 -Prun_smoke_tests=true docker-provisioner\nSpecify configuration file (located in bigtop-deploy/vm/vagrant-puppet-docker/):\n  $ ./gradlew -Pconfig=vagrantconfig_debian.yaml docker-provisioner',
    group: DEPLOY_GROUP) {
  def _config = project.hasProperty("config") ? config : "vagrantconfig.yaml"
  def _num_instances = project.hasProperty("num_instances") ? num_instances : 1
  def command = [
      './docker-hadoop.sh',
      '-C', _config,
      '--create', _num_instances,
  ]
  if ( project.hasProperty("run_smoke_tests") && run_smoke_tests ) {
    command.add("--smoke-tests")
  }
  workingDir 'bigtop-deploy/vm/vagrant-puppet-docker'
  commandLine command
}
task "docker-provisioner-ssh"(type:Exec,
    description: 'Show ssh command to get in to the provisioned container',
    group: DEPLOY_GROUP) {
  workingDir 'bigtop-deploy/vm/vagrant-puppet-docker'
  def message = "To ssh in to the container, do: \n(cd " + workingDir + " && vagrant ssh <CONTAIER_NAME>)"
  def command = [
      '/bin/echo',
      message
  ]
  commandLine command
}
task "docker-provisioner-status"(type:Exec,
    description: 'Show status of Bigtop Docker cluster',
    group: DEPLOY_GROUP) {
  def command = [
      'vagrant',
      'status',
  ]
  workingDir 'bigtop-deploy/vm/vagrant-puppet-docker'
  commandLine command
}
task "docker-provisioner-destroy"(type:Exec,
    description: 'Destroy provisioned Bigtop Docker cluster',
    group: DEPLOY_GROUP) {
  def command = [
      './docker-hadoop.sh',
      '--destroy'
  ]
  workingDir 'bigtop-deploy/vm/vagrant-puppet-docker'
  commandLine command
}

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

task installiTest(dependsOn: installTopLevel, type:Exec) {
  workingDir "."
  commandLine 'mvn clean install -f bigtop-test-framework/pom.xml -DskipTests'.split(" ")
}
task installTestArtifacts(dependsOn: installiTest, 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,
        dependsOn: installiTest
    ) << {
      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])
}

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

help.doFirst {
  println ASCII_bigtop
}

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'
  }
}