mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
Update build system in templates compilation.
Use closure compiler instead of handlebars built in minifier and recompile all templates.
This commit is contained in:
parent
709623dfc5
commit
ba7eb96e8a
@ -33,7 +33,6 @@
|
||||
|
||||
<!-- Compile templates -->
|
||||
<apply executable="${handlebars}">
|
||||
<arg value="-m"/>
|
||||
<arg value="-f"/>
|
||||
<targetfile />
|
||||
<dirset dir=".">
|
||||
@ -42,13 +41,32 @@
|
||||
<mapper type="glob" from="*/handlebars_templates" to="*/js/compiled/templates_tmp.js" />
|
||||
</apply>
|
||||
|
||||
<!-- Appent license info -->
|
||||
<!-- Use closule compiler instead of handlebars minifyer (-m flag)
|
||||
because of handlebars not insert line breaks.
|
||||
Very long lines are cutted by ant and this brings problems -->
|
||||
<apply executable="java">
|
||||
<arg value="-jar" />
|
||||
<arg value="${closure.c}" />
|
||||
<arg value="--js" />
|
||||
<srcfile />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<fileset dir=".">
|
||||
<include name="${dialogs_styles_path}/*/js/compiled/templates_tmp.js" />
|
||||
</fileset>
|
||||
<mapper type="glob" from="*_tmp.js" to="*_tmp.c.js" />
|
||||
</apply>
|
||||
|
||||
<!-- Add license info. Use move because of it is the best way to append
|
||||
some info to files -->
|
||||
<move todir="${dialogs_styles_path}" overwrite="true">
|
||||
<fileset dir="${dialogs_styles_path}"/>
|
||||
<mapper type="glob" from="*/js/compiled/templates_tmp.js" to="*/js/compiled/templates.js"/>
|
||||
<mapper type="glob" from="*/js/compiled/templates_tmp.c.js" to="*/js/compiled/templates.js"/>
|
||||
|
||||
<filterchain>
|
||||
<!-- Remove comments -->
|
||||
<!-- Remove old comments. There is no strip JavaScript comments
|
||||
filter in ant, but luckily comments in Java and in
|
||||
JavaScript have the same syntax -->
|
||||
<stripjavacomments />
|
||||
<!-- Add header -->
|
||||
<concatfilter prepend="compiled_templates_header.txt" />
|
||||
@ -59,6 +77,13 @@
|
||||
</filterchain>
|
||||
</move>
|
||||
|
||||
<!-- Remove all temporary files -->
|
||||
<delete>
|
||||
<fileset dir=".">
|
||||
<include name="${dialogs_styles_path}/*/js/compiled/templates_tmp.js" />
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<echo>Done</echo>
|
||||
</target>
|
||||
|
||||
@ -326,9 +351,8 @@
|
||||
<!-- Compile Handlebars templates of the Core -->
|
||||
<target name="core_handlebars">
|
||||
<echo>Compile Handlebars templates of the Core</echo>
|
||||
<!-- Build applications templates -->
|
||||
<!-- Compile applications templates -->
|
||||
<apply executable="${handlebars}">
|
||||
<arg value="-m"/>
|
||||
<arg value="-f"/>
|
||||
<targetfile />
|
||||
<dirset dir=".">
|
||||
@ -339,7 +363,6 @@
|
||||
|
||||
<!-- Build misc files -->
|
||||
<apply executable="${handlebars}">
|
||||
<arg value="-m"/>
|
||||
<arg value="-f"/>
|
||||
<targetfile />
|
||||
<fileset dir=".">
|
||||
@ -348,20 +371,35 @@
|
||||
<mapper type="regexp" from="^(.*)/source/(.*)\.handlebars$$" to="\1/compiled/\2_tmp.tpl.js" />
|
||||
</apply>
|
||||
|
||||
<!-- Add licanse info -->
|
||||
<!-- Use closule compiler instead of handlebars minifyer (-m flag)
|
||||
because of handlebars not insert line breaks.
|
||||
Very long lines are cutted by ant and this brings problems -->
|
||||
<apply executable="java">
|
||||
<arg value="-jar" />
|
||||
<arg value="${closure.c}" />
|
||||
<arg value="--js" />
|
||||
<srcfile />
|
||||
<arg value="--js_output_file" />
|
||||
<targetfile />
|
||||
<fileset dir=".">
|
||||
<include name="${js_path}/templates/compiled/*_app_tmp.tpl.js" />
|
||||
</fileset>
|
||||
<mapper type="glob" from="*_app_tmp.tpl.js" to="*_app_tmp.c.tpl.js" />
|
||||
</apply>
|
||||
|
||||
<!-- Add license info. Use move because of it is the best way to append
|
||||
some info to files -->
|
||||
<move todir="${js_path}/templates/compiled" overwrite="true">
|
||||
<fileset dir="${js_path}/templates/compiled">
|
||||
<include name="*_tmp.tpl.js" />
|
||||
<include name="*_tmp.c.tpl.js" />
|
||||
</fileset>
|
||||
<mapper type="glob" from="*_tmp.tpl.js" to="*.tpl.js"/>
|
||||
<mapper type="glob" from="*_tmp.c.tpl.js" to="*.tpl.js"/>
|
||||
|
||||
<filterchain>
|
||||
<!-- Remove comments -->
|
||||
<!-- Remove old comments. There is no strip JavaScript comments
|
||||
filter in ant, but luckily comments in Java and in
|
||||
JavaScript have the same syntax -->
|
||||
<stripjavacomments />
|
||||
<!-- For some reasons handlebars do not add trailing semicolon.
|
||||
Assume that where is only one line in file and add semicolon
|
||||
manually -->
|
||||
<suffixlines suffix=";" />
|
||||
<!-- Add header -->
|
||||
<concatfilter prepend="compiled_templates_header.txt" />
|
||||
<!-- Skip empty lines -->
|
||||
@ -371,6 +409,13 @@
|
||||
</filterchain>
|
||||
</move>
|
||||
|
||||
<!-- Remove all temporary files. -->
|
||||
<delete>
|
||||
<fileset dir="${js_path}/templates/compiled">
|
||||
<include name="*_tmp.tpl.js" />
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<echo>Done</echo>
|
||||
</target>
|
||||
|
||||
|
@ -4,7 +4,12 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.default_control=a(function(a,b,c,d,e){this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f="",g,h="function",i=this.escapeExpression;return f+="<strong>",(g=c.title)?g=g.call(b,{hash:{},data:e}):(g=b.title,g=typeof g===h?g.apply(b):g),f+=i(g)+"</strong>",f}),b.sound=a(function(a,b,c,d,e){function j(a,b){var d="",e;return d+='\n<audio autoplay src="',(e=c.file)?e=e.call(a,{hash:{},data:b}):(e=a.file,e=typeof e===g?e.apply(a):e),d+=h(e)+'">\n <embed src="',(e=c.file)?e=e.call(a,{hash:{},data:b}):(e=a.file,e=typeof e===g?e.apply(a):e),d+=h(e)+'" hidden="true" autostart="true" loop="false" />\n</audio>\n',d}this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f,g="function",h=this.escapeExpression,i=this;return f=c["if"].call(b,b.file,{hash:{},inverse:i.noop,fn:i.program(1,j,e),data:e}),f||f===0?f:""}),b.message=a(function(a,b,c,d,e){function n(a,b){var d="",e;return d+="<span class='n",(e=c.kindName)?e=e.call(a,{hash:{},data:b}):(e=a.kindName,e=typeof e===j?e.apply(a):e),d+=k(e)+"'>",(e=c.name)?e=e.call(a,{hash:{},data:b}):(e=a.name,e=typeof e===j?e.apply(a):e),d+=k(e)+"</span>: ",d}function o(a,b){var d,e;return e={hash:{},data:b},k((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br, allowTags",e):l.call(a,"apply",a.message,"urlReplace, nl2br, allowTags",e)))}function p(a,b){var d,e;return e={hash:{},data:b},k((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br",e):l.call(a,"apply",a.message,"urlReplace, nl2br",e)))}this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f="",g,h,i,j="function",k=this.escapeExpression,l=c.helperMissing,m=this;f+="<span>",i={hash:{},data:e},f+=k((g=c.formatTime,g?g.call(b,b.created,i):l.call(b,"formatTime",b.created,i)))+"</span>\n",h=c["if"].call(b,b.name,{hash:{},inverse:m.noop,fn:m.program(1,n,e),data:e});if(h||h===0)f+=h;f+="\n<span class='m",(h=c.kindName)?h=h.call(b,{hash:{},data:e}):(h=b.kindName,h=typeof h===j?h.apply(b):h),f+=k(h)+"'>",h=c["if"].call(b,b.allowFormatting,{hash:{},inverse:m.program(5,p,e),fn:m.program(3,o,e),data:e});if(h||h===0)f+=h;return f+="</span><br/>",f})})();/*
|
||||
(function(){var h=Handlebars.template,m=Handlebars.templates=Handlebars.templates||{};m.default_control=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};l=this.escapeExpression;a="<strong>";(c=c.title)?c=c.call(b,{hash:{},data:g}):(c=b.title,c="function"===typeof c?c.apply(b):c);return a+=l(c)+"</strong>"});m.sound=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};var d=this.escapeExpression;return(a=c["if"].call(b,b.file,{hash:{},
|
||||
inverse:this.noop,fn:this.program(1,function(a,b){var k,f;k='\n<audio autoplay src="';(f=c.file)?f=f.call(a,{hash:{},data:b}):(f=a.file,f="function"===typeof f?f.apply(a):f);k+=d(f)+'">\n <embed src="';(f=c.file)?f=f.call(a,{hash:{},data:b}):(f=a.file,f="function"===typeof f?f.apply(a):f);return k+=d(f)+'" hidden="true" autostart="true" loop="false" />\n</audio>\n'},g),data:g}))||0===a?a:""});m.message=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};var d,j=this.escapeExpression,
|
||||
h=c.helperMissing;a={hash:{},data:g};a="<span>"+(j((d=c.formatTime,d?d.call(b,b.created,a):h.call(b,"formatTime",b.created,a)))+"</span>\n");if((d=c["if"].call(b,b.name,{hash:{},inverse:this.noop,fn:this.program(1,function(a,f){var b,e;b="<span class='n";(e=c.kindName)?e=e.call(a,{hash:{},data:f}):(e=a.kindName,e="function"===typeof e?e.apply(a):e);b+=j(e)+"'>";(e=c.name)?e=e.call(a,{hash:{},data:f}):(e=a.name,e="function"===typeof e?e.apply(a):e);return b+=j(e)+"</span>: "},g),data:g}))||0===d)a+=
|
||||
d;a+="\n<span class='m";(d=c.kindName)?d=d.call(b,{hash:{},data:g}):(d=b.kindName,d="function"===typeof d?d.apply(b):d);a+=j(d)+"'>";if((d=c["if"].call(b,b.allowFormatting,{hash:{},inverse:this.program(5,function(a,b){var d,e;e={hash:{},data:b};return j((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br",e):h.call(a,"apply",a.message,"urlReplace, nl2br",e)))},g),fn:this.program(3,function(a,b){var d,e;e={hash:{},data:b};return j((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br, allowTags",e):h.call(a,
|
||||
"apply",a.message,"urlReplace, nl2br, allowTags",e)))},g),data:g}))||0===d)a+=d;return a+="</span><br/>"})})();
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,4 +4,8 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.default_control=a(function(a,b,c,d,e){this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f="",g,h="function",i=this.escapeExpression;return f+="<strong>",(g=c.title)?g=g.call(b,{hash:{},data:e}):(g=b.title,g=typeof g===h?g.apply(b):g),f+=i(g)+"</strong>",f}),b.sound=a(function(a,b,c,d,e){function j(a,b){var d="",e;return d+='\n<audio autoplay src="',(e=c.file)?e=e.call(a,{hash:{},data:b}):(e=a.file,e=typeof e===g?e.apply(a):e),d+=h(e)+'">\n <embed src="',(e=c.file)?e=e.call(a,{hash:{},data:b}):(e=a.file,e=typeof e===g?e.apply(a):e),d+=h(e)+'" hidden="true" autostart="true" loop="false" />\n</audio>\n',d}this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f,g="function",h=this.escapeExpression,i=this;return f=c["if"].call(b,b.file,{hash:{},inverse:i.noop,fn:i.program(1,j,e),data:e}),f||f===0?f:""}),b.message=a(function(a,b,c,d,e){function n(a,b){var d="",e;return d+="<span class='n",(e=c.kindName)?e=e.call(a,{hash:{},data:b}):(e=a.kindName,e=typeof e===j?e.apply(a):e),d+=k(e)+"'>",(e=c.name)?e=e.call(a,{hash:{},data:b}):(e=a.name,e=typeof e===j?e.apply(a):e),d+=k(e)+"</span>: ",d}function o(a,b){var d,e;return e={hash:{},data:b},k((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br, allowTags",e):l.call(a,"apply",a.message,"urlReplace, nl2br, allowTags",e)))}function p(a,b){var d,e;return e={hash:{},data:b},k((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br",e):l.call(a,"apply",a.message,"urlReplace, nl2br",e)))}this.compilerInfo=[2,">= 1.0.0-rc.3"],c=c||a.helpers,e=e||{};var f="",g,h,i,j="function",k=this.escapeExpression,l=c.helperMissing,m=this;f+="<span>",i={hash:{},data:e},f+=k((g=c.formatTime,g?g.call(b,b.created,i):l.call(b,"formatTime",b.created,i)))+"</span>\n",h=c["if"].call(b,b.name,{hash:{},inverse:m.noop,fn:m.program(1,n,e),data:e});if(h||h===0)f+=h;f+="\n<span class='m",(h=c.kindName)?h=h.call(b,{hash:{},data:e}):(h=b.kindName,h=typeof h===j?h.apply(b):h),f+=k(h)+"'>",h=c["if"].call(b,b.allowFormatting,{hash:{},inverse:m.program(5,p,e),fn:m.program(3,o,e),data:e});if(h||h===0)f+=h;return f+="</span><br/>",f})})();
|
||||
(function(){var h=Handlebars.template,m=Handlebars.templates=Handlebars.templates||{};m.default_control=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};l=this.escapeExpression;a="<strong>";(c=c.title)?c=c.call(b,{hash:{},data:g}):(c=b.title,c="function"===typeof c?c.apply(b):c);return a+=l(c)+"</strong>"});m.sound=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};var d=this.escapeExpression;return(a=c["if"].call(b,b.file,{hash:{},
|
||||
inverse:this.noop,fn:this.program(1,function(a,b){var k,f;k='\n<audio autoplay src="';(f=c.file)?f=f.call(a,{hash:{},data:b}):(f=a.file,f="function"===typeof f?f.apply(a):f);k+=d(f)+'">\n <embed src="';(f=c.file)?f=f.call(a,{hash:{},data:b}):(f=a.file,f="function"===typeof f?f.apply(a):f);return k+=d(f)+'" hidden="true" autostart="true" loop="false" />\n</audio>\n'},g),data:g}))||0===a?a:""});m.message=h(function(a,b,c,l,g){this.compilerInfo=[2,">= 1.0.0-rc.3"];c=c||a.helpers;g=g||{};var d,j=this.escapeExpression,
|
||||
h=c.helperMissing;a={hash:{},data:g};a="<span>"+(j((d=c.formatTime,d?d.call(b,b.created,a):h.call(b,"formatTime",b.created,a)))+"</span>\n");if((d=c["if"].call(b,b.name,{hash:{},inverse:this.noop,fn:this.program(1,function(a,f){var b,e;b="<span class='n";(e=c.kindName)?e=e.call(a,{hash:{},data:f}):(e=a.kindName,e="function"===typeof e?e.apply(a):e);b+=j(e)+"'>";(e=c.name)?e=e.call(a,{hash:{},data:f}):(e=a.name,e="function"===typeof e?e.apply(a):e);return b+=j(e)+"</span>: "},g),data:g}))||0===d)a+=
|
||||
d;a+="\n<span class='m";(d=c.kindName)?d=d.call(b,{hash:{},data:g}):(d=b.kindName,d="function"===typeof d?d.apply(b):d);a+=j(d)+"'>";if((d=c["if"].call(b,b.allowFormatting,{hash:{},inverse:this.program(5,function(a,b){var d,e;e={hash:{},data:b};return j((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br",e):h.call(a,"apply",a.message,"urlReplace, nl2br",e)))},g),fn:this.program(3,function(a,b){var d,e;e={hash:{},data:b};return j((d=c.apply,d?d.call(a,a.message,"urlReplace, nl2br, allowTags",e):h.call(a,
|
||||
"apply",a.message,"urlReplace, nl2br, allowTags",e)))},g),data:g}))||0===d)a+=d;return a+="</span><br/>"})})();
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user