diff --git a/lib/ceedling/configurator.rb b/lib/ceedling/configurator.rb index 85c3b0d7..5671da3e 100644 --- a/lib/ceedling/configurator.rb +++ b/lib/ceedling/configurator.rb @@ -187,28 +187,38 @@ def merge_ceedling_runtime_config(config, runtime_config) config.deep_merge( runtime_config ) end + def populate_with_defaults( config_hash, defaults_hash ) + msg = @reportinator.generate_progress( 'Populating project configuration with collected default values' ) + @loginator.log( msg, Verbosity::OBNOXIOUS ) + + @configurator_builder.populate_with_defaults( config_hash, defaults_hash ) + end + def populate_unity_config(config) msg = @reportinator.generate_progress( 'Processing Unity configuration' ) @loginator.log( msg, Verbosity::OBNOXIOUS ) - # :unity is not guaranteed to exist in a user configuration before populating it. - if config[:unity][:use_param_tests] config[:unity][:defines] << 'UNITY_SUPPORT_TEST_CASES' config[:unity][:defines] << 'UNITY_SUPPORT_VARIADIC_MACROS' end + + @loginator.log( "Unity configuration >> #{config[:unity]}", Verbosity::DEBUG ) end def populate_cmock_config(config) - # :unity is not guaranteed to exist in a user configuration before populating it. + # Save CMock config reference + @cmock_config = config[:cmock] - # Populate config with CMock config - cmock = config[:cmock] || {} - @cmock_config = cmock + cmock = config[:cmock] - return if !config[:project][:use_mocks] + # Do no more prep if we're not using mocks + if !config[:project][:use_mocks] + @loginator.log( "CMock configuration >> #{cmock}", Verbosity::DEBUG ) + return + end msg = @reportinator.generate_progress( 'Processing CMock configuration' ) @loginator.log( msg, Verbosity::OBNOXIOUS ) @@ -217,11 +227,6 @@ def populate_cmock_config(config) cmock[:plugins].map! { |plugin| plugin.to_sym() } cmock[:plugins].uniq! - # CMock includes safe defaults - cmock[:includes] = [] if (cmock[:includes].nil?) - - # Default to empty array if cmock[:unity_helper_path] not provided - cmock[:unity_helper_path] = [] if cmock[:unity_helper_path].nil? # Reformulate CMock helper path value as array of one element if it's a string in config cmock[:unity_helper_path] = [cmock[:unity_helper_path]] if cmock[:unity_helper_path].is_a?( String ) @@ -231,14 +236,8 @@ def populate_cmock_config(config) end cmock[:includes].uniq! - end - - - def populate_with_defaults( config_hash, defaults_hash ) - msg = @reportinator.generate_progress( 'Populating project configuration with collected default values' ) - @loginator.log( msg, Verbosity::OBNOXIOUS ) - @configurator_builder.populate_with_defaults( config_hash, defaults_hash ) + @loginator.log( "CMock configuration >> #{cmock}", Verbosity::DEBUG ) end @@ -263,6 +262,8 @@ def populate_test_runner_generation_config(config) config[:test_runner][:use_param_tests] = config[:unity][:use_param_tests] @runner_config = config[:test_runner] + + @loginator.log( "Test Runner configuration >> #{config[:test_runner]}", Verbosity::DEBUG ) end @@ -274,6 +275,8 @@ def populate_exceptions_config(config) config[:project][:use_exceptions] = true end + + @loginator.log( "CException configuration >> #{config[:cexception]}", Verbosity::DEBUG ) end diff --git a/lib/ceedling/setupinator.rb b/lib/ceedling/setupinator.rb index 56cdde1b..8e954ddc 100644 --- a/lib/ceedling/setupinator.rb +++ b/lib/ceedling/setupinator.rb @@ -69,7 +69,7 @@ def do_setup( app_cfg ) ## 2. Handle basic configuration ## - log_step( 'Project Configuration Handling' ) + log_step( 'Base configuration handling', heading:false ) # Evaluate environment vars before plugin configurations that might reference with inline Ruby string expansion @configurator.eval_environment_variables( config_hash ) @@ -77,12 +77,6 @@ def do_setup( app_cfg ) # Standardize paths and add to Ruby load paths plugins_paths_hash = @configurator.prepare_plugins_load_paths( app_cfg[:ceedling_plugins_path], config_hash ) - # Populate Unity configuration with values to tie vendor tool configurations together - @configurator.populate_unity_config( config_hash ) - - # Populate CMock configuration with values to tie vendor tool configurations together - @configurator.populate_cmock_config( config_hash ) - ## ## 3. Plugin Handling ## @@ -115,14 +109,15 @@ def do_setup( app_cfg ) log_step( 'Completing Project Configuration' ) + # Populate Unity configuration with values to tie vendor tool configurations together + @configurator.populate_unity_config( config_hash ) + + # Populate CMock configuration with values to tie vendor tool configurations together + @configurator.populate_cmock_config( config_hash ) + # Configure test runner generation @configurator.populate_test_runner_generation_config( config_hash ) - @loginator.log( "Unity configuration >> #{config_hash[:unity]}", Verbosity::DEBUG ) - @loginator.log( "CMock configuration >> #{config_hash[:cmock]}", Verbosity::DEBUG ) - @loginator.log( "Test Runner configuration >> #{config_hash[:test_runner]}", Verbosity::DEBUG ) - @loginator.log( "CException configuration >> #{config_hash[:cexception]}", Verbosity::DEBUG ) - # Automagically enable use of exceptions based on CMock settings @configurator.populate_exceptions_config( config_hash )