1#!/bin/bash
2set -o errexit
3
4# Copyright 2018 The Android Open Source Project
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#      http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18if [ -z "${ANDROID_BUILD_TOP}" ] ; then
19  echo "You need to source and lunch before you can use this script" 1>&2
20  exit 1
21fi
22
23if ! [ -x "$(which aprotoc)" ] ; then
24  echo "Missing aprotoc, build it with 'm aprotoc'." 1>&2
25  exit 1
26fi
27
28ECC_ROOT=`realpath \`dirname $0\``
29TOOLSET_DIR="${ECC_ROOT}/conversion_toolset_v1"
30INPUT_DIR="${ECC_ROOT}/input"
31OUTPUT_DIR="${ECC_ROOT}/output"
32INTERMEDIATE_DIR="${ECC_ROOT}/.intermediate"
33
34rm -rf "${INTERMEDIATE_DIR}" "${OUTPUT_DIR}/*"
35mkdir -p "${INTERMEDIATE_DIR}"
36
37source "${TOOLSET_DIR}/gen_eccdata.sh"
38echo
39
40echo "To verify data compatibility:"
41echo "  1. make TeleService"
42echo "  2. push TeleService.apk to system/priv-app/TeleService"
43echo "  3. reboot device"
44echo "  4. run 'atest TeleServiceTests:EccDataTest#testEccDataContent'"
45