You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by co...@apache.org on 2015/03/03 00:27:23 UTC

bigtop git commit: BIGTOP-1718: add facility for printing out BOM in json format

Repository: bigtop
Updated Branches:
  refs/heads/master b2225cfdb -> 0a2283ad5


BIGTOP-1718: add facility for printing out BOM in json format

This is a convience task for printing out the BOM in json format to be interpreted by other programs.
Empty or null values result in a 'null' being printed which is OK in json.

Signed-off-by: Konstantin Boudnik <co...@apache.org>


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

Branch: refs/heads/master
Commit: 0a2283ad5ed2c84987d1ebf8483e71a86cb86f3b
Parents: b2225cf
Author: Rob Leidle <le...@amazon.com>
Authored: Mon Mar 2 09:57:21 2015 -0800
Committer: Konstantin Boudnik <co...@apache.org>
Committed: Mon Mar 2 15:27:12 2015 -0800

----------------------------------------------------------------------
 packages.gradle | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/0a2283ad/packages.gradle
----------------------------------------------------------------------
diff --git a/packages.gradle b/packages.gradle
index 947a84d..e42b5e3 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 import org.ajoberstar.grgit.*
+import groovy.json.JsonOutput
 
 buildscript {
   repositories {
@@ -100,6 +101,42 @@ task "packages-help" (description: "All package build related tasks information"
   }
 }
 
+task "bom-json" (description: "List the components of the stack in json format") << {
+  def componentObjects = components.sort().collect {
+    [
+      name: [
+        project: BOM_map[it + '_NAME'],
+        pkg: BOM_map[it + '_PKG_NAME'],
+        relNotes: BOM_map[it + '_RELNOTES_NAME'],
+      ],
+      tarball: [
+        destination: BOM_map[it + '_TARBALL_DST'],
+        source: BOM_map[it + '_TARBALL_SRC'],
+      ],
+      url: [
+        site: BOM_map[it + '_SITE'],
+        archive: BOM_map[it + '_ARCHIVE'],
+      ],
+      version: [
+        base: BOM_map[it + '_BASE_VERSION'],
+        pkg: BOM_map[it + '_PKG_VERSION'],
+        release: BOM_map[it + '_RELEASE_VERSION'],
+      ],
+      git: [
+         repo: BOM_map[it + '_GIT_REPO'],
+         ref: BOM_map[it + '_GIT_REF'],
+         dir: BOM_map[it + '_GIT_DIR'],
+      ]
+    ]
+  }
+  def fullDefinition = [
+    version: BOM_map['BIGTOP_VERSION'],
+    components: componentObjects
+  ]
+  def json = JsonOutput.toJson(fullDefinition)
+  println JsonOutput.prettyPrint(json)
+}
+
 task "all-components" (description: "List the components of the stack") << {
   println "${project.name} ${BOM_map['BIGTOP_VERSION']} stack includes the following components"
   components.sort().each { comp ->