module RakeOE
XXX DS: here we should use Rake::pathmap for all mapping of source => destination files
TODO Write Test cases for class
Constants
- DEFAULT_DIRS
A list of default directories used for the project
- DEFAULT_GENERATE_BIN
Default
for if bin files should be generated from app binaries- DEFAULT_GENERATE_HEX
Default
for if hex files should be generated from app binaries- DEFAULT_GENERATE_MAP
Default
for if map files should be generated from app binaries- DEFAULT_LANGUAGE_STD_C
Default
language standards- DEFAULT_LANGUAGE_STD_CPP
- DEFAULT_OPTIMIZATION_DBG
Default
optimization levels used for compiling binaries- DEFAULT_OPTIMIZATION_RELEASE
- DEFAULT_RELEASE
Default
release mode used for the project if no such parameter given via Rakefile- DEFAULT_STRIPPED
Default
for if binaries should be stripped- DEFAULT_SUFFIXES
A list of default file extensions used for the project. This has to match the format as described for
RakeOE::Config.suffixes
- DEFAULT_SW_VERSION
Default
software version string- DEFAULT_TEST_FW
Default
test framework used for linking test case binaries- VERSION
Public Instance Methods
Initialize RakeOE
project. Reads & parses all prj.rake files of given config. Provides all rake tasks.
@param config [RakeOE::Config] Configuration as provided by project Rakefile
@return [RakeOE::Toolchain] Toolchain
object
# File lib/rakeoe.rb, line 26 def init(config) RakeOE::PrjFileCache.set_defaults(RakeOE::Default.prj_settings) src_dirs = [] src_dirs += config.directories[:src] if config.directories[:src] src_dirs += config.directories[:apps] if config.directories[:apps] src_dirs += config.directories[:libs] if config.directories[:libs] RakeOE::PrjFileCache.sweep_recursive(src_dirs.uniq) toolchain = RakeOE::Toolchain.new(config) RakeOE::PrjFileCache.join_regex_keys_for!(toolchain.target) # # Top level tasks # %w[lib app].each do |type| namespace type do # Introduce type:all # # All libs/apps will make themselves dependent on this task, so whenever you call # 'rake lib:all' or 'rake app:all' # all libs/apps will thus be generated automatically desc "Create all #{type}s" task :all case type when 'lib' RakeOE::PrjFileCache.for_each('LIB') do |name, settings| RakeOE::Lib.new(name, settings, toolchain).create end RakeOE::PrjFileCache.for_each('SOLIB') do |name, settings| RakeOE::Lib.new(name, settings, toolchain).create end when 'app' RakeOE::PrjFileCache.for_each('APP') do |name, settings| RakeOE::App.new(name, settings, toolchain).create end else raise "No such type #{type} supported" end # Introduce type:test:all # # All tests in lib/app will make themselves dependent on this task, so whenever you call # 'rake lib:test:all' # all available library tests will be generated automatically before execution namespace 'test' do desc "Run all #{type} tests" task :all desc "Run all #{type} tests and create junit xml output" task :junit end end end desc 'Deploys apps and dynamic objects to deploy_dir/bin, deploy_dir/lib' task :deploy, [:deploy_dir] => :all do |t, args| args.with_defaults(:deploy_dir => config.directories[:deploy]) puts "Copy binaries from #{toolchain.build_dir} => #{args.deploy_dir}" begin FileUtils.mkdir_p("#{args.deploy_dir}/bin") FileUtils.mkdir_p("#{args.deploy_dir}/lib") rescue raise end # deploy binaries Dir.glob("#{toolchain.build_dir}/apps/*").each do |file| next if file.end_with?('.bin') FileUtils.cp(file, "#{args.deploy_dir}/bin/#{File.basename(file)}") if File.executable?(file) end # deploy dynamic libraries Dir.glob("#{toolchain.build_dir}/libs/*.so").each do |file| next if file.end_with?('.bin') FileUtils.cp(file, "#{args.deploy_dir}/lib/") end end desc 'Dump configuration & toolchain variables' task :dump do puts config.dump puts toolchain.dump puts end task :all => %w[lib:all app:all] task :test => %w[lib:test:all app:test:all] task :test_build => %w[lib:test:build app:test:build] task :junit => %w[lib:test:junit app:test:junit] task :default => :all # kind of mrproper/realclean CLOBBER.include('*.tmp', "#{config.directories[:build]}/*") toolchain end