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
16# See go/perfetto-ui-autopush for docs on how this works end-to-end.
17
18set -exu
19
20CUR_DUR=$(dirname ${BASH_SOURCE[0]})
21
22env
23pwd
24mount
25
26# This script will be run in /workspace after the Cloud Build environment has
27# pulled the GitHub repo in shallow mode. We want to build off the official
28# AOSP repo, not the GitHub mirror though, hence why the clone below.
29# GitHub is used only as a trigger. This is because Google Cloud Build doesn't
30# support yet triggering from Gerrit.
31
32cd /workspace/
33ls -A1 | xargs rm -rf
34UPSTREAM="https://android.googlesource.com/platform/external/perfetto.git"
35git clone $UPSTREAM upstream
36
37cd upstream/
38git rev-parse HEAD
39mkdir /workspace/tmp
40python3 -u "$CUR_DUR/build_all_channels.py" --upload --tmp=/workspace/tmp
41