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