1#!/bin/bash 2 3# Argument format: 4# $1 = Path to aconfig binary 5# $2 = Path to the aconfig_embedded_flagging directory 6# [$3:$@] = Any number of aconfig flag value *.textproto files 7 8# Set the default ACONFIG variables if not provided by environment 9DEFAULT_ACONFIG_BIN=$ANDROID_BUILD_TOP/prebuilts/build-tools/linux-x86/bin/aconfig 10DEFAULT_ACONFIG_EMB_DIR=. 11OUT_DIR="out" 12 13# Get fully qualified path of any input variables before moving to build dir 14IN_ACONFIG_BIN=$(realpath "${1:-$DEFAULT_ACONFIG_BIN}") 15IN_ACONFIG_EMB_DIR=$(realpath "${2:-$DEFAULT_ACONFIG_EMB_DIR}") 16 17# Process remaining arguments for flag values 18shift 19shift 20IN_FLAG_VALUES="" 21for i in "$@"; do 22 IN_FLAG_VALUES+=" --values " 23 IN_FLAG_VALUES+=$(realpath "$i") 24done 25 26pushd $IN_ACONFIG_EMB_DIR > /dev/null 27mkdir -p $OUT_DIR 28 29# Create the aconfig cache based off of the flag declarations and values 30$IN_ACONFIG_BIN create-cache \ 31 --package android.embedded.chre.flags \ 32 --declarations chre_embedded_flags.aconfig \ 33 $IN_FLAG_VALUES \ 34 --values local-chre_embedded_flag_values.textproto \ 35 --cache $OUT_DIR/chre_embedded_cache 36 37# Create the flagging library (.h, .cc) based off of the cache 38$IN_ACONFIG_BIN create-cpp-lib \ 39 --cache $OUT_DIR/chre_embedded_cache \ 40 --out $OUT_DIR/chre_embedded_flag_lib 41 42# Create a text record for the flag values with this build 43$IN_ACONFIG_BIN dump \ 44 --cache $OUT_DIR/chre_embedded_cache \ 45 --format text \ 46 --out $OUT_DIR/chre_embedded_flag_dump 47 48popd > /dev/null