• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -ex
4
5function usage() { echo "$0 [-s][-b]" && exit 1; }
6
7sync=""
8branch=""
9while getopts 'sb' FLAG; do
10  case ${FLAG} in
11    s)
12      sync="sync"
13      ;;
14    b)
15      branch="branch"
16      ;;
17    ?)
18      echo "unknown flag."
19      usage
20      ;;
21  esac
22done
23
24shift $((OPTIND-1))
25if [ $# != 0 ]; then
26    echo "unknown positional argument."
27    usage
28fi
29
30if [ "$sync" = "sync" ]
31then
32  read -p "This script will sync your crosvm project. Do you wish to proceed? [y/N]" -n 1 -r
33  if [[ ! $REPLY =~ ^[Yy]$ ]]
34  then
35    exit 1;
36  fi
37fi
38
39if [ -z $ANDROID_BUILD_TOP ]; then echo "forgot to source build/envsetup.sh?" && exit 1; fi
40cd $ANDROID_BUILD_TOP/external/crosvm
41
42if [[ ! -z $(git branch --list merge) && ! "$branch" = "branch" ]];
43  then
44    echo "branch merge already exists. Forgot to clean up?" && exit 1;
45fi
46rustup update
47if [ "$sync" = "sync" ]
48then
49  repo sync -c -j96
50  git fetch --all --prune
51fi
52
53source $ANDROID_BUILD_TOP/build/envsetup.sh
54m blueprint_tools cargo_embargo crosvm
55
56if [ ! "$branch" = "branch" ];
57  then
58    repo start merge;
59fi
60
61git merge --log aosp/upstream-main
62$ANDROID_BUILD_TOP/external/crosvm/tools/install-deps
63