class StructCore::Processor::TargetSourceFlagsComponent
Public Class Methods
new(structure, working_directory, target = nil)
click to toggle source
Calls superclass method
StructCore::Processor::ProcessorComponent::new
# File lib/spec/processor/target_source_flags.rb, line 8 def initialize(structure, working_directory, target = nil) super(structure, working_directory) @file_map = {} initialize_spec target if structure == :xcodeproj && !target.nil? end
Public Instance Methods
initialize_spec(target)
click to toggle source
@param target [StructCore::Specfile::Target]
# File lib/spec/processor/target_source_flags.rb, line 15 def initialize_spec(target) (target.options || []).each { |option| @file_map.merge!(Dir.glob(File.join(@working_directory, option.glob)).map { |file| [file, option.flags] }.to_h) } end
process(source)
click to toggle source
# File lib/spec/processor/target_source_flags.rb, line 23 def process(source) process_xc source if structure == :spec process_spec source if structure == :xcodeproj end
process_spec(source)
click to toggle source
@param source [Xcodeproj::Project::PBXBuildFile]
# File lib/spec/processor/target_source_flags.rb, line 39 def process_spec(source) file_ref = source.file_ref flags = @file_map[File.join(@working_directory, file_ref.hierarchy_path)] return if flags.nil? settings_hash = source.settings || {} settings_flags = settings_hash['COMPILER_FLAGS'] || '' settings_flags = "#{settings_flags} #{flags}" settings_hash['COMPILER_FLAGS'] = settings_flags source.settings = settings_hash end
process_xc(source)
click to toggle source
@param source [Xcodeproj::Project::PBXBuildFile]
# File lib/spec/processor/target_source_flags.rb, line 29 def process_xc(source) return nil if source.settings.nil? || source.settings['COMPILER_FLAGS'].nil? path = source.real_path.to_s.sub(@working_directory, '') path = path.slice(1, path.length) if path.start_with? '/' StructCore::Specfile::Target::FileOption.new(path, source.settings['COMPILER_FLAGS']) end