Module: Xcodeproj::Config::OtherLinkerFlagsParser
- Defined in:
- lib/xcodeproj/config/other_linker_flags_parser.rb
Overview
Parses other linker flags values.
Class Method Summary collapse
-
.parse(flags) ⇒ Hash{Symbol, Array[String]}
Splits the given other linker flags value by type.
-
.split(flags) ⇒ Array<String>
Split the given other linker flags value, taking into account quoting and the fact that the ‘-l` flag might omit the space.
Class Method Details
.parse(flags) ⇒ Hash{Symbol, Array[String]}
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/xcodeproj/config/other_linker_flags_parser.rb', line 14 def self.parse(flags) result = { :frameworks => [], :weak_frameworks => [], :libraries => [], :arg_files => [], :simple => [], :force_load => [], } key = nil if flags.is_a? String flags = split(flags) end flags.each do |token| case token when '-framework' key = :frameworks when '-weak_framework' key = :weak_frameworks when '-l' key = :libraries when '@' key = :arg_files when '-force_load' key = :force_load else if key result[key] << token key = nil else result[:simple] << token end end end result end |
.split(flags) ⇒ Array<String>
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/xcodeproj/config/other_linker_flags_parser.rb', line 60 def self.split(flags) flags.strip.shellsplit.flat_map do |string| if string =~ /\A-l.+/ ['-l', string[2..-1]] elsif string =~ /\A@.+/ ['@', string[1..-1]] else string end end end |