summaryrefslogtreecommitdiff
path: root/src/ai/api/squirrel_export.sh
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-29 23:27:26 +0000
committertruebrain <truebrain@openttd.org>2011-11-29 23:27:26 +0000
commit4d91f645c15bb3128adf969afcf7f15bd0f14fa0 (patch)
tree8ccc602deda6aa29bedcd19f697558348e7af3d6 /src/ai/api/squirrel_export.sh
parent2c877b074ed656a6cf1d4d4e415cce407980add5 (diff)
downloadopenttd-4d91f645c15bb3128adf969afcf7f15bd0f14fa0.tar.xz
(svn r23370) -Add: support @api tag in API header files, to select which API should receive the defined classes and functions
Diffstat (limited to 'src/ai/api/squirrel_export.sh')
-rwxr-xr-xsrc/ai/api/squirrel_export.sh27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/ai/api/squirrel_export.sh b/src/ai/api/squirrel_export.sh
index 4cb66a7e2..891a522d7 100755
--- a/src/ai/api/squirrel_export.sh
+++ b/src/ai/api/squirrel_export.sh
@@ -26,13 +26,20 @@ apiuc=`echo ${apilc} | tr [a-z] [A-Z]`
if [ -z "$1" ]; then
for f in `ls ../../script/api/*.hpp`; do
- bf=`basename $f | sed s/script/${apilc}/`
- case "${bf}" in
- # these files should not be changed by this script
- "ai_controller.hpp" | "ai_object.hpp" | "ai_types.hpp" | "ai_changelog.hpp" | "ai_info_docs.hpp" ) continue;
- esac
+ bf=`basename ${f} | sed s/script/${apilc}/`
+
+ # ScriptController has custom code, and should not be generated
+ if [ "`basename ${f}`" = "script_controller.hpp" ]; then continue; fi
+
${AWK} -v api=${apiuc} -f squirrel_export.awk ${f} > ${bf}.tmp
- if ! [ -f "${bf}.sq" ] || [ -n "`diff -I '$Id' ${bf}.tmp ${bf}.sq 2> /dev/null || echo boo`" ]; then
+
+ if [ "`wc -l ${bf}.tmp | cut -d\ -f1`" = "0" ]; then
+ if [ -f "${bf}.sq" ]; then
+ echo "Deleted: ${bf}.sq"
+ svn del --force ${bf}.sq > /dev/null 2>&1
+ fi
+ rm -f ${bf}.tmp
+ elif ! [ -f "${bf}.sq" ] || [ -n "`diff -I '$Id' ${bf}.tmp ${bf}.sq 2> /dev/null || echo boo`" ]; then
mv ${bf}.tmp ${bf}.sq
echo "Updated: ${bf}.sq"
svn add ${bf}.sq > /dev/null 2>&1
@@ -44,7 +51,13 @@ if [ -z "$1" ]; then
done
else
${AWK} -v api=${apiuc} -f squirrel_export.awk $1 > $1.tmp
- if ! [ -f "${f}.sq" ] || [ -n "`diff -I '$Id' $1.sq $1.tmp 2> /dev/null || echo boo`" ]; then
+ if [ `wc -l $1.tmp | cut -d\ -f1` -eq "0" ]; then
+ if [ -f "$1.sq" ]; then
+ echo "Deleted: $1.sq"
+ svn del --force $1.sq > /dev/null 2>&1
+ fi
+ rm -f $1.tmp
+ elif ! [ -f "${f}.sq" ] || [ -n "`diff -I '$Id' $1.sq $1.tmp 2> /dev/null || echo boo`" ]; then
mv $1.tmp $1.sq
echo "Updated: $1.sq"
svn add $1.sq > /dev/null 2>&1