skia2/tools/skqp/upload_directory_contents.sh
Hal Canary 23fda7ad07 SkQP: Cloud Scripts
- tools/skqp/generate_gn_args.sh - single script to generate
    configuration used to build SkQP.
  - tools/skqp/make_model.sh - script to execute make_gmkb.go and put
    the results in the correct place.
  - tools/skqp/{up,down}load_directory_contents.sh - scripts to move
    large assets into the cloud and retrieve them.
  - tools/skqp/gm_runner.cpp - treat missing text files as empty.
  - tools/skqp/make_apk.sh - make use of generate_gn_args.sh.
  - tools/skqp/make_{model,known_tests}.sh - better error handling,
    and also stop calling `git add`.

Change-Id: Ib1803b4d68e63945f2c47f8eb6cb96375d24e3be
Reviewed-on: https://skia-review.googlesource.com/98842
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-01-23 19:07:11 +00:00

46 lines
1.1 KiB
Bash
Executable File

#! /bin/sh
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
EXTANT="$(mktemp "${TMPDIR:-/tmp}/extant.XXXXXXXXXX")"
gsutil ls gs://skia-skqp-assets/ | sed 's|^gs://skia-skqp-assets/||' > "$EXTANT"
upload() {
MD5=$(md5sum < "$1" | head -c 32)
if ! grep -q "$MD5" "$EXTANT"; then
URL="gs://skia-skqp-assets/$MD5"
gsutil cp "$1" "$URL" > /dev/null 2>&1
fi
echo $MD5
}
cd "$(dirname "$0")/../../platform_tools/android/apps/skqp/src/main/assets"
rm -f files.checksum
FILES="$(mktemp "${TMPDIR:-/tmp}/files.XXXXXXXXXX")"
: > "$FILES"
COUNT=$(find * -type f | wc -l)
INDEX=1
find * -type f | sort | while IFS= read -r FILENAME; do
printf '\r %d / %d ' "$INDEX" "$COUNT"
INDEX=$(( $INDEX + 1))
if ! [ -f "$FILENAME" ]; then
echo error [${FILENAME}] >&2;
exit 1;
fi
case "$FILENAME" in *\;*) echo bad filename: $FILENAME >&2; exit 1;; esac
MD5=$(upload "$FILENAME")
printf '%s;%s\n' "$MD5" "$FILENAME" >> "$FILES"
done
upload "$FILES" > files.checksum
rm "$FILES" "$EXTANT"