tasks_base.rake 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. require 'constants'
  2. require 'file_path_utils'
  3. desc "Display build environment version info."
  4. task :version do
  5. tools = [
  6. [' Ceedling', CEEDLING_ROOT],
  7. ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)],
  8. [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)],
  9. [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)],
  10. ]
  11. tools.each do |tool|
  12. name = tool[0]
  13. base_path = tool[1]
  14. version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip
  15. build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip
  16. puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}"
  17. end
  18. end
  19. desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])."
  20. task :verbosity, :level do |t, args|
  21. verbosity_level = args.level.to_i
  22. if (PROJECT_USE_MOCKS)
  23. # don't store verbosity level in setupinator's config hash, use a copy;
  24. # otherwise, the input configuration will change and trigger entire project rebuilds
  25. hash = @ceedling[:setupinator].config_hash[:cmock].clone
  26. hash[:verbosity] = verbosity_level
  27. @ceedling[:cmock_builder].manufacture( hash )
  28. end
  29. @ceedling[:configurator].project_verbosity = verbosity_level
  30. # control rake's verbosity with new setting
  31. verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) )
  32. end
  33. desc "Enable logging"
  34. task :logging do
  35. @ceedling[:configurator].project_logging = true
  36. end
  37. # non advertised debug task
  38. task :debug do
  39. Rake::Task[:verbosity].invoke(Verbosity::DEBUG)
  40. Rake.application.options.trace = true
  41. @ceedling[:configurator].project_debug = true
  42. end
  43. # non advertised sanity checking task
  44. task :sanity_checks, :level do |t, args|
  45. check_level = args.level.to_i
  46. @ceedling[:configurator].sanity_checks = check_level
  47. end
  48. # list expanded environment variables
  49. if (not ENVIRONMENT.empty?)
  50. desc "List all configured environment variables."
  51. task :environment do
  52. ENVIRONMENT.each do |env|
  53. env.each_key do |key|
  54. name = key.to_s.upcase
  55. puts " - #{name}: \"#{env[key]}\""
  56. end
  57. end
  58. end
  59. end
  60. namespace :options do
  61. COLLECTION_PROJECT_OPTIONS.each do |option_path|
  62. option = File.basename(option_path, '.yml')
  63. desc "Merge #{option} project options."
  64. task option.downcase.to_sym do
  65. # @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash )
  66. hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path )
  67. @ceedling[:setupinator].do_setup( hash )
  68. end
  69. end
  70. end
  71. # do not present task if there's no plugins
  72. if (not PLUGINS_ENABLED.empty?)
  73. desc "Execute plugin result summaries (no build triggering)."
  74. task :summary do
  75. @ceedling[:plugin_manager].summary
  76. puts "\nNOTE: Summaries may be out of date with project sources.\n\n"
  77. end
  78. end