aboutsummaryrefslogtreecommitdiff
path: root/android-merge-1-setup.sh
blob: a1c4f74751f3d83774e0a612ce152050c8a6b22c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

set -ex

function usage() { echo "$0 [-s][-b]" && exit 1; }

sync=""
branch=""
while getopts 'sb' FLAG; do
  case ${FLAG} in
    s)
      sync="sync"
      ;;
    b)
      branch="branch"
      ;;
    ?)
      echo "unknown flag."
      usage
      ;;
  esac
done

shift $((OPTIND-1))
if [ $# != 0 ]; then
    echo "unknown positional argument."
    usage
fi

if [ "$sync" = "sync" ]
then
  read -p "This script will sync your crosvm project. Do you wish to proceed? [y/N]" -n 1 -r
  if [[ ! $REPLY =~ ^[Yy]$ ]]
  then
    exit 1;
  fi
fi

if [ -z $ANDROID_BUILD_TOP ]; then echo "forgot to source build/envsetup.sh?" && exit 1; fi
cd $ANDROID_BUILD_TOP/external/crosvm

if [[ ! -z $(git branch --list merge) && ! "$branch" = "branch" ]];
  then
    echo "branch merge already exists. Forgot to clean up?" && exit 1;
fi
rustup update
if [ "$sync" = "sync" ]
then
  repo sync -c -j96
  git fetch aosp upstream-main
fi

source $ANDROID_BUILD_TOP/build/envsetup.sh
m blueprint_tools cargo_embargo crosvm

if [ ! "$branch" = "branch" ];
  then
    repo start merge;
fi

git merge --log aosp/upstream-main
$ANDROID_BUILD_TOP/external/crosvm/tools/install-deps