Thread: [Qooxdoo-commit] qooxdoo/tools build_dist.pl,1.20.2.3,1.20.2.4
Brought to you by:
ecker,
martinwittemann
|
From: Benjamin R. <fir...@us...> - 2005-12-20 14:34:35
|
Update of /cvsroot/qooxdoo/qooxdoo/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6336 Modified Files: Tag: renderer build_dist.pl Log Message: added compression flag Index: build_dist.pl =================================================================== RCS file: /cvsroot/qooxdoo/qooxdoo/tools/build_dist.pl,v retrieving revision 1.20.2.3 retrieving revision 1.20.2.4 diff -C2 -d -r1.20.2.3 -r1.20.2.4 *** build_dist.pl 18 Nov 2005 15:58:09 -0000 1.20.2.3 --- build_dist.pl 20 Dec 2005 14:34:23 -0000 1.20.2.4 *************** *** 24,27 **** --- 24,28 ---- my $basedir = $opt_b || '.'; my $fileSuffix = $opt_e || '.js'; + my $compress = $opt_c || 0; if ( !$package ) { *************** *** 72,169 **** @neededFiles = grep ++$t{$_} < 2, @neededFiles; # put all the files into $text find(\&searchFiles, ($basedir)); - appendFiles(); - - - # remove unnecessary stuff like comments and whitespace - print "Now compressing ".@neededFiles ." files \n"; - - $text =~ s/\/\*!?(?:.|[\r\n])*?\*\///gm; # multi-line comments, see http://ostermiller.org/findcomment.html - $text =~ s|//.*\n||g; # single-line comments see http://perlmonks.thepen.com/117150.html - - # cleanup '{', '}', '(', ')' ';' - $text =~ s|(\s+\{)|{|gm; - $text =~ s|(\s+\})|}|gm; - $text =~ s|(\s+\()|(|gm; - $text =~ s|(\s+\))|)|gm; - $text =~ s|(\{\s+)|{|gm; - $text =~ s|(\}\s+)|}|gm; - $text =~ s|(\(\s+)|(|gm; - $text =~ s|(\)\s+)|)|gm; - $text =~ s|(\;\s+)|;|gm; - $text =~ s|(\;\s+[^a-zA-Z])|;|gm; ! # shrink around '==' ! $text =~ s|\s+==|==|gm; ! $text =~ s|==\s+|==|gm; ! ! # shrink around '!=' ! $text =~ s|"\s+\!=|!=|gm; ! $text =~ s|\!=\s+|!=|gm; ! ! # shrink around '=' ! $text =~ s|\s+=|=|gm; ! $text =~ s|=\s+|=|gm; ! ! # shrink around ',' ! $text =~ s|\s+,|,|gm; ! $text =~ s|,\s+|,|gm; ! ! # shrink around ':' ! $text =~ s|\s+:|:|gm; ! $text =~ s|:\s+|:|gm; ! ! # shrink around '?' ! $text =~ s|\s+\?|?|gm; ! $text =~ s|\?\s+|?|gm; ! ! # shrink around '+' ! $text =~ s|\s+\+|+|gm; ! $text =~ s|\+\s+|+|gm; ! ! # shrink around '-' ! $text =~ s|\s+\-|-|gm; ! $text =~ s|\-\s+|-|gm; ! ! # shrink around '*' ! $text =~ s|\s+\*|*|gm; ! $text =~ s|\*\s+|*|gm; ! ! # shrink around '/' ! $text =~ s|\s+\/|/|gm; ! $text =~ s|\/\s+|/|gm; ! ! # shrink around '<' ! $text =~ s|\s+\<|<|gm; ! $text =~ s|\<\s+|<|gm; ! ! # shrink around '>' ! $text =~ s|\s+\>|>|gm; ! $text =~ s|\>\s+|>|gm; ! ! # shrink around ']' ! $text =~ s|\s+\]|]|gm; ! $text =~ s|\]\s+|]|gm; ! ! # shrink around '[' ! $text =~ s|\s+\[|[|gm; ! $text =~ s|\[\s+|[|gm; ! ! # shrink around '||' ! $text =~ s|\s+\|\|||||gm; ! $text =~ s|\|\|\s+||||gm; ! ! # shrink around '&&' ! $text =~ s|\s+\&\&|&&|gm; ! $text =~ s|\&\&\s+|&&|gm; - # strip extra white space - $text =~ s|\s{2,}| |gm; ! $text =~ s/\s*\n$//gm; # remove empty lines ! $text =~ s/^\s*//gm; # remove whitespace from beginning of line ! $text =~ s/\n/ /gm; # put all on one line # write modified $text to file --- 73,176 ---- @neededFiles = grep ++$t{$_} < 2, @neededFiles; + # put all the files into $text find(\&searchFiles, ($basedir)); ! grep { print "$_ --> $fileLocations{$_} \n" } keys %fileLocations; ! exit; ! appendFiles(); + if ( $compress ) { + # remove unnecessary stuff like comments and whitespace + print "Now compressing ".@neededFiles ." files \n"; + + $text =~ s/\/\*!?(?:.|[\r\n])*?\*\///gm; # multi-line comments, see http://ostermiller.org/findcomment.html + $text =~ s|//.*\n||g; # single-line comments see http://perlmonks.thepen.com/117150.html + + # cleanup '{', '}', '(', ')' ';' + $text =~ s|(\s+\{)|{|gm; + $text =~ s|(\s+\})|}|gm; + $text =~ s|(\s+\()|(|gm; + $text =~ s|(\s+\))|)|gm; + $text =~ s|(\{\s+)|{|gm; + $text =~ s|(\}\s+)|}|gm; + $text =~ s|(\(\s+)|(|gm; + $text =~ s|(\)\s+)|)|gm; + $text =~ s|(\;\s+)|;|gm; + $text =~ s|(\;\s+[^a-zA-Z])|;|gm; + + # shrink around '==' + $text =~ s|\s+==|==|gm; + $text =~ s|==\s+|==|gm; + + # shrink around '!=' + $text =~ s|"\s+\!=|!=|gm; + $text =~ s|\!=\s+|!=|gm; + + # shrink around '=' + $text =~ s|\s+=|=|gm; + $text =~ s|=\s+|=|gm; + + # shrink around ',' + $text =~ s|\s+,|,|gm; + $text =~ s|,\s+|,|gm; + + # shrink around ':' + $text =~ s|\s+:|:|gm; + $text =~ s|:\s+|:|gm; + + # shrink around '?' + $text =~ s|\s+\?|?|gm; + $text =~ s|\?\s+|?|gm; + + # shrink around '+' + $text =~ s|\s+\+|+|gm; + $text =~ s|\+\s+|+|gm; + + # shrink around '-' + $text =~ s|\s+\-|-|gm; + $text =~ s|\-\s+|-|gm; + + # shrink around '*' + $text =~ s|\s+\*|*|gm; + $text =~ s|\*\s+|*|gm; + + # shrink around '/' + $text =~ s|\s+\/|/|gm; + $text =~ s|\/\s+|/|gm; + + # shrink around '<' + $text =~ s|\s+\<|<|gm; + $text =~ s|\<\s+|<|gm; + + # shrink around '>' + $text =~ s|\s+\>|>|gm; + $text =~ s|\>\s+|>|gm; + + # shrink around ']' + $text =~ s|\s+\]|]|gm; + $text =~ s|\]\s+|]|gm; + + # shrink around '[' + $text =~ s|\s+\[|[|gm; + $text =~ s|\[\s+|[|gm; + + # shrink around '||' + $text =~ s|\s+\|\|||||gm; + $text =~ s|\|\|\s+||||gm; + + # shrink around '&&' + $text =~ s|\s+\&\&|&&|gm; + $text =~ s|\&\&\s+|&&|gm; + + # strip extra white space + $text =~ s|\s{2,}| |gm; + + $text =~ s/\s*\n$//gm; # remove empty lines + $text =~ s/^\s*//gm; # remove whitespace from beginning of line + $text =~ s/\n/ /gm; # put all on one line + } # write modified $text to file *************** *** 254,258 **** " -b <base_dir> base directory from which searching for dependencies should\n". " be started (defaults to current directory)\n". ! " -p <package> comma-separated list of package names that should be packed into the output file.\n\n"; } --- 261,266 ---- " -b <base_dir> base directory from which searching for dependencies should\n". " be started (defaults to current directory)\n". ! " -p <package> comma-separated list of package names that should be packed into the output file.\n\n". ! " -c if specified the output is 'compressed' (comments stripped, everything on one line etc.)\n\n"; } |