Class: RakeOE::Lib
- Inherits:
-
BinaryBase
- Object
- BinaryBase
- RakeOE::Lib
- Defined in:
- lib/rakeoe/lib.rb
Overview
Finds all source codes in specified directory and encapsulates lib projects
Instance Attribute Summary collapse
-
#binary ⇒ Object
readonly
Returns the value of attribute binary.
Attributes inherited from BinaryBase
#bin_dir, #build_dir, #deps, #inc_dirs, #name, #obj_dirs, #objs, #prj_file, #settings, #src_dir, #src_dirs, #tc, #test_binary, #test_deps, #test_dir, #test_dirs, #test_objs
Instance Method Summary collapse
-
#create ⇒ Object
Create all rules and tasks for the lib XXX DS: we have to make a consistent step by step approach for each binary type XXX DS: something like: 1.) search library dependencies, 2.)build paths, 3.) create main rule, XXX DS: 4.) make test rules, 5, make additional rules (clean/all, …) etc.
-
#create_test_rules(params) ⇒ Object
Create all rules and tasks.
-
#initialize(name, settings, toolchain) ⇒ Lib
constructor
The following parameters are expected in given hash params:.
Methods inherited from BinaryBase
#assemble_moc_file_list, #check_params, #create_build_rules, #dep_to_source, #disable_build, #each_local_lib, #fgrep, #find_files_relative, #handle_prj_type, #handle_qt, #has_tests?, #lib_incs, #load_deps, #obj_to_dep, #obj_to_source, #override_toolchain_vars, #paths_of_libs, #paths_of_local_libs, #platform_flags_fixup, #project_can_build?, #read_prj_settings, #search_files, #search_libs, #source_to_dep, #source_to_obj, #src_directories, #stub_to_src
Constructor Details
#initialize(name, settings, toolchain) ⇒ Lib
The following parameters are expected in given hash params:
@param [String] name Name of the library
@param [String] settings Settings for library
@param [Hash] toolchain Toolchain builder to use
18 19 20 21 22 23 |
# File 'lib/rakeoe/lib.rb', line 18 def initialize(name, settings, toolchain) super(:name => name, :settings => settings, :bin_dir => toolchain.settings['LIB_OUT'], :toolchain => toolchain) end |
Instance Attribute Details
#binary ⇒ Object (readonly)
Returns the value of attribute binary.
9 10 11 |
# File 'lib/rakeoe/lib.rb', line 9 def binary @binary end |
Instance Method Details
#create ⇒ Object
Create all rules and tasks for the lib XXX DS: we have to make a consistent step by step approach for each binary type XXX DS: something like: 1.) search library dependencies, 2.)build paths, 3.) create main rule, XXX DS: 4.) make test rules, 5, make additional rules (clean/all, …) etc.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rakeoe/lib.rb', line 30 def create unless project_can_build? disable_build return end desc "Create #{name}" prj_libs = search_libs(settings) #puts "prj_libs for #{name}: #{prj_libs}" task name => [binary] dependency_paths = paths_of_local_libs + deps + objs file binary => dependency_paths do tc.test_all_files_exist?(dependency_paths) tc.lib(:objects => objs, :lib => binary, :libs => prj_libs[:all], :settings => @settings) end if test_objs.any? && (tc.config.test_fw.size > 0) create_test_rules(:libs => prj_libs) end task name+'_clean' do tc.rm (objs + deps + [binary]).join(' ') end # add library for the lib:all task task :all => name unless tc.test_frameworks.include?(name) # create build directory directory build_dir # create standard build rules create_build_rules CLEAN.include('*.o', build_dir) CLEAN.include(binary, build_dir) CLOBBER.include('*.d', build_dir) end |
#create_test_rules(params) ⇒ Object
Create all rules and tasks
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rakeoe/lib.rb', line 74 def create_test_rules(params) namespace 'test' do # Build the library and execute tests desc "Test #{name}" task "#{name}" => test_binary do tc.run(test_binary) end # Build the library, execute tests and write results to file task "#{name}_junit" => test_binary do tc.run_junit_test(test_binary) end # 'hidden' task just for building the test task "#{name}_build" => test_binary prj_libs = params[:libs] # main rule for the test binary file test_binary => [@test_fw.binary_path] + paths_of_local_libs + [binary] + test_deps + test_objs do tc.test(:objects => test_objs, :test => test_binary, :libs => prj_libs[:all] + [name], :framework => @test_fw.name, :settings => @settings, :includes => test_dirs) end CLEAN.include(test_binary, build_dir) task :all => "#{name}" task :junit => "#{name}_junit" task :build => "#{name}_build" end end |