ceedling 0.15.3 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "http://rubygems.org/"
3
3
  gem "bundler", ">= 1.3.5"
4
4
  gem "rake", ">= 0.9.2.2"
5
5
 
6
- gem "rspec", "~> 2.14.1"
6
+ gem "rspec", "~> 3.0"
7
7
  gem "require_all"
8
8
  gem "constructor"
9
9
  gem "diy"
@@ -8,14 +8,18 @@ GEM
8
8
  rake (10.3.2)
9
9
  require_all (1.3.2)
10
10
  rr (1.1.2)
11
- rspec (2.14.1)
12
- rspec-core (~> 2.14.0)
13
- rspec-expectations (~> 2.14.0)
14
- rspec-mocks (~> 2.14.0)
15
- rspec-core (2.14.8)
16
- rspec-expectations (2.14.5)
17
- diff-lcs (>= 1.1.3, < 2.0)
18
- rspec-mocks (2.14.6)
11
+ rspec (3.0.0)
12
+ rspec-core (~> 3.0.0)
13
+ rspec-expectations (~> 3.0.0)
14
+ rspec-mocks (~> 3.0.0)
15
+ rspec-core (3.0.3)
16
+ rspec-support (~> 3.0.0)
17
+ rspec-expectations (3.0.3)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.0.0)
20
+ rspec-mocks (3.0.3)
21
+ rspec-support (~> 3.0.0)
22
+ rspec-support (3.0.3)
19
23
  thor (0.19.1)
20
24
 
21
25
  PLATFORMS
@@ -28,5 +32,5 @@ DEPENDENCIES
28
32
  rake (>= 0.9.2.2)
29
33
  require_all
30
34
  rr
31
- rspec (~> 2.14.1)
35
+ rspec (~> 3.0)
32
36
  thor
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Ceedling - Build/test system for C based on Ruby/Rake
2
2
  =====================================================
3
3
 
