-
Notifications
You must be signed in to change notification settings - Fork 248
/
vendorsetup.sh
executable file
·94 lines (87 loc) · 3.08 KB
/
vendorsetup.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# autopatch.sh: script to manage patches on top of repo
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# Author: sgnanase <[email protected]>
# Author: Sun, Yi J <[email protected]>
#
# SPDX-License-Identifier: BSD-3-Clause
# save the official lunch command to aosp_lunch() and source it
tmp_lunch=`mktemp`
sed '/ lunch()/,/^}/!d' build/envsetup.sh | sed 's/function lunch/function aosp_lunch/' > ${tmp_lunch}
source ${tmp_lunch}
rm -f ${tmp_lunch}
# Override lunch function to filter lunch targets
function lunch
{
local T=$(gettop)
if [ ! "$T" ]; then
echo "[lunch] Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
local answer=' '
# Set the TARGET_RELEASE variable to the release_config for
# which we want to build CELADON. It should be one among
# $(TOP)/build/release/release_configs/*
# When updating TARGET_RELEASE value here please change in
# "function _get_build_var_cached" below too.
TARGET_RELEASE=ap3a
if [ "$1" ]; then
local valid_targets=`mixinup -t`
local count=`echo "$1" | grep -o "-" | wc -l`
if [ "${count}" -eq 1 ]; then
local array=(${1/-/ })
local target=${array[0]}
if [[ "${valid_targets}" =~ "${target}" ]]; then
answer=${target}-$TARGET_RELEASE-${array[1]}
else
answer=$1
fi
else
answer=$1
fi
fi
aosp_lunch $answer
rm -rf vendor/intel/utils/Android.mk vendor/intel/utils_priv/Android.mk
vendor/intel/utils/autopatch.sh
# check if product configuration files are out of date
if [[ $(find device/intel -path "*mixins*" -prune -o -name ${TARGET_PRODUCT}.mk -print) ]]; then
product_dir=$(dirname $(find device/intel -path "*mixins*" -prune -o -name ${TARGET_PRODUCT}.mk -print))
echo "Executing mixin update..."
mixinup -s $product_dir/mixins.spec
fi
}
# Get the exact value of a build variable.
function _get_build_var_cached()
{
# Set the TARGET_RELEASE variable to the release_config for
# which we want to build CELADON. It should be one among
# $(TOP)/build/release/release_configs/*
TARGET_RELEASE=ap3a
if [ "$1" = "COMMON_LUNCH_CHOICES" ]
then
valid_targets=`mixinup -t`
save=`build/soong/soong_ui.bash --dumpvar-mode $1`
unset LUNCH_MENU_CHOICES
for t in ${save[@]}; do
array=(${t/-/ })
target=${array[0]}
if [[ "${valid_targets}" =~ "$target" ]]; then
tgt=$target-$TARGET_RELEASE-${array[1]}
LUNCH_MENU_CHOICES+=($tgt)
fi
done
echo ${LUNCH_MENU_CHOICES[@]}
return
else
if [ "$BUILD_VAR_CACHE_READY" = "true" ]
then
eval "echo \"\${var_cache_$1}\""
return
fi
local T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
(\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
fi
}