summaryrefslogblamecommitdiffstats
path: root/thrift-compile.sh
blob: 82822fd368ef9dfc14762cd87b0dcb9f73e9a834 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

         








                                                                                                                                     

                          


                                                                                                                                













                                                                                                                

  

                

 
#!/bin/sh

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

echo "1) Masterserver RPC"
[ -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
	if ! cp -r gen-java/org src/main/java/; then
		echo "Error copying compiled files! Aborting!"
		exit 1
	fi
fi

echo "2) Sat RPC"
[ -e gen-java ] && rm -r gen-java
if thrift --gen java src/main/thrift/sat.thrift; then
	[ -e "src/main/java/org/openslx/sat/thrift/iface" ] && rm -rf src/main/java/org/openslx/sat/thrift/iface
	if ! cp -r gen-java/org src/main/java/; then
		echo "Error copying compiled files! Aborting!"
		exit 1
	fi
fi

echo "All done!"
exit 0