@@ -16,13 +16,15 @@ module RakefileHelpers
1616 def load_configuration ( config_file )
1717 return if $configured
1818
19- unless config_file =~ /[\\ |\/ ]/
19+ if config_file =~ /[\\ |\/ ]/
20+ $cfg_file = config_file
21+ else
2022 $cfg_file_base = config_file
21- $cfg_file = "targets/#{ config_file } "
23+ $cfg_file = "targets/#{ config_file } "
2224 end
2325 $cfg = YamlHelper . load_file ( $cfg_file)
2426 $cfg[ :paths ] ||= { }
25- $cfg[ :paths ] [ :test ] ||= [ 'src/' , '../src/' , 'testdata/' , 'tests/' ]
27+ $cfg[ :paths ] [ :test ] = ( Array ( $cfg [ :paths ] [ :test ] ) + [ 'src/' , '../src/' , 'testdata/' , 'tests/' ] ) . uniq
2628 $colour_output = false unless $cfg[ 'colour' ]
2729 $configured = true if config_file != DEFAULT_CONFIG_FILE
2830 end
@@ -101,7 +103,14 @@ def build_command_string(hash, values, defines = nil)
101103 args = [ ]
102104 hash [ :arguments ] . each do |arg |
103105 if arg . include? '$'
104- if arg . include? ': COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'
106+ if arg . include? '${5}'
107+ all_paths = [ File . join ( '..' , 'src' ) , $extra_paths, 'src' , File . join ( 'tests' ) , File . join ( 'testdata' ) , $cfg[ :paths ] [ :support ] ] . flatten . uniq . compact
108+ all_paths . each { |f | args << arg . gsub ( '${5}' , f ) }
109+
110+ elsif arg . include? '${6}'
111+ [ $cfg[ :defines ] [ :test ] , $cfg. dig ( :unity , :defines ) , defines ] . flatten . uniq . compact . each { |f | args << arg . gsub ( '${6}' , f ) }
112+
113+ elsif arg . include? ': COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'
105114 pattern = arg . gsub ( ': COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' , '' )
106115 [ File . join ( '..' , 'src' ) ] . each do |f |
107116 args << pattern . gsub ( /\$ / , f )
@@ -115,7 +124,7 @@ def build_command_string(hash, values, defines = nil)
115124
116125 elsif arg . include? ': COLLECTION_DEFINES_TEST_AND_VENDOR'
117126 pattern = arg . gsub ( ': COLLECTION_DEFINES_TEST_AND_VENDOR' , '' )
118- [ $cfg[ :defines ] [ :test ] , defines ] . flatten . uniq . compact . each do |f |
127+ [ $cfg[ :defines ] [ :test ] , $cfg . dig ( :unity , :defines ) , defines ] . flatten . uniq . compact . each do |f |
119128 args << pattern . gsub ( /\$ / , f )
120129 end
121130
@@ -141,7 +150,7 @@ def build_command_string(hash, values, defines = nil)
141150 end
142151
143152 def compile ( file , defines = [ ] )
144- out_file = File . join ( 'build' , File . basename ( file , C_EXTENSION ) ) + $cfg[ :extension ] [ :object ]
153+ out_file = File . join ( 'build' , File . basename ( file , C_EXTENSION ) ) + ( $cfg[ :extension ] [ :object ] || '.o' )
145154 cmd_str = build_command_string ( $cfg[ :tools ] [ :test_compiler ] , [ file , out_file ] , defines )
146155 execute ( cmd_str )
147156 out_file
@@ -170,7 +179,7 @@ def run_astyle(style_what)
170179 "--style=allman --indent=spaces=4 --indent-switches --indent-preproc-define --indent-preproc-block " \
171180 "--pad-oper --pad-comma --unpad-paren --pad-header " \
172181 "--align-pointer=type --align-reference=name " \
173- "--add-brackets -- mode=c --suffix=none " \
182+ "--mode=c --suffix=none " \
174183 "#{ style_what } "
175184 execute ( command , false )
176185 report "Styling C:PASS"
0 commit comments