Previously, these files were installed with a custom $(shell) command in an Android.mk file. This doesn't let the build system know that these files exist, and breaks hermetic partition builds. Instead, install them with PRODUCT_COPY_FILES, and add a check that the list is up-to-date. Bug: 205632228 Test: Presubmits Change-Id: I54c1d5600432b3ecc8a9a924f6cde311dc3b41fd
56 lines
2.8 KiB
Bash
Executable file
56 lines
2.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# This script is used to generate uwb conuntry configuration file,
|
|
# and the PRODUCT_COPY_FILES list in uwb_calibration_country.mk based on uwb_country.conf
|
|
# Bug: 196073172, 233619860
|
|
|
|
count=1
|
|
|
|
LOCAL_PATH=device/google/pantah/uwb
|
|
|
|
echo "# Copyright (C) 2023 The Android Open-Source Project"
|
|
echo "#"
|
|
echo "# Licensed under the Apache License, Version 2.0 (the \"License\");"
|
|
echo "# you may not use this file except in compliance with the License."
|
|
echo "# You may obtain a copy of the License at"
|
|
echo "#"
|
|
echo "# http://www.apache.org/licenses/LICENSE-2.0"
|
|
echo "#"
|
|
echo "# Unless required by applicable law or agreed to in writing, software"
|
|
echo "# distributed under the License is distributed on an \"AS IS\" BASIS,"
|
|
echo "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied."
|
|
echo "# See the License for the specific language governing permissions and"
|
|
echo "# limitations under the License."
|
|
echo ""
|
|
echo "# This file was autogenerated by country_conf_gen.sh"
|
|
echo ""
|
|
echo "ifneq (\$(LOCAL_PATH),$LOCAL_PATH)"
|
|
echo " \$(error LOCAL_PATH in country_conf_gen.sh needs to be updated, and uwb_calibration_country.mk regenerated)"
|
|
echo "endif"
|
|
echo "diffs := \$(shell diff \$(LOCAL_PATH)/uwb_calibration_country.mk <($LOCAL_PATH/country_conf_gen.sh))"
|
|
echo "ifneq (\$(diffs),)"
|
|
echo " \$(error $LOCAL_PATH/uwb_calibration_country.mk is not up to date, please run $LOCAL_PATH/country_conf_gen.sh > $LOCAL_PATH/uwb_calibration_country.mk)"
|
|
echo "endif"
|
|
echo ""
|
|
echo "PRODUCT_COPY_FILES += \\"
|
|
while read line ; do
|
|
if [[ "$line" =~ ^"*" ]]; then
|
|
header=${line:1}
|
|
elif [[ "$line" =~ ^"\"" ]]; then
|
|
#line=$(echo ${line/,} | tr -d "\"")
|
|
country[count]=$(echo $line | cut -d ':' -f1 | tr -d "\"")
|
|
code[count]=$(echo $line | cut -d ':' -f2 | tr -d "\"" | tr -d " ")
|
|
if [ "$header" = "FCC" ]; then
|
|
echo " \$(LOCAL_PATH)/UWB-calibration-fcc.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\"
|
|
elif [ "$header" = "CE" ]; then
|
|
echo " \$(LOCAL_PATH)/UWB-calibration-ce.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\"
|
|
elif [ "$header" = "JP" ]; then
|
|
echo " \$(LOCAL_PATH)/UWB-calibration-jp.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\"
|
|
elif [ "$header" = "TW" ]; then
|
|
echo " \$(LOCAL_PATH)/UWB-calibration-tw.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\"
|
|
elif [ "$header" = "Restricted" ]; then
|
|
echo " \$(LOCAL_PATH)/UWB-calibration-restricted.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\"
|
|
fi
|
|
fi
|
|
((count++))
|
|
done < $LOCAL_PATH/uwb_country.conf
|