Introduce 'nnas' command script to support unified command.
Call nnas fomart command in nnfw format-check command and remove workaround in 'nnfw'.
'nnas' is almost same with 'nncc' or 'nnfw'.
Remove deprecated NNAS_SCRIPT_PATH.
Relocate import() function.
Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
check_permission() {
# Check all files except script
FILES_TO_CHECK=()
- for NON_SCRIPT_FILE in $(git ls-files -- . ':!:nnfw' ':!:nncc' ':!:*.sh' ':!:*.py' ':!:compiler/' ':!:infra/nncc/' ':!:scripts/standalone'); do
+ for NON_SCRIPT_FILE in $(git ls-files -- . ':!:nnas' ':!:nnfw' ':!:nncc' ':!:*.sh' ':!:*.py' ':!:compiler/' ':!:infra/nncc/' ':!:scripts/standalone'); do
FILES_TO_CHECK+=("${NON_SCRIPT_FILE}")
done
--- /dev/null
+#!/bin/bash
+
+# Workaround: Remove this file when CI infra's format checker is updated
+pushd ${NNFW_PROJECT_PATH} > /dev/null
+
+./nnas format
+
+popd > /dev/null
--- /dev/null
+#!/bin/bash
+
+NNAS_CONFIG_RPATH="infra/config"
+NNAS_COMMAND_RPATH="infra/command"
+NNAS_PROJECT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+function Usage()
+{
+ echo "Usage: $0 [COMMAND] ..."
+ echo "Command:"
+ for file in "$NNAS_COMMAND_RPATH"/*;
+ do
+ echo " $(basename "$file")"
+ done
+}
+
+function import()
+{
+ source "${NNAS_PROJECT_PATH}/${NNAS_CONFIG_RPATH}/$1"
+}
+
+COMMAND=$1; shift
+
+if [[ -z "${COMMAND}" ]]; then
+ Usage
+ exit 255
+fi
+
+COMMAND_FILE="${NNAS_PROJECT_PATH}/${NNAS_COMMAND_RPATH}/${COMMAND}"
+
+if [[ ! -f "${COMMAND_FILE}" ]]; then
+ echo "ERROR: '${COMMAND}' is not supported"
+ exit 255
+fi
+
+export NNAS_PROJECT_PATH
+
+source "${COMMAND_FILE}" "$@"
fi
COMMAND_FILE="${NNFW_PROJECT_PATH}/${NNFW_COMMAND_RPATH}/${COMMAND}"
-# Workraound: replace format check command
-# Remove this after make call in infra/nnfw/command/format-check to infra/command/format
-if [ "${COMMAND}" = "format-check" ]; then
- COMMAND_FILE="${NNFW_PROJECT_PATH}/infra/command/format" "$@"
-fi
if [[ ! -f "${COMMAND_FILE}" ]]; then
echo "ERROR: '${COMMAND}' is not supported"