Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: sdk_build/build_and_upload_cpp_sdk.sh

Issue 1766093003: C++ SDK: Add a script the builds and uploads a tarball of the SDK to GCS. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sdk_build/build_sdk.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Script that "builds" and uploads a C++ SDK to GCS.
7
8 set -e
9
10 SCRIPT_DIR=$(dirname $0)
11 BUILD_SDK=${SCRIPT_DIR}/build_sdk.py
12
13 WORK_DIR=$(mktemp -d -t build_cpp_sdk.XXXXXXXX)
14 function cleanup_work_dir {
15 rm -rf "$WORK_DIR"
16 }
17 trap cleanup_work_dir EXIT
18
19 # Build the SDK.
20 SDK_DIRNAME=mojo_cpp_sdk
21 SDK_DIR=${WORK_DIR}/${SDK_DIRNAME}
22 "$BUILD_SDK" "${SCRIPT_DIR}/data/cpp/cpp.sdk" "$SDK_DIR"
23
24 # Get the version (hash).
25 VERSION=$(cat "${SDK_DIR}/MOJO_SDK_VERSION")
26 # Abbreviate it to 12 hex digits.
27 SHORT_VERSION=${VERSION:0:12}
28 echo "SDK version (hash): ${VERSION} (${SHORT_VERSION})"
29
30 # Make a tarball.
31 TARBALL_FILENAME=mojo_cpp_sdk-${SHORT_VERSION}.tar.gz
32 TARBALL_FILE=${WORK_DIR}/${TARBALL_FILENAME}
33 # In a subshell, change to WORK_DIR so that the tarball will only have the
34 # mojo_cpp_sdk part of the path.
35 (
36 cd "${WORK_DIR}"
37 tar c --owner=root --group=root -z -f "$TARBALL_FILENAME" "$SDK_DIRNAME"
38 )
39
40 # Assume that we're the "latest". Make a file containing the abbreviated hash.
41 LATEST_FILENAME=LATEST
42 LATEST_FILE=${WORK_DIR}/${LATEST_FILENAME}
43 echo "$SHORT_VERSION" > "$LATEST_FILE"
44
45 echo "Press enter to upload ${TARBALL_FILENAME} to GCS"
46 read
47
48 GCS_BASE_URL="gs://mojo/sdk/cpp"
49 # Don't clobber existing tarballs.
50 gsutil cp -n "$TARBALL_FILE" "${GCS_BASE_URL}/${TARBALL_FILENAME}"
51 # But allow "LATEST" to be clobbered.
52 gsutil cp "$LATEST_FILE" "${GCS_BASE_URL}/${LATEST_FILENAME}"
53
54 echo "Done!"
OLDNEW
« no previous file with comments | « no previous file | sdk_build/build_sdk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698