blob: 902a37c2a24b0a3cdf7249a49f2f8eb98ac6791d [file] [log] [blame]
Justin Yun0daf1862022-04-27 16:21:16 +09001#!/bin/bash
2
3function buffet()
4{
5 local product variant selection
6 if [[ $# -ne 1 ]]; then
7 echo "usage: buffet [target]" >&2
8 return 1
9 fi
10
11 selection=$1
12 product=${selection%%-*} # Trim everything after first dash
13 variant=${selection#*-} # Trim everything up to first dash
14
15 if [ -z "$product" ]
16 then
17 echo
18 echo "Invalid lunch combo: $selection"
19 return 1
20 fi
21
22 if [ -z "$variant" ]
23 then
24 if [[ "$product" =~ .*_(eng|user|userdebug) ]]
25 then
26 echo "Did you mean -${product/*_/}? (dash instead of underscore)"
27 fi
28 return 1
29 fi
30
31 BUFFET_BUILD_TOP=$(pwd) python3 tools/build/orchestrator/buffet_helper.py $1 || return 1
32
33 export BUFFET_BUILD_TOP=$(pwd)
34 export BUFFET_COMPONENTS_TOP=$BUFFET_BUILD_TOP/components
35 export BUFFET_TARGET_PRODUCT=$product
36 export BUFFET_TARGET_BUILD_VARIANT=$variant
37 export BUFFET_TARGET_BUILD_TYPE=release
38}
39
40function m()
41{
42 if [ -z "$BUFFET_BUILD_TOP" ]
43 then
44 echo "Run \"buffet [target]\" first"
45 return 1
46 fi
47 python3 $BUFFET_BUILD_TOP/tools/build/orchestrator/build_helper.py "$@"
48}