aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen/generate_projects.sh
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-01-06 18:08:25 -0800
committerGravatar Nicolas Noble <nnoble@google.com>2015-01-06 18:08:25 -0800
commitddef24620a67fa352d94415dc56121c01e3d8af8 (patch)
treef2383ee6e84a21e92f1524d23436ab28cfe04756 /tools/buildgen/generate_projects.sh
parent9f2b09e112f5b95e843de786d7d3ecfd026170b6 (diff)
Adding the tools directory to the git export.
Diffstat (limited to 'tools/buildgen/generate_projects.sh')
-rwxr-xr-xtools/buildgen/generate_projects.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh
new file mode 100755
index 0000000000..f4e367d620
--- /dev/null
+++ b/tools/buildgen/generate_projects.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+set -ex
+
+if [ "x$TEST" == "x" ] ; then
+ TEST=false
+fi
+
+
+cd `dirname $0`/..
+mako_renderer=tools/buildgen/mako_renderer.py
+gen_build_json=test/core/end2end/gen_build_json.py
+
+end2end_test_build=`mktemp`
+$gen_build_json > $end2end_test_build
+
+global_plugins=`find ./tools/buildgen/plugins -name '*.py' |
+ sort | grep -v __init__ |
+ while read p ; do echo -n "-p $p " ; done`
+
+for dir in . ; do
+ local_plugins=`find $dir/templates -name '*.py' |
+ sort | grep -v __init__ |
+ while read p ; do echo -n "-p $p " ; done`
+
+ plugins="$global_plugins $local_plugins"
+
+ find -L $dir/templates -type f -and -name *.template | while read file ; do
+ out=${dir}/${file#$dir/templates/} # strip templates dir prefix
+ out=${out%.*} # strip template extension
+ json_files="build.json $end2end_test_build"
+ data=`for i in $json_files; do echo -n "-d $i "; done`
+ if [ $TEST == true ] ; then
+ actual_out=$out
+ out=`mktemp`
+ else
+ g4 open $out || true
+ fi
+ $mako_renderer $plugins $data -o $out $file
+ if [ $TEST == true ] ; then
+ diff -q $out $actual_out
+ rm $out
+ fi
+ done
+done
+
+rm $end2end_test_build
+