aboutsummaryrefslogtreecommitdiffstats
path: root/compile_protobuf.sh
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-22 16:59:00 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-23 10:46:10 +0200
commit17af5360c394efb1c7e85817c7406ad9f3356b93 (patch)
tree314949a075e52f141df5a637088ac37546a763e8 /compile_protobuf.sh
parent5e36720bed53fd3237cc34935c94a48a83fd25d4 (diff)
downloadsonarqube-17af5360c394efb1c7e85817c7406ad9f3356b93.tar.gz
sonarqube-17af5360c394efb1c7e85817c7406ad9f3356b93.zip
Move protobuf spec of table FILE_SOURCES.BINARY_DATA into sonar-db
Diffstat (limited to 'compile_protobuf.sh')
-rwxr-xr-xcompile_protobuf.sh23
1 files changed, 17 insertions, 6 deletions
diff --git a/compile_protobuf.sh b/compile_protobuf.sh
index 8e07c4dc2cd..25852269d1e 100755
--- a/compile_protobuf.sh
+++ b/compile_protobuf.sh
@@ -1,14 +1,25 @@
#!/bin/bash
-# Usage: compile_protobuf <inputDir> <outputDir>
+# Compiles all the Protocol Buffers files (*.proto) to Java source code.
+# IMPORTANT - protobuf 2.6.1 must be installed. Other versions are not supported.
+
+# Usage: compile_protobuf <module> <type: main or test>
function compile_protobuf {
- echo "Compiling [$1] to [$2]..."
- mkdir -p $2
- protoc --proto_path=$1 --java_out=$2 $1/*.proto
+ INPUT="$1/src/$2/protobuf"
+ OUTPUT="$1/src/$2/gen-java"
+
+ if [ -d $INPUT ]
+ then
+ echo "Compiling [$INPUT] to [$OUTPUT]..."
+ rm -rf $OUTPUT
+ mkdir -p $OUTPUT
+ protoc --proto_path=$INPUT --java_out=$OUTPUT $INPUT/*.proto
+ fi
}
-compile_protobuf "sonar-core/src/test/protobuf" "sonar-core/src/test/gen-java"
-compile_protobuf "sonar-batch-protocol/src/main/protobuf" "sonar-batch-protocol/src/main/gen-java"
+compile_protobuf "sonar-batch-protocol" "main"
+compile_protobuf "sonar-core" "test"
+compile_protobuf "sonar-db" "main"