summaryrefslogtreecommitdiff
path: root/chromium/tools/resources
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/tools/resources
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/tools/resources')
-rwxr-xr-xchromium/tools/resources/optimize-png-files.sh60
1 files changed, 43 insertions, 17 deletions
diff --git a/chromium/tools/resources/optimize-png-files.sh b/chromium/tools/resources/optimize-png-files.sh
index 196c5e4fe2e..351e04545e1 100755
--- a/chromium/tools/resources/optimize-png-files.sh
+++ b/chromium/tools/resources/optimize-png-files.sh
@@ -276,6 +276,10 @@ function process_file {
# Usage: optimize_file <file>
function optimize_file {
local file=$1
+ if $using_cygwin ; then
+ file=$(cygpath -w $file)
+ fi
+
local name=$(basename $file)
local old=$(stat -c%s $file)
local tmp_file=$TMP_DIR/$name
@@ -304,12 +308,12 @@ function optimize_file {
function optimize_dir {
local dir=$1
+ if $using_cygwin ; then
+ dir=$(cygpath -w $dir)
+ fi
+
for f in $(find $dir -name "*.png"); do
- if $using_cygwin ; then
- optimize_file $(cygpath -w $f)
- else
- optimize_file $f
- fi
+ optimize_file $f
done
}
@@ -357,6 +361,9 @@ Options:
2 Aggressively optimize the size of png files. This may produce
addtional 1%~5% reduction. Warning: this is *VERY*
slow and can take hours to process all files.
+ -r<revision> If this is specified, the script processes only png files
+ changed since this revision. The <dir> options will be used
+ to narrow down the files under specific directories.
-h Print this help text."
exit 1
}
@@ -374,21 +381,30 @@ fi
OPTIMIZE_LEVEL=1
# Parse options
-while getopts o:h opts
+while getopts o:r:h opts
do
case $opts in
+ r)
+ COMMIT=$(git svn find-rev r$OPTARG | tail -1) || exit
+ if [ -z "$COMMIT" ] ; then
+ echo "Revision $OPTARG not found"
+ show_help
+ fi
+ ;;
o)
- if [[ ! "$OPTARG" =~ [012] ]]; then
+ if [[ ! "$OPTARG" =~ [012] ]] ; then
show_help
fi
OPTIMIZE_LEVEL=$OPTARG
- [ "$1" == "-o" ] && shift
- shift;;
+ ;;
[h?])
show_help;;
esac
done
+# Remove options from argument list.
+shift $(($OPTIND -1))
+
# Make sure we have all necessary commands installed.
install_if_not_installed pngcrush pngcrush
if [ $OPTIMIZE_LEVEL -ge 1 ]; then
@@ -422,14 +438,24 @@ DIRS=$@
set ${DIRS:=$ALL_DIRS}
echo "Optimize level=$OPTIMIZE_LEVEL"
-for d in $DIRS; do
- if $using_cygwin ; then
- d=$(cygpath -w $d)
- fi
- echo "Optimizing png files in $d"
- optimize_dir $d
- echo
-done
+if [ -n "$COMMIT" ] ; then
+ ALL_FILES=$(git diff --name-only $COMMIT HEAD $DIRS | grep "png$")
+ ALL_FILES_LIST=( $ALL_FILES )
+ echo "Processing ${#ALL_FILES_LIST[*]} files"
+ for f in $ALL_FILES; do
+ if [ -f $f ] ; then
+ optimize_file $f
+ else
+ echo "Skipping deleted file: $f";
+ fi
+ done
+else
+ for d in $DIRS; do
+ echo "Optimizing png files in $d"
+ optimize_dir $d
+ echo
+ done
+fi
# Print the results.
if [ $PROCESSED_FILE == 0 ]; then