class IAR::Project_set
Constants
- TOOLCHAIN
Public Class Methods
new(project_data, generator_variable, logger = nil)
click to toggle source
initialize EWW
class PARAMS:
-
project_data: specific project data format for a application/library
-
generator_variable: all dependency in hash
# 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
Public Instance Methods
add_project_to_set()
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# 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