Build: Add back the old, slow way to build bundles

for gettext < 0.19
This commit is contained in:
zzz
2016-05-07 12:57:49 +00:00
parent 7d11ec2f08
commit 5d93ca19f8
17 changed files with 331 additions and 151 deletions

View File

@ -145,6 +145,7 @@
<!-- this is tricky because the message classes go in the jar, not in the war -->
<target name="bundle" depends="jar1, precompilejsp" unless="no.bundle">
<mkdir dir="build/messages-src" />
<!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true -->
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
@ -199,6 +200,7 @@
</target>
<target name="bundle-news" unless="no.bundle">
<mkdir dir="build/messages-news-src" />
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages-news.sh" />
@ -217,6 +219,7 @@
</target>
<target name="bundle-countries" unless="no.bundle">
<mkdir dir="build/messages-countries-src" />
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages-countries.sh" />

View File

@ -112,24 +112,41 @@ do
# only generate for non-source language
echo "Generating ${CLASS}_$LG ResourceBundle..."
# convert to class files in build/obj
TD=build/messages-countries-src-tmp
TDX=$TD/net/i2p/router/countries
TD2=build/messages-countries-src
TDY=$TD2/net/i2p/router/countries
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
msgfmt -V | grep -q '0\.19'
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
# slow way
# convert to class files in build/obj
msgfmt --java --statistics -r $CLASS -l $LG -d build/obj $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
else
# fast way
# convert to java files in build/messages-countries-src
TD=build/messages-countries-src-tmp
TDX=$TD/net/i2p/router/countries
TD2=build/messages-countries-src
TDY=$TD2/net/i2p/router/countries
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
done
rm -f $TMPFILE

View File

@ -98,24 +98,41 @@ do
# only generate for non-source language
echo "Generating ${CLASS}_$LG ResourceBundle..."
# convert to class files in build/obj
TD=build/messages-news-src-tmp
TDX=$TD/net/i2p/router/news
TD2=build/messages-news-src
TDY=$TD2/net/i2p/router/news
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
msgfmt -V | grep -q '0\.19'
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
# slow way
# convert to class files in build/obj
msgfmt --java --statistics -r $CLASS -l $LG -d build/obj $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
else
# fast way
# convert to java files in build/messages-news-src
TD=build/messages-news-src-tmp
TDX=$TD/net/i2p/router/news
TD2=build/messages-news-src
TDY=$TD2/net/i2p/router/news
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
done
rm -f $TMPFILE

View File

@ -125,24 +125,41 @@ do
# only generate for non-source language
echo "Generating ${CLASS}_$LG ResourceBundle..."
# convert to class files in build/obj
TD=build/messages-src-tmp
TDX=$TD/net/i2p/router/web
TD2=build/messages-src
TDY=$TD2/net/i2p/router/web
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
msgfmt -V | grep -q '0\.19'
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
# slow way
# convert to class files in build/obj
msgfmt --java --statistics -r $CLASS -l $LG -d build/obj $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
else
# fast way
# convert to java files in build/messages-src
TD=build/messages-src-tmp
TDX=$TD/net/i2p/router/web
TD2=build/messages-src
TDY=$TD2/net/i2p/router/web
rm -rf $TD
mkdir -p $TD $TDY
msgfmt --java --statistics --source -r $CLASS -l $LG -d $TD $i
if [ $? -ne 0 ]
then
echo "ERROR - msgfmt failed on ${i}, not updating translations"
# msgfmt leaves the class file there so the build would work the next time
find build/obj -name messages_${LG}.class -exec rm -f {} \;
RC=1
break
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
mv $TDX/messages_$LG.java $TDY
rm -rf $TD
fi
done
rm -f $TMPFILE