1#!/bin/bash
2# Copyright (C) 2021 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -exu
17
18# This script will be run in /workspace after the Cloud Build environment has
19# pulled the GitHub repo in shallow mode. We want to build off the official
20# AOSP repo, not the GitHub mirror though, hence why the clone below.
21# GitHub is used only as a trigger. This is because Google Cloud Build doesn't
22# support yet triggering from Gerrit.
23# See go/perfetto-ui-autopush for more details.
24
25# The cd is really a safeguard against people running this script on their
26# workstation and hitting the rm -rf.
27cd /workspace/
28ls -A1 | xargs rm -rf
29UPSTREAM="https://android.googlesource.com/platform/external/perfetto.git"
30git clone --depth 1 $UPSTREAM upstream
31
32cd upstream/
33git rev-parse HEAD
34
35# Install only NodeJS, no need to install the other toolchains.
36tools/install-build-deps --ui --filter=nodejs
37
38# The deploy script takes care of building by invoking ./build internally.
39infra/perfetto.dev/deploy
40