Compare commits

..

No commits in common. "f0ee39084ed20224025d001531d89dea86fdd205" and "fca94ffe4c508b4433295260dd43ff681ad52726" have entirely different histories.

8 changed files with 19 additions and 27 deletions

View File

@ -1 +1 @@
2.3.1
2.3.0

View File

@ -1,6 +1,3 @@
## 2.3.1
+ user config loads before project config
## 2.3.0
+ **CONFIG:** Added new file `./project.config.user.default`.
+ **CONFIG:** Changed `cbuild/default_tasks` to `@cbuild/default_tasks`.

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
INSTALLED_CBUILD_VERSION=2.3.1
INSTALLED_CBUILD_VERSION=2.3.0
# set \t size to 4 spaces
tabs 4
@ -45,7 +45,7 @@ include "@cbuild/include/functions.sh"
include "@cbuild/include/config.sh"
function print_help {
myprint "${GRAY}cbuild v$INSTALLED_CBUILD_VERSION"
myprint "cbuild v$INSTALLED_CBUILD_VERSION"
myprint "C/C++ project build system written in bash."
myprint "Usage: cbuild [OPTIONS] [TASKS]"
myprint "Options:"
@ -74,7 +74,7 @@ do
exit 0
;;
'-v' | '--version')
myprint "${GRAY}cbuild v$INSTALLED_CBUILD_VERSION"
myprint "cbuild v$INSTALLED_CBUILD_VERSION"
exit 0
;;
'-c' | '--config')

View File

@ -10,6 +10,8 @@ function load_config {
#true or false
local quiet=$3
myprint "${BLUE}loading ${WHITE}'$proj_conf_file'"
if [ -z "$proj_conf_file" ]; then
error "config path is null"
fi
@ -17,18 +19,6 @@ function load_config {
error "${YELLOW}$proj_conf_file doesn't exist"
fi
# load project user config
local proj_conf_user_file="$proj_conf_file.user"
file_copy_default_if_not_present "$proj_conf_user_file" "$proj_conf_user_file.default"
myprint "${BLUE}loading ${WHITE}'$proj_conf_user_file'"
# throw error on undefined variable usage
set -u
include "$proj_conf_user_file"
# don't throw error on undefined variable usage
set +u
myprint "${BLUE}loading ${WHITE}'$proj_conf_file'"
OS=$(detect_os)
ARCH=$(detect_arch)
myprint_quiet $quiet "${GREEN}detected OS: $OS"
@ -58,8 +48,15 @@ function load_config {
myprint "${YELLOW}Install it to get latest bugfixes."
fi
# throw error on undefined variable usage
set -u
include "$proj_conf_file"
# load project user config
local proj_conf_user_file="$proj_conf_file.user"
file_copy_default_if_not_present "$proj_conf_user_file" "$proj_conf_user_file.default"
myprint "${BLUE}loading ${WHITE}'$proj_conf_user_file'"
include "$proj_conf_user_file"
mkdir -p "$OUTDIR"
mkdir -p "$OBJDIR/objects"
@ -67,6 +64,7 @@ function load_config {
mkdir -p "$OBJDIR/dynamic_libs"
mkdir -p "$OBJDIR/profile"
# dont thorw error on undefined variable
set +u
myprint_quiet $quiet "${GREEN}config loading completed"

View File

@ -4,6 +4,7 @@ include "@cbuild/include/myprint.sh"
function detect_os {
local uname_result="$(uname -o)"
# myprint "uname result: '$uname_result'"
case "$uname_result" in
Msys | Cygwin | MS/Windows)
safeprint WINDOWS

View File

@ -233,9 +233,7 @@ function pack_static_lib {
fi
local command="ar rcs $OUTDIR/$outfile $objects"
print_hline "${GRAY}" "─"
myprint "${GRAY}$command"
print_hline "${GRAY}" "─"
myprint "$command"
if $command
then
myprint "${GREEN}file $CYAN$outfile ${GREEN}created"
@ -270,9 +268,7 @@ function link {
done
local command="$CMP_CPP $objects $static_libs $args $dynamic_libs_args -o $OUTDIR/$outfile"
print_hline "${GRAY}" "─"
myprint "${GRAY}$command"
print_hline "${GRAY}" "─"
myprint "$command"
if $command
then
myprint "${GREEN}file $CYAN$outfile ${GREEN}created"

View File

@ -18,7 +18,7 @@ function safeprint {
# prints text with special characters and resets color
function myprint {
printf "$@${GRAY}\n"
printf "${GRAY}$@${GRAY}\n"
}
function myprint_quiet {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
CBUILD_VERSION=2.3.1
CBUILD_VERSION=2.3.0
PROJECT="%PROJECT_NAME%"
CMP_C="gcc"