Repository: bigtop
Updated Branches:
  refs/heads/master d0c41f6bb -> 3f07e7c6f


BIGTOP-2025. Make BOM to be a directional graph


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/3f07e7c6
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/3f07e7c6
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/3f07e7c6

Branch: refs/heads/master
Commit: 3f07e7c6f8990f3a21218519936c2f04857eefbc
Parents: d0c41f6
Author: Konstantin Boudnik <[email protected]>
Authored: Thu Sep 17 13:48:26 2015 -0700
Committer: Konstantin Boudnik <[email protected]>
Committed: Fri Sep 18 12:00:39 2015 -0700

----------------------------------------------------------------------
 README.md       |  5 +++++
 bigtop.bom      | 19 +++++++++++++++++++
 packages.gradle | 32 ++++++++++++++++++++++----------
 3 files changed, 46 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/3f07e7c6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index ec792f1..6342f92 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,11 @@ __On all systems, Building Apache Bigtop requires certain 
set of tools__
   all development dependencies, frameworks and SDKs, required to build the 
stack on your platform.
 
 * __Building packages__ : `gradle [component-name]-[rpm|deb]`
+
+  Gradle will follow the order of the build specified by the "dependencies" 
section of bigtop.bom file.
+  To build just a single component, e.g. hadoop without zookeeper please use 
-Dbuildnodeps=true.
+
+  You can visualize all tasks dependencies by running `gradle tasks --all`
 * __Building local YUM/APT repositories__ : `gradle [component-name]-[yum|apt]`
 
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3f07e7c6/bigtop.bom
----------------------------------------------------------------------
diff --git a/bigtop.bom b/bigtop.bom
index 9898a5a..e891b6f 100644
--- a/bigtop.bom
+++ b/bigtop.bom
@@ -78,6 +78,25 @@ bigtop {
   }
 /** End of Base Configuration */
 
+  /** Dependencies section defines the order in which packages should be built.
+      The syntax is as follows:
+           dependsOn := [list of dependents]
+      So, below phoenix and giraph ought to be build after the hbase has been 
built
+
+      To build a component without its dependencies, simply comment out
+      dependencies section or run build with -Dbuildnodeps=true
+  */
+  dependencies = [
+    zookeeper:['hadoop', 'hbase'],
+    hadoop:['ignite', 'hbase', 'crunch', 'pig', 'hive', 'tez', 'sqoop', 
'sqoop2',
+      'oozie', 'mahout', 'flume', 'giraph', 'solr', 'crunch', 'spark',
+      'phoenix', 'tachyon', 'kafka', 'ycsb', 'kite', 'hama'
+    ],
+    hbase:['phoenix','giraph','ycsb'],
+    pig:['datafu', 'oozie'],
+    hive:['oozie', 'pig']
+  ]
+
   components {
     'zookeeper' {
       name    = 'zookeeper'

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3f07e7c6/packages.gradle
----------------------------------------------------------------------
diff --git a/packages.gradle b/packages.gradle
index d0fb939..fa83ecd 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -36,6 +36,8 @@ apply plugin: 'groovy'
 def PACKAGES_GROUP = 'package'
 
 final String VERBOSE = "verbose"
+final String DEPS_BUILD = "buildnodeps"
+final boolean buildDependencies = true && System.getProperty(DEPS_BUILD) == 
null
 final String BOM = "$rootDir/bigtop.bom"
 def final config  = new ConfigSlurper().parse(new URL("file:$BOM"))
 
@@ -55,7 +57,6 @@ def final DIST_DIR = config.bigtop.distdir
 def final DL_DIR = config.bigtop.dldir
 def final BIGTOP_BUILD_STAMP = System.getenv('BIGTOP_BUILD_STAMP') ?: 
config.bigtop.buildstamp
 
-def targets = []
 def components = []
 
 // Package building and logic around it
@@ -103,8 +104,8 @@ def nativePackaging = {
 }.call()
 
 task "packages-help" (description: "All package build related tasks 
information", group: PACKAGES_GROUP) << {
-  targets.each { target ->
-    println (target + "\n\t[" + tasks.findAll { alltask -> 
alltask.name.startsWith(target)}*.name.join(", ") + "]")
+  components.each { target ->
+    println (target + "\n\t[" + tasks.findAll { alltask -> 
alltask.name.startsWith(target.toLowerCase())}*.name.join(", ") + "]")
   }
 }
 
@@ -298,9 +299,15 @@ def genTasks = { target ->
     }
     touchTargetFile(config.bigtop.components[target].targetdeb)
   }
-  // Guarantee that tasks are ran in the order set by BOM file
-  if (targets.size() > 0)
-    tdeb.mustRunAfter "${targets.get(targets.size() - 1)}-deb"
+  // Guarantee that tasks are ran in the order set by BOM file dependencies 
section
+  if (buildDependencies)
+    config.bigtop.dependencies.each { dependsOn, dependees ->
+      if (dependees.contains(tdeb.name-"-deb")) tdeb.dependsOn "$dependsOn-deb"
+    }
+  // If dependencies aren't explicitly set, the default build order is defined
+  // by the sequence of the components in the BOM file
+  if (!config.bigtop.dependencies && components.size() > 0)
+    tdeb.mustRunAfter "${components.get(components.size() - 
1)}-deb".toLowerCase()
    task "$target-sdeb" (dependsOn: ["${target}_vardefines",  "${target}-tar"],
       description: "Building SDEB for $target artifacts",
       group: PACKAGES_GROUP
@@ -408,9 +415,15 @@ def genTasks = { target ->
     }.copy { into PKG_OUTPUT_DIR }
     touchTargetFile(config.bigtop.components[target].targetrpm)
   }
-  // Guarantee that tasks are ran in the order set by BOM file
-  if (targets.size() > 0)
-    trpm.mustRunAfter "${targets.get(targets.size() - 1)}-rpm"
+  // Guarantee that tasks are ran in the order set by BOM file dependencies 
section
+  if (buildDependencies)
+    config.bigtop.dependencies.each { dependsOn, dependees ->
+      if (dependees.contains(trpm.name - "-rpm")) trpm.dependsOn 
"$dependsOn-rpm"
+    }
+  // If dependencies aren't explicitly set, the default build order is defined
+  // by the sequence of the components in the BOM file
+  if (!config.bigtop.dependencies && components.size() > 0)
+    trpm.mustRunAfter "${components.get(components.size() - 
1)}-rpm".toLowerCase()
   task "$target-srpm" (dependsOn: ["${target}_vardefines" , "${target}-tar"],
       description: "Building SRPM for $target artifacts",
       group: PACKAGES_GROUP) << {
@@ -586,7 +599,6 @@ def readBOM = {
   config.bigtop.components.each { component_label, comp ->
     assert component_label == comp.name
     genTasks(comp.name)
-    targets.add(comp.name)
     components.add(comp.name)
   }
 }

Reply via email to