blob: 57d6ac9f37f7d40a8924da0c8445a4dab1e40833 [file] [log] [blame]
benjaminwagner787ca872015-08-17 12:58:10 -07001#!/bin/bash
2# Copyright 2014 Google Inc.
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Syncs //depot/google3/third_party/skia/HEAD to the last known good revision of
8# Skia. If this script is not run from a Piper client, creates a new CitC
9# client. Also updates README.google.
10#
11# Usage:
12# ./tools/sync_google3.sh
13
14source gbash.sh || exit
15
16set -x -e
17
18MY_DIR="$(gbash::get_absolute_caller_dir)"
19LKGR="$(${MY_DIR}/get_skia_lkgr.sh)"
20
21gbash::get_google3_dir && GOOGLE3="$(gbash::get_google3_dir)"
22if [ -z "${GOOGLE3}" ]; then
23 CLIENT_NAME="sync_skia_$(date '+%F-%H-%M-%S')"
24 ${MY_DIR}/create_skia_google3_client.sh "${CLIENT_NAME}"
25 GOOGLE3="/google/src/cloud/${USER}/${CLIENT_NAME}/google3"
26fi
27cd "${GOOGLE3}/third_party/skia/HEAD"
benjaminwagnerf82c13f2015-08-18 06:25:14 -070028${MY_DIR}/git_clone_to_google3.sh --skia_rev "${LKGR}"
benjaminwagner787ca872015-08-17 12:58:10 -070029
30# Update README.google.
31sed --in-place "s/^Version: .*/Version: ${LKGR}/" README.google
32sed --in-place "s/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/.*\.tar\.gz/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/${LKGR}.tar.gz/" README.google
33CURRENT_DATE=`date '+%d %B %Y'`
34echo "Updated using sync_google3.sh on $CURRENT_DATE by $USER@google.com" >> README.google
35
36# Add README.google to the default change.
37g4 reopen
38# Create a new CL.
39CHANGE="$(g4 change --desc "Update skia HEAD to ${LKGR}.")"
40CL="$(echo "${CHANGE}" | sed "s/Change \([0-9]\+\) created.*/\1/")"
41
42# Run TAP.
43tap_presubmit -c "${CL}" -p skia