summaryrefslogtreecommitdiffstats
path: root/thrift-compile.sh
diff options
context:
space:
mode:
authorSimon Rettberg2014-11-13 14:21:01 +0100
committerSimon Rettberg2014-11-13 14:21:01 +0100
commit1b49a7e69c5480f5af48bb3c08193e0d20327e0e (patch)
tree1e9a50ccbe83a0730370472759c714b4efdef6a7 /thrift-compile.sh
parentUpdate proxy-vole dependency in pom.xml, run thrift compiler (diff)
downloadmaster-sync-shared-1b49a7e69c5480f5af48bb3c08193e0d20327e0e.tar.gz
master-sync-shared-1b49a7e69c5480f5af48bb3c08193e0d20327e0e.tar.xz
master-sync-shared-1b49a7e69c5480f5af48bb3c08193e0d20327e0e.zip
Pimped thrift compilation script to warn if not using 0.9.1
Diffstat (limited to 'thrift-compile.sh')
-rwxr-xr-xthrift-compile.sh23
1 files changed, 17 insertions, 6 deletions
diff --git a/thrift-compile.sh b/thrift-compile.sh
index 4ff5b17..d9a0428 100755
--- a/thrift-compile.sh
+++ b/thrift-compile.sh
@@ -1,10 +1,21 @@
#!/bin/sh
-rm -r gen-java
-thrift --gen java src/main/thrift/imagemaster.thrift && {
-# find gen-java -type f -name "*.java" -exec sed -i 's/Autogenerated by Thrift Compiler \(.*\)/Autogenerated by Thrift Compiler/g' {} \;
- rm -r src/main/java/org/openslx/imagemaster/thrift/iface
- cp -r gen-java/org src/main/java/
-}
+if ! thrift --version | grep -q "0\.9\.1"; then
+ echo -n "Warning! You should be using Thrift 0.9.1, but you have $(thrift --version), do you still want to continue? [y/N]: "
+ read choice
+ if [ "x${choice:0:1}" != "xy" ]; then
+ echo "Aborting!"
+ exit 0
+ fi
+ echo "OK, compiling..."
+fi
+[ -e gen-java ] && rm -r gen-java
+if thrift --gen java src/main/thrift/imagemaster.thrift; then
+ [ -e "src/main/java/org/openslx/imagemaster/thrift/iface" ] && rm -rf src/main/java/org/openslx/imagemaster/thrift/iface
+ cp -r gen-java/org src/main/java/ && echo "Success." && exit 0
+fi
+
+echo "Error!"
+exit 1