xcodeproj 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/xcodeproj +5 -5
- data/lib/xcodeproj.rb +0 -2
- data/lib/xcodeproj/command.rb +26 -17
- data/lib/xcodeproj/command/project_diff.rb +8 -11
- data/lib/xcodeproj/command/show.rb +8 -10
- data/lib/xcodeproj/command/sort.rb +4 -7
- data/lib/xcodeproj/command/target_diff.rb +4 -5
- data/lib/xcodeproj/config.rb +64 -57
- data/lib/xcodeproj/config/other_linker_flags_parser.rb +62 -0
- data/lib/xcodeproj/constants.rb +31 -30
- data/lib/xcodeproj/differ.rb +5 -9
- data/lib/xcodeproj/gem_version.rb +1 -2
- data/lib/xcodeproj/helper.rb +5 -4
- data/lib/xcodeproj/plist_helper.rb +46 -11
- data/lib/xcodeproj/project.rb +16 -20
- data/lib/xcodeproj/project/case_converter.rb +59 -0
- data/lib/xcodeproj/project/object.rb +40 -30
- data/lib/xcodeproj/project/object/build_configuration.rb +1 -5
- data/lib/xcodeproj/project/object/build_file.rb +1 -4
- data/lib/xcodeproj/project/object/build_phase.rb +2 -13
- data/lib/xcodeproj/project/object/build_rule.rb +0 -3
- data/lib/xcodeproj/project/object/configuration_list.rb +0 -4
- data/lib/xcodeproj/project/object/container_item_proxy.rb +2 -4
- data/lib/xcodeproj/project/object/file_reference.rb +3 -6
- data/lib/xcodeproj/project/object/group.rb +6 -14
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +64 -13
- data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +4 -6
- data/lib/xcodeproj/project/object/native_target.rb +18 -29
- data/lib/xcodeproj/project/object/reference_proxy.rb +0 -4
- data/lib/xcodeproj/project/object/root_object.rb +4 -8
- data/lib/xcodeproj/project/object/target_dependency.rb +1 -4
- data/lib/xcodeproj/project/object_attributes.rb +76 -33
- data/lib/xcodeproj/project/object_dictionary.rb +76 -63
- data/lib/xcodeproj/project/object_list.rb +5 -9
- data/lib/xcodeproj/project/project_helper.rb +2 -7
- data/lib/xcodeproj/project/xcproj_helper.rb +0 -2
- data/lib/xcodeproj/scheme.rb +12 -15
- data/lib/xcodeproj/user_interface.rb +0 -4
- data/lib/xcodeproj/workspace.rb +36 -23
- data/lib/xcodeproj/workspace/file_reference.rb +3 -3
- data/lib/xcodeproj/xcodebuild_helper.rb +0 -6
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e60fb9981ce8111af008a6fede49f4bdb85da8d
|
4
|
+
data.tar.gz: b15a3c5bc25c0f775d4c55785a15ff7bd73a1dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f2fcf6d8a4676c47ea208ce946a8782718d1484bdd81fd7edc70e7ffcfa0d02f732f2727e5beac6a22fadcd18bb42ca9848949b2ba387afd894fbfabf8136da
|
7
|
+
data.tar.gz: d0b1e17ccdaba4f89ea2985a6278f742d003297e2c9d2c884e84ad73e8befb5246bf5329a95b74f1f498c0fafc4ad7f728fd9e63f5508a75cf3073c31b728f6e
|
data/bin/xcodeproj
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if $
|
3
|
+
if $PROGRAM_NAME == __FILE__
|
4
4
|
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
8
|
-
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../ext', __FILE__)
|
8
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
9
9
|
end
|
10
10
|
|
11
11
|
require 'xcodeproj'
|
data/lib/xcodeproj.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Xcodeproj
|
2
|
-
|
3
2
|
class PlainInformative < StandardError
|
4
3
|
end
|
5
4
|
|
@@ -22,7 +21,6 @@ module Xcodeproj
|
|
22
21
|
autoload :XCScheme, 'xcodeproj/scheme'
|
23
22
|
autoload :XcodebuildHelper, 'xcodeproj/xcodebuild_helper'
|
24
23
|
|
25
|
-
|
26
24
|
# TODO: Delete me (compatibility with CocoaPods 0.33.1)
|
27
25
|
def self.read_plist(path)
|
28
26
|
PlistHelper.read(path)
|
data/lib/xcodeproj/command.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Xcodeproj
|
2
|
-
|
3
2
|
require 'colored'
|
4
3
|
|
5
4
|
class Command
|
@@ -33,16 +32,27 @@ module Xcodeproj
|
|
33
32
|
def options
|
34
33
|
options = @command_class.options
|
35
34
|
keys = options.map(&:first)
|
36
|
-
key_size = keys.
|
35
|
+
key_size = keys.reduce(0) { |size, key| key.size > size ? key.size : size }
|
37
36
|
options.map { |key, desc| " #{key.ljust(key_size)} #{desc}" }.join("\n")
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
41
40
|
class ARGV < Array
|
42
|
-
def options
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
def options
|
42
|
+
select { |x| x.to_s[0, 1] == '-' }
|
43
|
+
end
|
44
|
+
|
45
|
+
def arguments
|
46
|
+
self - options
|
47
|
+
end
|
48
|
+
|
49
|
+
def option(name)
|
50
|
+
!!delete(name)
|
51
|
+
end
|
52
|
+
|
53
|
+
def shift_argument
|
54
|
+
(arg = arguments[0]) && delete(arg)
|
55
|
+
end
|
46
56
|
end
|
47
57
|
|
48
58
|
def self.banner
|
@@ -66,14 +76,14 @@ module Xcodeproj
|
|
66
76
|
sub_command.run
|
67
77
|
|
68
78
|
rescue Interrupt
|
69
|
-
puts
|
70
|
-
#Config.instance.verbose? ? raise : exit(1)
|
79
|
+
puts '[!] Cancelled'.red
|
80
|
+
# Config.instance.verbose? ? raise : exit(1)
|
71
81
|
exit(1)
|
72
82
|
|
73
|
-
rescue
|
83
|
+
rescue => e
|
74
84
|
puts e.message
|
75
85
|
unless e.is_a?(Informative) || e.is_a?(Help)
|
76
|
-
puts
|
86
|
+
puts e.backtrace
|
77
87
|
end
|
78
88
|
exit 1
|
79
89
|
end
|
@@ -88,14 +98,14 @@ module Xcodeproj
|
|
88
98
|
|
89
99
|
show_help = argv.option('--help')
|
90
100
|
|
91
|
-
String.send(:define_method, :colorize) { |string
|
101
|
+
String.send(:define_method, :colorize) { |string, _| string } if argv.option('--no-color')
|
92
102
|
|
93
103
|
command_class = case command_argument = argv.shift_argument
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
104
|
+
when 'target-diff' then TargetDiff
|
105
|
+
when 'project-diff' then ProjectDiff
|
106
|
+
when 'show' then Show
|
107
|
+
when 'sort' then Sort
|
108
|
+
end
|
99
109
|
|
100
110
|
if command_class.nil?
|
101
111
|
raise Help.new(self, argv, command_argument)
|
@@ -134,4 +144,3 @@ module Xcodeproj
|
|
134
144
|
end
|
135
145
|
end
|
136
146
|
end
|
137
|
-
|
@@ -2,25 +2,25 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class ProjectDiff < Command
|
4
4
|
def self.banner
|
5
|
-
%{Shows the difference between two projects:
|
5
|
+
%{Shows the difference between two projects:
|
6
6
|
|
7
|
-
|
7
|
+
$ project-diff PROJECT_1 PROJECT_2
|
8
8
|
|
9
|
-
|
9
|
+
It shows the difference in a UUID agnostic fashion.
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
To reduce the noise (and to simplify implementation) differences in the
|
12
|
+
order of arrays are ignored.}
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.options
|
16
|
-
[
|
16
|
+
[['--ignore KEY', 'A key to ignore in the comparison. Can be specified multiple times.']].concat(super)
|
17
17
|
end
|
18
18
|
|
19
19
|
def initialize(argv)
|
20
20
|
@path_project1 = argv.shift_argument
|
21
21
|
@path_project2 = argv.shift_argument
|
22
22
|
unless @path_project1 && @path_project2
|
23
|
-
raise Informative,
|
23
|
+
raise Informative, 'Two project paths are required.'
|
24
24
|
end
|
25
25
|
@keys_to_ignore = []
|
26
26
|
while (idx = argv.index('--ignore'))
|
@@ -30,7 +30,6 @@ module Xcodeproj
|
|
30
30
|
super unless argv.empty?
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
33
|
def run
|
35
34
|
hash_1 = Project.new(@path_project1).to_tree_hash.dup
|
36
35
|
hash_2 = Project.new(@path_project2).to_tree_hash.dup
|
@@ -45,11 +44,9 @@ module Xcodeproj
|
|
45
44
|
yaml = diff.to_yaml
|
46
45
|
yaml = yaml.gsub(@path_project1, @path_project1.cyan)
|
47
46
|
yaml = yaml.gsub(@path_project2, @path_project2.magenta)
|
48
|
-
yaml = yaml.gsub(
|
47
|
+
yaml = yaml.gsub(':diff:', 'diff:'.yellow)
|
49
48
|
puts yaml
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
55
|
-
|
@@ -2,17 +2,17 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class Show < Command
|
4
4
|
def self.banner
|
5
|
-
%
|
5
|
+
%(Shows an overview of a project in a YAML representation.'
|
6
6
|
|
7
|
-
|
7
|
+
$ show [PROJECT]
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
If no `PROJECT' is specified then the current work directory is searched
|
10
|
+
for one.)
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.options
|
14
14
|
[
|
15
|
-
[
|
15
|
+
['--format [hash|tree_hash|raw]', 'YAML output format, optional'],
|
16
16
|
].concat(super)
|
17
17
|
end
|
18
18
|
|
@@ -47,10 +47,10 @@ module Xcodeproj
|
|
47
47
|
pretty_print = xcodeproj.pretty_print
|
48
48
|
sections = []
|
49
49
|
pretty_print.each do |key, value|
|
50
|
-
|
50
|
+
section = key.green
|
51
51
|
yaml = value.to_yaml
|
52
|
-
yaml.gsub!(/^---$/,'')
|
53
|
-
yaml.gsub!(/^-/,"\n-")
|
52
|
+
yaml.gsub!(/^---$/, '')
|
53
|
+
yaml.gsub!(/^-/, "\n-")
|
54
54
|
section << yaml
|
55
55
|
sections << section
|
56
56
|
end
|
@@ -59,5 +59,3 @@ module Xcodeproj
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
63
|
-
|
@@ -2,12 +2,12 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class Sort < Command
|
4
4
|
def self.banner
|
5
|
-
%
|
5
|
+
%(Sorts the give project
|
6
6
|
|
7
|
-
|
7
|
+
$ sort [PROJECT]
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
If no `PROJECT' is specified then the current work directory is searched
|
10
|
+
for one.)
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(argv)
|
@@ -24,6 +24,3 @@ module Xcodeproj
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
@@ -2,16 +2,16 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class TargetDiff < Command
|
4
4
|
def self.banner
|
5
|
-
%
|
5
|
+
%(Shows the difference between two targets:
|
6
6
|
|
7
|
-
|
7
|
+
$ targets-diff [target 1] [target 2]
|
8
8
|
|
9
|
-
|
9
|
+
Only supports build source files atm.)
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.options
|
13
13
|
[
|
14
|
-
[
|
14
|
+
['--project PATH', 'The Xcode project document to use.'],
|
15
15
|
].concat(super)
|
16
16
|
end
|
17
17
|
|
@@ -39,4 +39,3 @@ module Xcodeproj
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
data/lib/xcodeproj/config.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'shellwords'
|
2
|
+
require 'xcodeproj/config/other_linker_flags_parser'
|
2
3
|
|
3
4
|
module Xcodeproj
|
4
|
-
|
5
5
|
# This class holds the data for a Xcode build settings file (xcconfig) and
|
6
6
|
# provides support for serialization.
|
7
7
|
#
|
8
8
|
class Config
|
9
|
-
|
10
9
|
require 'set'
|
11
10
|
|
12
11
|
# @return [Hash{String => String}] The attributes of the settings file
|
@@ -14,20 +13,11 @@ module Xcodeproj
|
|
14
13
|
#
|
15
14
|
attr_accessor :attributes
|
16
15
|
|
17
|
-
# @return [Set<String>] The
|
18
|
-
#
|
19
|
-
#
|
20
|
-
attr_accessor :frameworks
|
21
|
-
|
22
|
-
# @return [Set<String>] The list of the *weak* frameworks required by
|
23
|
-
# this settings file.
|
24
|
-
#
|
25
|
-
attr_accessor :weak_frameworks
|
26
|
-
|
27
|
-
# @return [Set<String>] The list of the libraries required by this
|
28
|
-
# settings file.
|
16
|
+
# @return [Hash{Symbol => Set<String>}] The other linker flags by key.
|
17
|
+
# Xcodeproj handles them in a dedicated way to prevent duplication
|
18
|
+
# of the libraries and of the frameworks.
|
29
19
|
#
|
30
|
-
attr_accessor :
|
20
|
+
attr_accessor :other_linker_flags
|
31
21
|
|
32
22
|
# @return [Array] The list of the configuration files included by this
|
33
23
|
# configuration file (`#include "SomeConfig"`).
|
@@ -40,7 +30,10 @@ module Xcodeproj
|
|
40
30
|
def initialize(xcconfig_hash_or_file = {})
|
41
31
|
@attributes = {}
|
42
32
|
@includes = []
|
43
|
-
@
|
33
|
+
@other_linker_flags = {}
|
34
|
+
[:simple, :frameworks, :weak_frameworks, :libraries].each do |key|
|
35
|
+
@other_linker_flags[key] = Set.new
|
36
|
+
end
|
44
37
|
merge!(extract_hash(xcconfig_hash_or_file))
|
45
38
|
end
|
46
39
|
|
@@ -49,14 +42,13 @@ module Xcodeproj
|
|
49
42
|
end
|
50
43
|
|
51
44
|
def ==(other)
|
52
|
-
other.respond_to?(:to_hash) && other.to_hash ==
|
45
|
+
other.respond_to?(:to_hash) && other.to_hash == to_hash
|
53
46
|
end
|
54
47
|
|
55
|
-
#-------------------------------------------------------------------------#
|
56
|
-
|
57
48
|
public
|
58
49
|
|
59
50
|
# @!group Serialization
|
51
|
+
#-------------------------------------------------------------------------#
|
60
52
|
|
61
53
|
# Sorts the internal data by setting name and serializes it in the xcconfig
|
62
54
|
# format.
|
@@ -69,7 +61,7 @@ module Xcodeproj
|
|
69
61
|
# @return [String] The serialized internal data.
|
70
62
|
#
|
71
63
|
def to_s(prefix = nil)
|
72
|
-
include_lines = includes.map { |path| "#include \"#{normalized_xcconfig_path(path)}\""}
|
64
|
+
include_lines = includes.map { |path| "#include \"#{normalized_xcconfig_path(path)}\"" }
|
73
65
|
settings = to_hash(prefix).sort_by(&:first).map { |k, v| "#{k} = #{v}" }
|
74
66
|
[include_lines + settings].join("\n")
|
75
67
|
end
|
@@ -87,8 +79,8 @@ module Xcodeproj
|
|
87
79
|
end
|
88
80
|
|
89
81
|
# The hash representation of the xcconfig. The hash includes the
|
90
|
-
# frameworks, the weak frameworks
|
91
|
-
# Flags` (`OTHER_LDFLAGS`).
|
82
|
+
# frameworks, the weak frameworks, the libraries and the simple other
|
83
|
+
# linker flags in the `Other Linker Flags` (`OTHER_LDFLAGS`).
|
92
84
|
#
|
93
85
|
# @note All the values are sorted to have a consistent output in Ruby
|
94
86
|
# 1.8.7.
|
@@ -96,26 +88,54 @@ module Xcodeproj
|
|
96
88
|
# @return [Hash] The hash representation
|
97
89
|
#
|
98
90
|
def to_hash(prefix = nil)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
91
|
+
list = []
|
92
|
+
list += other_linker_flags[:simple].to_a.sort
|
93
|
+
modifiers = {
|
94
|
+
:frameworks => '-framework',
|
95
|
+
:weak_frameworks => '-weak_framework',
|
96
|
+
:libraries => '-l',
|
97
|
+
}
|
98
|
+
[:libraries, :frameworks, :weak_frameworks].each do |key|
|
99
|
+
modifier = modifiers[key]
|
100
|
+
sorted = other_linker_flags[key].to_a.sort
|
101
|
+
list += sorted.map { |l| %(#{modifier} "#{l}") }
|
102
|
+
end
|
103
|
+
|
104
|
+
result = attributes.dup
|
105
|
+
result['OTHER_LDFLAGS'] = list.join(' ') unless list.empty?
|
106
|
+
|
107
107
|
if prefix
|
108
|
-
Hash[
|
108
|
+
Hash[result.map { |k, v| [prefix + k, v] }]
|
109
109
|
else
|
110
|
-
|
110
|
+
result
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
|
114
|
+
# @return [Set<String>] The list of the frameworks required by this
|
115
|
+
# settings file.
|
116
|
+
#
|
117
|
+
def frameworks
|
118
|
+
other_linker_flags[:frameworks]
|
119
|
+
end
|
120
|
+
|
121
|
+
# @return [Set<String>] The list of the *weak* frameworks required by
|
122
|
+
# this settings file.
|
123
|
+
#
|
124
|
+
def weak_frameworks
|
125
|
+
other_linker_flags[:weak_frameworks]
|
126
|
+
end
|
127
|
+
|
128
|
+
# @return [Set<String>] The list of the libraries required by this
|
129
|
+
# settings file.
|
130
|
+
#
|
131
|
+
def libraries
|
132
|
+
other_linker_flags[:libraries]
|
133
|
+
end
|
115
134
|
|
116
135
|
public
|
117
136
|
|
118
137
|
# @!group Merging
|
138
|
+
#-------------------------------------------------------------------------#
|
119
139
|
|
120
140
|
# Merges the given xcconfig representation in the receiver.
|
121
141
|
#
|
@@ -139,29 +159,17 @@ module Xcodeproj
|
|
139
159
|
def merge!(xcconfig)
|
140
160
|
if xcconfig.is_a? Config
|
141
161
|
merge_attributes!(xcconfig.attributes)
|
142
|
-
|
143
|
-
|
144
|
-
|
162
|
+
other_linker_flags.keys.each do |key|
|
163
|
+
other_linker_flags[key].merge(xcconfig.other_linker_flags[key])
|
164
|
+
end
|
145
165
|
else
|
146
166
|
merge_attributes!(xcconfig.to_hash)
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
frameworks = flags.scan(/(?:\A|\s)-framework\s+([^\s]+)/).map { |m| m[0] }
|
154
|
-
weak_frameworks = flags.scan(/(?:\A|\s)-weak_framework\s+([^\s]+)/).map { |m| m[0] }
|
155
|
-
libraries = flags.scan(/(?:\A|\s)-l ?([^\s]+)/).map { |m| m[0] }
|
156
|
-
@frameworks.merge frameworks
|
157
|
-
@weak_frameworks.merge weak_frameworks
|
158
|
-
@libraries.merge libraries
|
159
|
-
|
160
|
-
new_flags = flags.dup
|
161
|
-
frameworks.each {|f| new_flags.gsub!("-framework #{f}", "") }
|
162
|
-
weak_frameworks.each {|f| new_flags.gsub!("-weak_framework #{f}", "") }
|
163
|
-
libraries.each {|l| new_flags.gsub!("-l#{l}", ""); new_flags.gsub!("-l #{l}", "") }
|
164
|
-
@attributes['OTHER_LDFLAGS'] = new_flags.gsub("\w*", ' ').strip
|
167
|
+
if flags = attributes.delete('OTHER_LDFLAGS')
|
168
|
+
flags_by_key = OtherLinkerFlagsParser.parse(flags)
|
169
|
+
other_linker_flags.keys.each do |key|
|
170
|
+
other_linker_flags[key].merge(flags_by_key[key])
|
171
|
+
end
|
172
|
+
end
|
165
173
|
end
|
166
174
|
end
|
167
175
|
alias_method :<<, :merge!
|
@@ -175,13 +183,13 @@ module Xcodeproj
|
|
175
183
|
# @return [Config] the new xcconfig.
|
176
184
|
#
|
177
185
|
def merge(config)
|
178
|
-
|
186
|
+
dup.tap { |x| x.merge!(config) }
|
179
187
|
end
|
180
188
|
|
181
189
|
# @return [Config] A copy of the receiver.
|
182
190
|
#
|
183
191
|
def dup
|
184
|
-
Xcodeproj::Config.new(
|
192
|
+
Xcodeproj::Config.new(to_hash.dup)
|
185
193
|
end
|
186
194
|
|
187
195
|
#-------------------------------------------------------------------------#
|
@@ -302,6 +310,5 @@ module Xcodeproj
|
|
302
310
|
end
|
303
311
|
|
304
312
|
#-------------------------------------------------------------------------#
|
305
|
-
|
306
313
|
end
|
307
314
|
end
|