Adding build tools for gRPC compilation.
ONOS-6095
Change-Id: I80687eb2a91ad60c4dbec0bb966e917555d46151
diff --git a/buck-tools/BUCK b/buck-tools/BUCK
index 6d05f9e..9548e41 100644
--- a/buck-tools/BUCK
+++ b/buck-tools/BUCK
@@ -52,3 +52,9 @@
src = 'yang-schema',
visibility = [ 'PUBLIC' ],
)
+
+export_file(
+ name = 'grpc',
+ src = 'grpc',
+ visibility = [ 'PUBLIC' ],
+)
diff --git a/buck-tools/default.defs b/buck-tools/default.defs
index d70cc37..ad9f8aa 100644
--- a/buck-tools/default.defs
+++ b/buck-tools/default.defs
@@ -4,6 +4,7 @@
include_defs('//bucklets/onos_app.bucklet')
include_defs('//bucklets/yang.bucklet')
include_defs('//bucklets/remote_jar.bucklet')
+include_defs('//bucklets/grpc.bucklet')
BASE_DEPS = [
'//lib:junit',
diff --git a/buck-tools/grpc b/buck-tools/grpc
new file mode 100755
index 0000000..6eb5af3
--- /dev/null
+++ b/buck-tools/grpc
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Generates the gRPC java artifacts from protobuf models.
+# -----------------------------------------------------------------------------
+out=$1
+shift
+proto_paths=$1
+shift
+protoc=$1
+shift
+plugin=$1
+shift
+
+#set -x
+
+dir=$(dirname $out)
+mkdir -p $dir
+
+$protoc \
+ --plugin=protoc-gen-grpc-java=$plugin \
+ --grpc-java_out=$dir \
+ --java_out=$dir \
+ $proto_paths \
+ $*
+
+cd $dir
+jar -cf $out *