aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skqp/make_apk_list
blob: 1cc25e475ee845eb31a550ae1fe90dbedb1f96c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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

COUNT=40
BUCKET='skia-skqp'

cd "$(dirname "$0")/../.."

EXTANT="$(mktemp "${TMPDIR:-/tmp}/extant.XXXXXXXXXX")"
gsutil ls "gs://$BUCKET" > $EXTANT

cat << EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SkQP Pre-built APKs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family:sans-serif;
max-width:55em;
margin:8px auto;
padding:0 8px;
}
td { padding:12px 6px; }
</style>
</head>
<body>
<h1>SkQP Pre-built APKs</h1>
EOF

table() {
    printf '<h2>%s</h2>\n' "$*"
    printf '<table>\n<tr><th>APK</th><th>Date</th><th>Commit</th></tr>\n'
    for commit in $(git log "$@" -${COUNT} --format=%H) ; do
        short="$(git log -1 --format=%h $commit)"
        name="${BUCKET}/skqp-universal-${short}.apk"
        if ! grep -q "gs://$name" "$EXTANT"; then
            url=''
        else
            url="https://storage.googleapis.com/$name"
        fi
        date=$(TZ='' git log --date='format-local:%Y-%m-%d %H:%M:%S %Z' -1 $commit --format=%cd)
        subj=$(git log -1 $commit --format='%<(50,trunc)%s' | sed 's/  *$//')
        commit_url="https://skia.googlesource.com/skia/+/${commit}"
        if [ "$url" ]; then
            printf '<tr>\n<td><a href="%s">skqp-universal-%s.apk</a></td>\n' "$url" "$short"
        else
            printf '<tr>\n<td>%s</td>\n' "$short"
        fi
        printf '<td>%s</td>\n<td><a href="%s">%s</a></td>\n</tr>\n' "$date" "$commit_url" "$subj"
    done
    printf '</table>\n'
}

table  "origin/skqp/release" "^origin/skqp/dev"
table "origin/skqp/dev"

printf '</body>\n</html>\n'