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

@ -16,6 +16,7 @@
<target name="init"> <target name="init">
<mkdir dir="${build}"/> <mkdir dir="${build}"/>
<mkdir dir="${build}/messages-src"/>
<mkdir dir="${dist}"/> <mkdir dir="${dist}"/>
</target> </target>
@ -37,7 +38,7 @@
</javac> </javac>
</target> </target>
<target name="bundle" unless="no.bundle"> <target name="bundle" unless="no.bundle" depends="init">
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" /> <env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages.sh" /> <arg value="./bundle-messages.sh" />

View File

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

View File

@ -137,6 +137,7 @@
</target> </target>
<target name="bundle" depends="compile" unless="no.bundle"> <target name="bundle" depends="compile" unless="no.bundle">
<mkdir dir="build/messages-src" />
<!-- Update the messages_*.po files. <!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true --> 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}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >

View File

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

View File

@ -123,6 +123,7 @@
<!-- servlet translations go in the war, not the jar --> <!-- servlet translations go in the war, not the jar -->
<target name="bundle" depends="compile, precompilejsp" unless="no.bundle"> <target name="bundle" depends="compile, precompilejsp" unless="no.bundle">
<mkdir dir="build/messages-src" />
<!-- Update the messages_*.po files. <!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true --> 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}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
@ -161,6 +162,7 @@
<!-- proxy error page translations go in the jar, not the war --> <!-- proxy error page translations go in the jar, not the war -->
<target name="bundle-proxy" unless="no.bundle"> <target name="bundle-proxy" unless="no.bundle">
<mkdir dir="build/messages-proxy-src" />
<!-- Update the messages_*.po files. <!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true --> 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}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >

View File

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

View File

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

View File

@ -100,6 +100,7 @@
</target> </target>
<target name="bundle" depends="compile" unless="no.bundle"> <target name="bundle" depends="compile" unless="no.bundle">
<mkdir dir="build/messages-src" />
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" /> <env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages.sh" /> <arg value="./bundle-messages.sh" />

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -136,6 +136,7 @@
</target> </target>
<target name="bundle" depends="compile, precompilejsp" unless="no.bundle"> <target name="bundle" depends="compile, precompilejsp" unless="no.bundle">
<mkdir dir="build/messages-src" />
<!-- Update the messages_*.po files. <!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true --> 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}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >

View File

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

View File

@ -100,6 +100,7 @@
</target> </target>
<target name="bundle" depends="compile" unless="no.bundle"> <target name="bundle" depends="compile" unless="no.bundle">
<mkdir dir="build/messages-src" />
<!-- Update the messages_*.po files. <!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true --> 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}" > <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >

View File

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