4
+ [![Ceedling Build Status](https://api.travis-ci.org/ThrowTheSwitch/Ceedling.png?branch=master)](https://travis-ci.org/ThrowTheSwitch/Ceedling)
5
+
6
+ Ceedling is a build system for C projects that is something of an extension around Ruby’s Rake (make-ish) build system. Ceedling also makes TDD (Test-Driven Development) in C a breeze by integrating [CMock](https://github.com/throwtheswitch/cmock), [Unity](https://github.com/throwtheswitch/unity), and [CException](https://github.com/throwtheswitch/cexception) -- three other awesome open-source projects you can’t live without if you're creating awesomeness in the C language. Ceedling is also extensible with a handy plugin mechanism.
7
+
4
8
  Usage Documentation
5
9
  ===================
6
10
 
@@ -46,7 +46,7 @@ class CeedlingTasks < Thor
46
46
  end
47
47
  end
48
48
 
49
- folders = %w{plugins lib release}
49
+ folders = %w{plugins lib}
50
50
  folders.map do |f|
51
51
  {:src => f, :dst => File.join(ceedling_path, f)}
52
52
  end.each do |f|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # Files needed from submodules
22
22
  s.files = []
23
- s.files += Dir['vendor/**/docs/**/*.pdf', 'docs/**/*.pdf']
23
+ s.files += Dir['vendor/**/docs/**/*.pdf', 'docs/**/*.pdf', 'vendor/**/docs/**/*.md', 'docs/**/*.md']
24
24
  s.files += Dir['vendor/cmock/lib/**/*.rb']
25
25
  s.files += Dir['vendor/cmock/config/**/*.rb']
26
26
  s.files += Dir['vendor/cmock/release/**/*.info']
@@ -7,10 +7,10 @@ require 'ceedling/constants' # for Verbosity constants class & base file p
7
7
 
8
8
 
9
9
  class ConfiguratorBuilder
10
-
10
+
11
11
  constructor :file_system_utils, :file_wrapper, :system_wrapper
12
-
13
-
12
+
13
+
14
14
  def build_global_constants(config)
15
15
  config.each_pair do |key, value|
16
16
  formatted_key = key.to_s.upcase
@@ -21,7 +21,7 @@ class ConfiguratorBuilder
21
21
  end
22
22
  end
23
23
 
24
-
24
+
25
25
  def build_accessor_methods(config, context)
26
26
  config.each_pair do |key, value|
27
27
  # fill configurator object with accessor methods
@@ -29,11 +29,11 @@ class ConfiguratorBuilder
29
29
  end
30
30
  end
31
31
 
32
-
32
+
33
33
  # create a flattened hash from the original configuration structure
34
34
  def flattenify(config)
35
35
  new_hash = {}
36
-
36
+
37
37
  config.each_key do | parent |
38
38
 
39
39
  # gracefully handle empty top-level entries
@@ -54,13 +54,13 @@ class ConfiguratorBuilder
54
54
  else
55
55
  new_hash["#{parent.to_s.downcase}".to_sym] = config[parent]
56
56
  end
57
-
57
+
58
58
  end
59
-
59
+
60
60
  return new_hash
61
61
  end
62
62
 
63
-
63
+
64
64
  def populate_defaults(config, defaults)
65
65
  defaults.keys.sort.each do |section|
66
66
  defaults[section].keys.sort.each do |entry|
@@ -118,7 +118,7 @@ class ConfiguratorBuilder
118
118
  build_path_name = path[0]
119
119
  build_path = path[1]
120
120
  build_path_add_condition = path[2]
121
-
121
+
122
122
  # insert path into build paths if associated with true condition
123
123
  out_hash[:project_build_paths] << build_path if build_path_add_condition
124
124
  # set path symbol name and path for each entry in paths array
@@ -131,7 +131,7 @@ class ConfiguratorBuilder
131
131
 
132
132
  def set_force_build_filepaths(in_hash)
133
133
  out_hash = {}
134
-
134
+
135
135
  out_hash[:project_test_force_rebuild_filepath] = File.join( in_hash[:project_test_dependencies_path], 'force_build' )
136
136
  out_hash[:project_release_force_rebuild_filepath] = File.join( in_hash[:project_release_dependencies_path], 'force_build' ) if (in_hash[:project_release_build])
137
137
 
@@ -141,7 +141,7 @@ class ConfiguratorBuilder
141
141
 
142
142
  def set_rakefile_components(in_hash)
143
143
  out_hash = {
144
- :project_rakefile_component_files =>
144
+ :project_rakefile_component_files =>
145
145
  [File.join(CEEDLING_LIB, 'ceedling', 'tasks_base.rake'),
146
146
  File.join(CEEDLING_LIB, 'ceedling', 'tasks_filesystem.rake'),
147
147
  File.join(CEEDLING_LIB, 'ceedling', 'tasks_tests.rake'),
@@ -160,79 +160,72 @@ class ConfiguratorBuilder
160
160
 
161
161
  return out_hash
162
162
  end
163
-
164
163
 
165
- def set_library_build_info_filepaths(hash)
166
164
 
165
+ def set_library_build_info_filepaths(hash)
167
166
  # Notes:
168
- # - Dependency on a change to our input configuration hash is handled elsewhere as it is
167
+ # - Dependency on a change to our input configuration hash is handled elsewhere as it is
169
168
  # dynamically formed during ceedling's execution
170
169
  # - Compiled vendor dependencies like cmock.o, unity.o, cexception.o are handled below;
171
170
  # here we're interested only in ceedling-based code generation dependencies
172
-
173
- ceedling_build_info_filepath = File.join(CEEDLING_RELEASE, 'build.info')
174
- cmock_build_info_filepath = FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info')
175
-
176
171
  out_hash = {
177
- :ceedling_build_info_filepath => ceedling_build_info_filepath,
178
- :cmock_build_info_filepath => cmock_build_info_filepath
172
+ :cmock_build_info_filepath => FilePathUtils::form_ceedling_vendor_path('cmock/release', 'build.info')
179
173
  }
180
-
181
174
  return out_hash
182
175
  end
183
176
 
184
-
177
+
185
178
  def set_release_target(in_hash)
186
179
  return {} if (not in_hash[:project_release_build])
187
-
180
+
188
181
  release_target_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_executable])) : in_hash[:release_build_output])
189
182
  release_map_file = ((in_hash[:release_build_output].nil?) ? (DEFAULT_RELEASE_TARGET_NAME.ext(in_hash[:extension_map])) : in_hash[:release_build_output].ext(in_hash[:extension_map]))
190
-
183
+
191
184
  return {
192
185
  # tempted to make a helper method in file_path_utils? stop right there, pal. you'll introduce a cyclical dependency
193
186
  :project_release_build_target => File.join(in_hash[:project_build_release_root], release_target_file),
194
187
  :project_release_build_map => File.join(in_hash[:project_build_release_root], release_map_file)
195
188
  }
196
189
  end
197
-
190
+
198
191
 
199
192
  def collect_project_options(in_hash)
200
193
  options = []
201
-
194
+
202
195
  in_hash[:project_options_paths].each do |path|
203
196
  options << @file_wrapper.directory_listing( File.join(path, '*.yml') )
204
197
  end
205
-
198
+
206
199
  return {
207
200
  :collection_project_options => options.flatten
208
201
  }
209
202
  end
210
-
203
+
211
204
 
212
205
  def expand_all_path_globs(in_hash)
213
206
  out_hash = {}
214
207
  path_keys = []
215
-
208
+
216
209
  in_hash.each_key do |key|
217
210
  next if (not key.to_s[0..4] == 'paths')
218
211
  path_keys << key
219
212
  end
220
-
213
+
221
214
  # sorted to provide assured order of traversal in test calls on mocks
222
215
  path_keys.sort.each do |key|
223
216
  out_hash["collection_#{key.to_s}".to_sym] = @file_system_utils.collect_paths( in_hash[key] )
224
217
  end
225
-
218
+
226
219
  return out_hash
227
220
  end
228
221
 
229
222
 
230
223
  def collect_source_and_include_paths(in_hash)
231
224
  return {
232
- :collection_paths_source_and_include =>
233
- ( in_hash[:collection_paths_source] +
225
+ :collection_paths_source_and_include =>
226
+ ( in_hash[:collection_paths_source] +
234
227
  in_hash[:collection_paths_include] ).select {|x| File.directory?(x)}
235
- }
228
+ }
236
229
  end
237
230
 
238
231
 
@@ -241,38 +234,38 @@ class ConfiguratorBuilder
241
234
  extra_paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions])
