v2.3.0: project user config
This commit is contained in:
parent
49ccc76933
commit
05f3b9a0a0
@ -1 +1 @@
|
|||||||
2.2.4
|
2.3.0
|
||||||
@ -1,3 +1,7 @@
|
|||||||
|
## 2.3.0
|
||||||
|
+ added ***project user config***! Read more in `./project.config.user.default`
|
||||||
|
+ renamed default config to `project.config.default`
|
||||||
|
|
||||||
## 2.2.4
|
## 2.2.4
|
||||||
+ **default config**: C standard changed to C99
|
+ **default config**: C standard changed to C99
|
||||||
+ **default config**: enabled more warnings
|
+ **default config**: enabled more warnings
|
||||||
|
|||||||
26
cbuild.sh
26
cbuild.sh
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
INSTALLED_CBUILD_VERSION=2.2.4
|
INSTALLED_CBUILD_VERSION=2.3.0
|
||||||
|
|
||||||
# set \t size to 4 spaces
|
# set \t size to 4 spaces
|
||||||
tabs 4
|
tabs 4
|
||||||
@ -92,19 +92,23 @@ do
|
|||||||
|
|
||||||
# create project config
|
# create project config
|
||||||
project_config_path="$new_project_dir/project.config"
|
project_config_path="$new_project_dir/project.config"
|
||||||
cp "$CBUILD_INSTALL_DIR/default.config" "$project_config_path.temp"
|
cp "$CBUILD_INSTALL_DIR/project.config.default" "$project_config_path.temp"
|
||||||
myprint "Enter project name: "
|
myprint "${WHITE}Enter project name: "
|
||||||
read -r project_name
|
read -r project_name
|
||||||
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
||||||
"$project_config_path.temp" > "$project_config_path"
|
"$project_config_path.temp" > "$project_config_path"
|
||||||
rm "$project_config_path.temp"
|
rm "$project_config_path.temp"
|
||||||
myprint "${GREEN}created config at '$project_config_path'"
|
myprint "${GREEN}Created '$project_config_path'"
|
||||||
|
# create project user default config
|
||||||
|
project_user_config_path="$new_project_dir/project.config.user.default"
|
||||||
|
cp "$CBUILD_INSTALL_DIR/project.config.user.default" "$project_user_config_path"
|
||||||
|
myprint "${GREEN}Created '$project_user_config_path'"
|
||||||
|
|
||||||
if ask_yn "Copy default .gitignore?"; then
|
if ask_yn "${WHITE}Copy default .gitignore?"; then
|
||||||
cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
|
cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ask_yn "Copy default .vscode launch tasks?"; then
|
if ask_yn "${WHITE}Copy default .vscode launch tasks?"; then
|
||||||
new_project_vscode_dir="$new_project_dir/.vscode"
|
new_project_vscode_dir="$new_project_dir/.vscode"
|
||||||
mkdir -pv "$new_project_vscode_dir"
|
mkdir -pv "$new_project_vscode_dir"
|
||||||
for vscode_dir_f in $(find "$CBUILD_INSTALL_DIR/default_vscode/" -type f); do
|
for vscode_dir_f in $(find "$CBUILD_INSTALL_DIR/default_vscode/" -type f); do
|
||||||
@ -133,15 +137,17 @@ function call_task {
|
|||||||
load_config "$project_config_path" "$task" true
|
load_config "$project_config_path" "$task" true
|
||||||
|
|
||||||
if [ ! -z "$PRE_TASK_SCRIPT" ]; then
|
if [ ! -z "$PRE_TASK_SCRIPT" ]; then
|
||||||
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$PRE_TASK_SCRIPT'"
|
||||||
include "$PRE_TASK_SCRIPT"
|
include "$PRE_TASK_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
|
if [ ! -z "$TASK_SCRIPT" ]; then
|
||||||
include "$TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$TASK_SCRIPT'"
|
||||||
|
include "$TASK_SCRIPT"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z "$POST_TASK_SCRIPT" ]; then
|
if [ ! -z "$POST_TASK_SCRIPT" ]; then
|
||||||
myprint "${BLUE}executing ${WHITE}$POST_TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$POST_TASK_SCRIPT'"
|
||||||
include "$POST_TASK_SCRIPT"
|
include "$POST_TASK_SCRIPT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
13
config.sh
13
config.sh
@ -9,7 +9,7 @@ function load_config {
|
|||||||
TASK="$2"
|
TASK="$2"
|
||||||
local quiet=$3
|
local quiet=$3
|
||||||
|
|
||||||
myprint "${BLUE}loading config ${WHITE}'$(realpath $project_config_path)'"
|
myprint "${BLUE}loading ${WHITE}'$project_config_path'"
|
||||||
|
|
||||||
if [ -z "$project_config_path" ]; then
|
if [ -z "$project_config_path" ]; then
|
||||||
error "config path is null"
|
error "config path is null"
|
||||||
@ -50,6 +50,15 @@ function load_config {
|
|||||||
# throw error on undefined variable usage
|
# throw error on undefined variable usage
|
||||||
set -u
|
set -u
|
||||||
include "$project_config_path"
|
include "$project_config_path"
|
||||||
|
|
||||||
|
# load project user config
|
||||||
|
local project_user_config_path="$project_config_path.user"
|
||||||
|
if [ ! -f "$project_user_config_path" ]; then
|
||||||
|
myprint "${YELLOW}creating default project user config ${WHITE}$project_user_config_path"
|
||||||
|
cp "$project_user_config_path.default" "$project_user_config_path"
|
||||||
|
fi
|
||||||
|
myprint "${BLUE}loading ${WHITE}'$project_user_config_path'"
|
||||||
|
include "$project_user_config_path"
|
||||||
|
|
||||||
mkdir -p "$OUTDIR"
|
mkdir -p "$OUTDIR"
|
||||||
mkdir -p "$OBJDIR/objects"
|
mkdir -p "$OBJDIR/objects"
|
||||||
@ -60,5 +69,5 @@ function load_config {
|
|||||||
# dont thorw error on undefined variable
|
# dont thorw error on undefined variable
|
||||||
set +u
|
set +u
|
||||||
|
|
||||||
myprint_quiet $quiet "${GREEN}loaded cbuild config"
|
myprint_quiet $quiet "${GREEN}config loading completed"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
CBUILD_VERSION=2.2.4
|
CBUILD_VERSION=2.3.0
|
||||||
|
|
||||||
PROJECT="%PROJECT_NAME%"
|
PROJECT="%PROJECT_NAME%"
|
||||||
CMP_C="gcc"
|
CMP_C="gcc"
|
||||||
@ -22,7 +22,7 @@ SRC_CPP="$(find src -name '*.cpp')"
|
|||||||
|
|
||||||
# Directory with dependency configs.
|
# Directory with dependency configs.
|
||||||
# See cbuild/example_dependency_configs
|
# See cbuild/example_dependency_configs
|
||||||
DEPENDENCY_CONFIGS_DIR='.'
|
DEPENDENCY_CONFIGS_DIR='dependencies'
|
||||||
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
||||||
ENABLED_DEPENDENCIES=''
|
ENABLED_DEPENDENCIES=''
|
||||||
|
|
||||||
11
project.config.user.default
Normal file
11
project.config.user.default
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Project user config is ignored by git.
|
||||||
|
# Here you can add variables that users might want to change
|
||||||
|
# on their local machine, without commiting to the repository.
|
||||||
|
|
||||||
|
# Directory where you install dependencies.
|
||||||
|
# Do not confuse with DEPENDENCY_CONFIGS_DIR
|
||||||
|
# Example:
|
||||||
|
# libexample source code is at `../libexample`, and dependency config
|
||||||
|
# that specifies how to build this lib is at `dependencies/libexample.config`
|
||||||
|
DEPENDENCIES_DIR=".."
|
||||||
Loading…
Reference in New Issue
Block a user