Skip to content

Commit

Permalink
Add log option to stcript ./build_product
Browse files Browse the repository at this point in the history
  • Loading branch information
Honny1 committed Nov 13, 2023
1 parent 1af67e6 commit ccc2914
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

set(LOG_LEVEL "WARNING")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(SSG_LOG)
set(LOG_LEVEL "DEBUG")
endif()

Expand Down Expand Up @@ -228,6 +228,7 @@ message(STATUS "build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "generator: ${CMAKE_GENERATOR}")
message(STATUS "source directory: ${CMAKE_SOURCE_DIR}")
message(STATUS "build directory: ${CMAKE_BINARY_DIR}")
message(STATUS "Logging: ${SSG_LOG}")
message(STATUS " ")

message(STATUS "Tools:")
Expand Down
21 changes: 21 additions & 0 deletions build_product
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ _arg_ansible_playbooks="on"
_arg_bash_scripts="on"
_arg_datastream_only="off"
_arg_profiling="off"
_arg_log="off"


print_help()
Expand All @@ -94,6 +95,7 @@ print_help()
printf '\t%s\n' "--bash-scripts, --no-bash-scripts: Build Bash remediation scripts for every profile (on by default)"
printf '\t%s\n' "-d, --datastream-only, --no-datastream-only: Build the data stream only. Do not build any of the guides, tables, etc (off by default)"
printf '\t%s\n' "-p, --profiling, --no-profiling: Use ninja and call the build_profiler.sh util (off by default)"
printf '\t%s\n' "-l, --log, --no-log: Logs all debugging messages (off by default)"
printf '\t%s\n' "-h, --help: Prints help"
printf '\nEnvironment variables that are supported:\n'
printf '\t%s\n' "ADDITIONAL_CMAKE_OPTIONS: Whitespace-separated string of arguments to pass to CMake."
Expand Down Expand Up @@ -181,6 +183,18 @@ parse_commandline()
{ begins_with_short_option "$_next" && shift && set -- "-p" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
fi
;;
-l|--no-log|--log)
_arg_log="on"
test "${1:0:5}" = "--no-" && _arg_log="off"
;;
-l*)
_arg_log="on"
_next="${_key##-l}"
if test -n "$_next" -a "$_next" != "$_key"
then
{ begins_with_short_option "$_next" && shift && set -- "-l" "-${_next}" "$@"; } || die "The short option '$_key' can't be decomposed to ${_key:0:2} and -${_key:2}, because ${_key:0:2} doesn't accept value and '-${_key:2:1}' doesn't correspond to a short option."
fi
;;
-h|--help)
print_help
exit 0
Expand Down Expand Up @@ -392,6 +406,13 @@ fi
EXPLICIT_BUILD_TARGETS=()
set_explict_build_targets

if [ "$_arg_log" = on ] ; then
CMAKE_OPTIONS+=("-DSSG_LOG:BOOL=ON")
else
CMAKE_OPTIONS+=("-DSSG_LOG:BOOL=OFF")
fi


set -e
rm -rf build/*
cd build
Expand Down

0 comments on commit ccc2914

Please sign in to comment.