242
235
 
243
236
  return {
244
- :collection_paths_source_include_vendor =>
245
- in_hash[:collection_paths_source_and_include] +
237
+ :collection_paths_source_include_vendor =>
238
+ in_hash[:collection_paths_source_and_include] +
246
239
  extra_paths
247
- }
240
+ }
248
241
  end
249
242
 
250
243
 
251
244
  def collect_test_support_source_include_paths(in_hash)
252
245
  return {
253
- :collection_paths_test_support_source_include =>
246
+ :collection_paths_test_support_source_include =>
254
247
  (in_hash[:collection_paths_test] +
255
248
  in_hash[:collection_paths_support] +
256
- in_hash[:collection_paths_source] +
249
+ in_hash[:collection_paths_source] +
257
250
  in_hash[:collection_paths_include] ).select {|x| File.directory?(x)}
258
- }
251
+ }
259
252
  end
260
253
 
261
254
 
262
255
  def collect_vendor_paths(in_hash)
263
256
  return {:collection_paths_vendor => get_vendor_paths(in_hash)}
264
257
  end
265
-
258
+
266
259
 
267
260
  def collect_test_support_source_include_vendor_paths(in_hash)
268
261
  return {
269
- :collection_paths_test_support_source_include_vendor =>
262
+ :collection_paths_test_support_source_include_vendor =>
270
263
  in_hash[:collection_paths_test_support_source_include] +
271
264
  get_vendor_paths(in_hash)
272
- }
265
+ }
273
266
  end
