Class: IAR::Project_set
- Inherits:
-
Object
- Object
- IAR::Project_set
- Includes:
- EWW, UNI_Project
- Defined in:
- lib/ebngen/adapter/iar.rb
Constant Summary collapse
- TOOLCHAIN =
'iar'
Instance Method Summary collapse
- #add_project_to_set ⇒ Object
- #generator ⇒ Object
-
#initialize(project_data, generator_variable, logger = nil) ⇒ Project_set
constructor
PARAMS: - project_data: specific project data format for a application/library - generator_variable: all dependency in hash.
- #save_set ⇒ Object
Methods included from UNI_Project
#get_board, #get_default_project_settings, #get_default_projectset_settings, #get_libraries, #get_output_dir, #get_project_name, #get_src_list, #get_target_list, #get_targets, #get_template, #get_type, #is_toolchain_support, #set_hash
Methods included from EWW
#add_batch_project_target, #add_project, #save
Constructor Details
#initialize(project_data, generator_variable, logger = nil) ⇒ Project_set
PARAMS:
-
project_data: specific project data format for a application/library
-
generator_variable: all dependency in hash
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/ebngen/adapter/iar.rb', line 362 def initialize(project_data, generator_variable, logger = nil) @logger = logger unless (logger) @logger = Logger.new(STDOUT) @logger.level = Logger::WARN end set_hash(project_data) @project_name = get_project_name() @board = get_board() @paths = PathModifier.new(generator_variable["paths"]) @all_projects_hash = generator_variable["all"] @iar_project_files = {".eww" => nil} return nil if get_template(Project_set::TOOLCHAIN).nil? get_template(Project_set::TOOLCHAIN).each do |template| ext = File.extname(template) if @iar_project_files.keys.include?(ext) path = @paths.fullpath("default_path",template) doc = Nokogiri::XML(open(path)) case ext when ".eww" @iar_project_files[ext] = doc else @logger.info "#{ext} not processed" end end end #clean the wrkspace in template @iar_project_files[".eww"].css("workspace/project").each do |node| node.remove end @iar_project_files[".eww"].css("workspace/batchBuild/batchDefinition").each do |node| node.remove end end |
Instance Method Details
#add_project_to_set ⇒ Object
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/ebngen/adapter/iar.rb', line 404 def add_project_to_set() return if @iar_project_files.nil? return if @iar_project_files['.eww'].nil? ext = ".eww" #batch build mode is add get_target_list(Project_set::TOOLCHAIN).each do |target| add_batch_project_target(@iar_project_files[ext], "all", @project_name, target) add_batch_project_target(@iar_project_files[ext], target, @project_name, target) next if get_libraries(Project_set::TOOLCHAIN).nil? get_libraries(Project_set::TOOLCHAIN).each do |lib| add_batch_project_target(@iar_project_files[ext], "all", lib, target) add_batch_project_target(@iar_project_files[ext], target, lib, target) end end #add projects file = "#{@project_name}_#{@board}.ewp" path = File.join('$WS_DIR$',file) add_project(@iar_project_files[ext], path) #add library projects here #get from dependency['libraries'][library_name] ustruct = @all_projects_hash return if get_libraries(Project_set::TOOLCHAIN).nil? get_libraries(Project_set::TOOLCHAIN).each do |lib| if ustruct[lib].nil? @logger.info "#{lib} information is missing in all hash" next end libname = "#{@project_name}.ewp" root = @paths.rootdir_table[@ustruct[library][tool_key]['outdir']['root-dir']] lib_path = File.join(root, @ustruct[library][tool_key]['outdir']['path'], libname) if @ustruct[ project_name ][ tool_key ].has_key?('outdir') ewwpath = File.join(@output_rootdir, @ustruct[ project_name ][ tool_key ][ 'outdir' ] ) else ewwpath = @output_rootdir end path = Pathname.new(lib_path).relative_path_from(Pathname.new(ewwpath)) #more to come end end |
#generator ⇒ Object
397 398 399 400 401 |
# File 'lib/ebngen/adapter/iar.rb', line 397 def generator() return if not is_toolchain_support(Project::TOOLCHAIN) add_project_to_set() save_set() end |
#save_set ⇒ Object
446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/ebngen/adapter/iar.rb', line 446 def save_set() path = get_output_dir(Project_set::TOOLCHAIN, @paths.rootdir_table) @logger.info @paths.rootdir_table['output_root'] @logger.info path @logger.info "#{@project_name}_#{@board}.eww" if path.class == Hash save(@iar_project_files['.eww'], File.join(@paths.rootdir_table[path['rootdir']], path['path'], "#{@project_name}_#{@board}.eww")) else save(@iar_project_files['.eww'], File.join(@paths.rootdir_table['output_root'], path, "#{@project_name}_#{@board}.eww")) end end |