#!/bin/bash

source "${BASH_SOURCE%/*}/utils.sh"

# Global definitions
ROOT_LOCAL_DIR="${BASH_SOURCE%/*}/../../.."
ROOT_DIR="$(absolute $ROOT_LOCAL_DIR)"
BUILD_DIR="$ROOT_DIR/build"
CMAKE_DIR="$ROOT_DIR/cmake"
CI_DIR="$ROOT_DIR/ci"
SCRIPTS_DIR="$CI_DIR/scripts"
PYTHON_DIR="$SCRIPTS_DIR/python"
PYTHON_VENV_DIR="$PYTHON_DIR/.venv"
GENERATED_DIR="$CI_DIR/generated"
PATCHES_DIR="$CI_DIR/patches"
LIBRARIES_DIR="$CI_DIR/libraries"
LIBRARIES_TESTS_DIR="$CI_DIR/libraries_tests"
TEMPLATES_DIR="$CI_DIR/templates"
EXAMPLES_DIR="$CI_DIR/examples"
CUSTOM_EXAMPLES_DIR="$CI_DIR/examples_custom"
TOOLCHAINS_DIR="$CI_DIR/toolchains"
TOOLS_DIR="$CI_DIR/tools"
NRFJPROG_DIR="$TOOLS_DIR/nrf/nrfjprog/"
MERGEHEX_DIR="$TOOLS_DIR/nrf/mergehex/"
SDKS_DIR="$CI_DIR/sdks"

# Regexp
SD_REGEXP="^(s[1-9][0-9][0-9]|blank|mbr)$"
VARIANT_REGEXP="(pca[0-9]{5})_(s[0-9]{3})"
CMAKE_BUILD_TYPE_REGEXP="^(Debug|Release|RelWithDebInfo|MinSizeRel)$"
CMAKE_LOG_LEVEL_REGEXP="^(TRACE|DEBUG|VERBOSE|STATUS|NOTICE|WARNING|ERROR)$"


# Format
BUILD_SUMMARY_ENTRY_FORMAT="%-48s%-16s%-16s%-16s%-16s%-16s\n"

# Generated files
PYTHON_VENV_SCRIPT="$PYTHON_VENV_DIR/bin/activate"
GENERATED_EXAMPLES="$GENERATED_DIR/examples.json"
GENERATED_LIBRARIES="$GENERATED_DIR/libraries.json"
GENERATED_CMAKE_LIBRARIES="$GENERATED_DIR/cmake_libraries.json"

# Template files
LIBRARIES_CMAKE_TEMPLATE_FILE="$TEMPLATES_DIR/cmake_libraries.j2"
LIBRARIES_CMAKE_GROUPS_TEMPLATE_FILE="$TEMPLATES_DIR/cmake_groups.j2"
LIBRARIES_CMAKE_TESTS_TEMPLATE_FILE="$TEMPLATES_DIR/cmake_libraries_tests.j2"
EXAMPLE_CMAKE_TEMPLATE_FILE="$TEMPLATES_DIR/cmake_example.j2"