274
-
275
-
267
+
268
+
276
269
  def collect_tests(in_hash)
277
270
  all_tests = @file_wrapper.instantiate_file_list
278
271
 
@@ -290,11 +283,11 @@ class ConfiguratorBuilder
290
283
  all_assembly = @file_wrapper.instantiate_file_list
291
284
 
292
285
  return {:collection_all_assembly => all_assembly} if (not in_hash[:release_build_use_assembly])
293
-
286
+
294
287
  in_hash[:collection_paths_source].each do |path|
295
288
  all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") )
296
289
  end
297
-
290
+
298
291
  @file_system_utils.revise_file_list( all_assembly, in_hash[:files_assembly] )
299
292
 
300
293
  return {:collection_all_assembly => all_assembly}
@@ -311,7 +304,7 @@ class ConfiguratorBuilder
311
304
  end
312
305
  end
313
306
  @file_system_utils.revise_file_list( all_source, in_hash[:files_source] )
314
-
307
+
315
308
  return {:collection_all_source => all_source}
316
309
  end
317
310
 
@@ -319,18 +312,18 @@ class ConfiguratorBuilder
319
312
  def collect_headers(in_hash)
320
313
  all_headers = @file_wrapper.instantiate_file_list
321
314
 
322
- paths =
315
+ paths =
323
316
  in_hash[:collection_paths_test] +
324
317
  in_hash[:collection_paths_support] +
325
- in_hash[:collection_paths_source] +
318
+ in_hash[:collection_paths_source] +
326
319
  in_hash[:collection_paths_include]
327
-
320
+
328
321
  paths.each do |path|
329
322
  all_headers.include( File.join(path, "*#{in_hash[:extension_header]}") )
330
323
  end
331
324
 
332
325
  @file_system_utils.revise_file_list( all_headers, in_hash[:files_include] )
333
-
326
+
334
327
  return {:collection_all_headers => all_headers}
335
328
  end
336
329
 
@@ -338,13 +331,13 @@ class ConfiguratorBuilder
338
331
  def collect_all_existing_compilation_input(in_hash)
339
332
  all_input = @file_wrapper.instantiate_file_list
340
333
 
341
- paths =
342
- in_hash[:collection_paths_test] +
343
- in_hash[:collection_paths_support] +
344
- in_hash[:collection_paths_source] +
334
+ paths =
335
+ in_hash[:collection_paths_test] +
336
+ in_hash[:collection_paths_support] +
337
+ in_hash[:collection_paths_source] +
345
338
  in_hash[:collection_paths_include] +
346
339
  [FilePathUtils::form_ceedling_vendor_path(UNITY_LIB_PATH)]
347
-
340
+
348
341
  paths << FilePathUtils::form_ceedling_vendor_path(CEXCEPTION_LIB_PATH) if (in_hash[:project_use_exceptions])
349
342
  paths << FilePathUtils::form_ceedling_vendor_path(CMOCK_LIB_PATH) if (in_hash[:project_use_mocks])
350
343
 
@@ -356,14 +349,14 @@ class ConfiguratorBuilder
356
349
  all_input.include( File.join(path, "*#{in_hash[:extension_source]}") )
357
350
  end
358
351
  end
359
-
352
+
360
353
  @file_system_utils.revise_file_list( all_input, in_hash[:files_test] )
361
354
  @file_system_utils.revise_file_list( all_input, in_hash[:files_support] )
362
355
  @file_system_utils.revise_file_list( all_input, in_hash[:files_source] )
363
356
  @file_system_utils.revise_file_list( all_input, in_hash[:files_include] )
364
357
  # finding assembly files handled explicitly through other means
365
358
 
366
- return {:collection_all_existing_compilation_input => all_input}
359
+ return {:collection_all_existing_compilation_input => all_input}
367
360
  end
368
361
 
369
362
 
@@ -373,16 +366,16 @@ class ConfiguratorBuilder
373
366
  test_defines.concat(in_hash[:unity_defines])
374
367
  test_defines.concat(in_hash[:cmock_defines]) if (in_hash[:project_use_mocks])
375
368
  test_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions])
376
-
369
+
377
370
  return {:collection_defines_test_and_vendor => test_defines}
378
371
  end
379
372
 
380
373
 
381
374
  def collect_release_and_vendor_defines(in_hash)
382
375
  release_defines = in_hash[:defines_release].clone
383
-
376
+
384
377
  release_defines.concat(in_hash[:cexception_defines]) if (in_hash[:project_use_exceptions])
385
-
378
+
386
379
  return {:collection_defines_release_and_vendor => release_defines}
387
380
  end
388
381
 
@@ -395,29 +388,29 @@ class ConfiguratorBuilder
395
388
 
396
389
  return {:collection_release_artifact_extra_link_objects => objects}
397
390
  end
398
-
391
+
399
392
 
400
393
  def collect_test_fixture_extra_link_objects(in_hash)
401
394
  # Note: Symbols passed to compiler at command line can change Unity and CException behavior / configuration;
402
395
  # we also handle those dependencies elsewhere in compilation dependencies
403
-
396
+
404
397
  objects = [UNITY_C_FILE]
405
-
398
+
406
399
  # we don't include paths here because use of plugins or mixing different compilers may require different build paths
407
400
  objects << CEXCEPTION_C_FILE if (in_hash[:project_use_exceptions])
408
401
  objects << CMOCK_C_FILE if (in_hash[:project_use_mocks])
409
-
402
+
410
403
  # if we're using mocks & a unity helper is defined & that unity helper includes a source file component (not only a header of macros),
411
404
  # then link in the unity_helper object file too
412
405
  if ( in_hash[:project_use_mocks] and
413
- in_hash[:cmock_unity_helper] and
406
+ in_hash[:cmock_unity_helper] and
414
407
  @file_wrapper.exist?(in_hash[:cmock_unity_helper].ext(in_hash[:extension_source])) )
415
408
  objects << File.basename(in_hash[:cmock_unity_helper])
416
409
  end
417
410
 
418
411
  # no build paths here so plugins can remap if necessary (i.e. path mapping happens at runtime)
419
412
  objects.map! { |object| object.ext(in_hash[:extension_object]) }
420
-
413
+
421
414
  return { :collection_test_fixture_extra_link_objects => objects }
422
415
  end
423
416
 
@@ -433,5 +426,5 @@ class ConfiguratorBuilder
433
426
 
434
427
  return vendor_paths
435
428
  end
436
-
429
+
437
430
  end
@@ -82,6 +82,13 @@ DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = {
82
82
  ].freeze
83
83
  }
84
84
 
85
+ # Disable the -MD flag for OSX LLVM Clang, since unsupported
86
+ if RUBY_PLATFORM =~ /darwin/ && `gcc --version 2> /dev/null` =~ /Apple LLVM version .* \(clang/m # OSX w/LLVM Clang
87
+ MD_FLAG = '' # Clang doesn't support the -MD flag
88
+ else
89
+ MD_FLAG = '-MD'
90
+ end
91
+
85
92
  DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = {
86
93
  :executable => FilePathUtils.os_executable_ext('gcc').freeze,
87
94
  :name => 'default_test_dependencies_generator'.freeze,
@@ -96,7 +103,7 @@ DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = {
96
103
  "-DGNU_PREPROCESSOR".freeze,
97
104
  "-MT \"${3}\"".freeze,
98
105
  '-MM'.freeze,
99
- '-MD'.freeze,
106
+ MD_FLAG,
100
107
  '-MG'.freeze,
101
108
  "-MF \"${2}\"".freeze,
102
109
  "-c \"${1}\"".freeze,
@@ -117,7 +124,7 @@ DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = {
117
124
  "-DGNU_PREPROCESSOR".freeze,
118
125
  "-MT \"${3}\"".freeze,
119
126
  '-MM'.freeze,
120
- '-MD'.freeze,
127
+ MD_FLAG,
121
128
  '-MG'.freeze,
122
129
  "-MF \"${2}\"".freeze,
123
130
  "-c \"${1}\"".freeze,