xcodeproj 0.4.3 → 0.5.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.
- data/ext/xcodeproj/xcodeproj_ext.c +1 -1
- data/lib/xcodeproj.rb +9 -7
- data/lib/xcodeproj/command/project_diff.rb +7 -7
- data/lib/xcodeproj/command/show.rb +11 -2
- data/lib/xcodeproj/config.rb +102 -38
- data/lib/xcodeproj/constants.rb +16 -14
- data/lib/xcodeproj/differ.rb +243 -0
- data/lib/xcodeproj/helper.rb +1 -0
- data/lib/xcodeproj/project.rb +92 -68
- data/lib/xcodeproj/project/object.rb +32 -9
- data/lib/xcodeproj/project/object/build_configuration.rb +21 -1
- data/lib/xcodeproj/project/object/build_file.rb +40 -6
- data/lib/xcodeproj/project/object/build_phase.rb +96 -84
- data/lib/xcodeproj/project/object/build_rule.rb +14 -8
- data/lib/xcodeproj/project/object/configuration_list.rb +7 -3
- data/lib/xcodeproj/project/object/container_item_proxy.rb +31 -29
- data/lib/xcodeproj/project/object/file_reference.rb +33 -20
- data/lib/xcodeproj/project/object/group.rb +58 -35
- data/lib/xcodeproj/project/object/native_target.rb +132 -108
- data/lib/xcodeproj/project/object/reference_proxy.rb +7 -3
- data/lib/xcodeproj/project/object/root_object.rb +4 -4
- data/lib/xcodeproj/project/object_attributes.rb +9 -6
- data/lib/xcodeproj/user_interface.rb +26 -0
- data/lib/xcodeproj/workspace.rb +23 -19
- metadata +4 -3
- data/lib/xcodeproj/project/recursive_diff.rb +0 -116
@@ -19,10 +19,30 @@ module Xcodeproj
|
|
19
19
|
attribute :build_settings, Hash, {}
|
20
20
|
|
21
21
|
# @return [PBXFileReference] an optional file reference to a
|
22
|
-
#
|
22
|
+
# configuration file (`.xcconfig`).
|
23
23
|
#
|
24
24
|
has_one :base_configuration_reference, PBXFileReference
|
25
25
|
|
26
|
+
#---------------------------------------------------------------------#
|
27
|
+
|
28
|
+
public
|
29
|
+
|
30
|
+
# @!group AbstractObject Hooks
|
31
|
+
|
32
|
+
# @return [Hash{String => Hash}] A hash suitable to display the object
|
33
|
+
# to the user.
|
34
|
+
#
|
35
|
+
def pretty_print
|
36
|
+
data = {}
|
37
|
+
data['Build Settings'] = build_settings
|
38
|
+
if base_configuration_reference
|
39
|
+
data['Base Configuration'] = base_configuration_reference.pretty_print
|
40
|
+
end
|
41
|
+
{ name => data }
|
42
|
+
end
|
43
|
+
|
44
|
+
#---------------------------------------------------------------------#
|
45
|
+
|
26
46
|
end
|
27
47
|
end
|
28
48
|
end
|
@@ -11,19 +11,53 @@ module Xcodeproj
|
|
11
11
|
|
12
12
|
# @return [Hash] the list of build settings for this file.
|
13
13
|
#
|
14
|
-
# The contents of this array depend on the phase of the build
|
14
|
+
# @note The contents of this array depend on the phase of the build
|
15
|
+
# file.
|
15
16
|
#
|
16
|
-
#
|
17
|
-
#
|
17
|
+
# For PBXHeadersBuildPhase is `{ "ATTRIBUTES" => [:value] }`
|
18
|
+
# where `:value` can be `Public`, `Private`, or nil
|
19
|
+
# (Protected).
|
18
20
|
#
|
19
21
|
attribute :settings, Hash, {}
|
20
22
|
|
21
23
|
# @return [PBXFileReference] the file that to build.
|
22
24
|
#
|
23
|
-
# @todo I think that is possible to add any kind of
|
24
|
-
# folders linked to a path).
|
25
|
+
# @todo I think that is possible to add any kind of group (for
|
26
|
+
# example folders linked to a path).
|
25
27
|
#
|
26
|
-
has_one :file_ref, [
|
28
|
+
has_one :file_ref, [
|
29
|
+
PBXFileReference,
|
30
|
+
PBXGroup,
|
31
|
+
PBXVariantGroup,
|
32
|
+
XCVersionGroup,
|
33
|
+
PBXReferenceProxy
|
34
|
+
]
|
35
|
+
|
36
|
+
#---------------------------------------------------------------------#
|
37
|
+
|
38
|
+
public
|
39
|
+
|
40
|
+
# @!group AbstractObject Hooks
|
41
|
+
|
42
|
+
# @return [String] A name suitable for displaying the object to the
|
43
|
+
# user.
|
44
|
+
#
|
45
|
+
def display_name
|
46
|
+
file_ref.display_name
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [Hash{String => Hash}, String] A hash suitable to display the
|
50
|
+
# object to the user.
|
51
|
+
#
|
52
|
+
def pretty_print
|
53
|
+
if settings.nil? || settings.empty?
|
54
|
+
display_name
|
55
|
+
else
|
56
|
+
{ display_name => settings }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#---------------------------------------------------------------------#
|
27
61
|
|
28
62
|
end
|
29
63
|
end
|
@@ -11,30 +11,105 @@ module Xcodeproj
|
|
11
11
|
# @!group Attributes
|
12
12
|
|
13
13
|
# @return [ObjectList<PBXBuildFile>] the files processed by this build
|
14
|
-
#
|
14
|
+
# configuration.
|
15
15
|
#
|
16
16
|
has_many :files, PBXBuildFile
|
17
17
|
|
18
18
|
# @return [String] some kind of magic number which usually is
|
19
|
-
#
|
20
|
-
#
|
19
|
+
# '2147483647' (can be also `8` and `12` in
|
20
|
+
# PBXCopyFilesBuildPhase, one of the masks is
|
21
|
+
# run_only_for_deployment_postprocessing).
|
21
22
|
#
|
22
23
|
attribute :build_action_mask, String, '2147483647'
|
23
24
|
|
24
25
|
# @return [String] whether or not this should only be processed before
|
25
|
-
#
|
26
|
+
# deployment. Can be either '0', or '1'.
|
26
27
|
#
|
27
|
-
# This option is exposed in Xcode in the UI of
|
28
|
-
# `Copy only when installing` or in
|
29
|
-
# script only when
|
28
|
+
# @note This option is exposed in Xcode in the UI of
|
29
|
+
# PBXCopyFilesBuildPhase as `Copy only when installing` or in
|
30
|
+
# PBXShellScriptBuildPhase as `Run script only when
|
31
|
+
# installing`.
|
30
32
|
#
|
31
33
|
attribute :run_only_for_deployment_postprocessing, String, '0'
|
32
34
|
|
35
|
+
# @return [String] Comments associated with this build phase.
|
36
|
+
#
|
37
|
+
# @note This is apparently no longer used by Xcode.
|
38
|
+
#
|
39
|
+
attribute :comments, String
|
40
|
+
|
41
|
+
#--------------------------------------#
|
42
|
+
|
43
|
+
public
|
44
|
+
|
45
|
+
# @!group Helpers
|
46
|
+
|
47
|
+
# @return [Array<PBXFileReference>] the list of all the files
|
48
|
+
# referenced by this build phase.
|
49
|
+
#
|
50
|
+
def files_references
|
51
|
+
files.map { |bf| bf.file_ref }.uniq
|
52
|
+
end
|
53
|
+
|
54
|
+
# Adds a new build file, initialized with the given file reference, to
|
55
|
+
# the phase.
|
56
|
+
#
|
57
|
+
# @param [PBXFileReference] file
|
58
|
+
# the file reference that should be added to the build phase.
|
59
|
+
#
|
60
|
+
# @return [PBXBuildFile] the build file generated.
|
61
|
+
#
|
62
|
+
def add_file_reference(file)
|
63
|
+
build_file = project.new(PBXBuildFile)
|
64
|
+
build_file.file_ref = file
|
65
|
+
files << build_file
|
66
|
+
build_file
|
67
|
+
end
|
68
|
+
|
69
|
+
# Removes the build file associated with the given file reference from
|
70
|
+
# the phase.
|
71
|
+
#
|
72
|
+
# @param [PBXFileReference] file the file to remove
|
73
|
+
#
|
74
|
+
# @return [void]
|
75
|
+
#
|
76
|
+
def remove_file_reference(file)
|
77
|
+
build_file = files.find { |bf| bf.file_ref == file }
|
78
|
+
if build_file
|
79
|
+
build_file.file_ref = nil
|
80
|
+
build_file.remove_from_project
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Removes a build file from the phase and clears its relationship to
|
85
|
+
# the file reference.
|
86
|
+
#
|
87
|
+
# @param [PBXBuildFile] build_file the file to remove
|
88
|
+
#
|
89
|
+
# @return [void]
|
90
|
+
#
|
91
|
+
def remove_build_file(build_file)
|
92
|
+
build_file.file_ref = nil
|
93
|
+
build_file.remove_from_project
|
94
|
+
end
|
95
|
+
|
96
|
+
# Removes all the build files from the phase and clears their
|
97
|
+
# relationship to the file reference.
|
98
|
+
#
|
99
|
+
# @return [void]
|
100
|
+
#
|
101
|
+
def clear_build_files
|
102
|
+
files.objects.each do |bf|
|
103
|
+
remove_build_file(bf)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
33
107
|
end
|
34
108
|
|
35
109
|
#-----------------------------------------------------------------------#
|
36
110
|
|
37
|
-
# The phase responsible of copying headers
|
111
|
+
# The phase responsible of copying headers. Known as `Copy Headers` in
|
112
|
+
# the UI.
|
38
113
|
#
|
39
114
|
# @note This phase can appear only once in a target.
|
40
115
|
#
|
@@ -44,7 +119,8 @@ module Xcodeproj
|
|
44
119
|
|
45
120
|
#-----------------------------------------------------------------------#
|
46
121
|
|
47
|
-
# The phase responsible of compiling the files
|
122
|
+
# The phase responsible of compiling the files. Known as `Compile
|
123
|
+
# Sources` in the UI.
|
48
124
|
#
|
49
125
|
# @note This phase can appear only once in a target.
|
50
126
|
#
|
@@ -54,8 +130,8 @@ module Xcodeproj
|
|
54
130
|
|
55
131
|
#-----------------------------------------------------------------------#
|
56
132
|
|
57
|
-
# The phase responsible on linking with frameworks
|
58
|
-
# Libraries`
|
133
|
+
# The phase responsible on linking with frameworks. Known as `Link Binary
|
134
|
+
# With Libraries` in the UI.
|
59
135
|
#
|
60
136
|
# @note This phase can appear only once in a target.
|
61
137
|
#
|
@@ -66,8 +142,8 @@ module Xcodeproj
|
|
66
142
|
#-----------------------------------------------------------------------#
|
67
143
|
|
68
144
|
# The resources build phase apparently is a specialized copy build phase
|
69
|
-
# for resources
|
70
|
-
# the only one capable of
|
145
|
+
# for resources. Known as `Copy Bundle Resources` in the UI. It is
|
146
|
+
# unclear if this is the only one capable of optimizing PNG.
|
71
147
|
#
|
72
148
|
# @note This phase can appear only once in a target.
|
73
149
|
#
|
@@ -91,14 +167,14 @@ module Xcodeproj
|
|
91
167
|
attribute :name, String
|
92
168
|
|
93
169
|
# @return [String] the subpath of `dst_subfolder_spec` where this file
|
94
|
-
#
|
170
|
+
# should be copied to.
|
95
171
|
#
|
96
|
-
# Can accept environment variables like `$(PRODUCT_NAME)`.
|
172
|
+
# @note Can accept environment variables like `$(PRODUCT_NAME)`.
|
97
173
|
#
|
98
174
|
attribute :dst_path, String, ''
|
99
175
|
|
100
176
|
# @return [String] the path (destination) where the files should be
|
101
|
-
#
|
177
|
+
# copied to.
|
102
178
|
#
|
103
179
|
attribute :dst_subfolder_spec, String, Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[:resources]
|
104
180
|
|
@@ -134,20 +210,20 @@ module Xcodeproj
|
|
134
210
|
|
135
211
|
# @return [String] the path to the script interpreter.
|
136
212
|
#
|
137
|
-
# Defaults to `/bin/sh`.
|
213
|
+
# @note Defaults to `/bin/sh`.
|
138
214
|
#
|
139
215
|
attribute :shell_path, String, '/bin/sh'
|
140
216
|
|
141
217
|
# @return [String] the actual script to perform.
|
142
218
|
#
|
143
|
-
# Defaults to the empty string.
|
219
|
+
# @note Defaults to the empty string.
|
144
220
|
#
|
145
221
|
attribute :shell_script, String, ''
|
146
222
|
|
147
223
|
# @return [String] whether or not the ENV variables should be shown in
|
148
|
-
#
|
224
|
+
# the build log.
|
149
225
|
#
|
150
|
-
# Defaults to true (`1`).
|
226
|
+
# @note Defaults to true (`1`).
|
151
227
|
#
|
152
228
|
attribute :show_env_vars_in_log, String, '1'
|
153
229
|
end
|
@@ -164,70 +240,6 @@ module Xcodeproj
|
|
164
240
|
|
165
241
|
#-----------------------------------------------------------------------#
|
166
242
|
|
167
|
-
class AbstractBuildPhase < AbstractObject
|
168
|
-
|
169
|
-
# @!group Helpers
|
170
|
-
|
171
|
-
# @return [Array<PBXFileReference>] the list of all the files
|
172
|
-
# referenced by this build phase.
|
173
|
-
#
|
174
|
-
def files_references
|
175
|
-
files.map { |bf| bf.file_ref }.uniq
|
176
|
-
end
|
177
|
-
|
178
|
-
# Adds a new build file, initialized with the given file reference, to
|
179
|
-
# the phase.
|
180
|
-
#
|
181
|
-
# @param [PBXFileReference] file
|
182
|
-
# the file reference that should be added to the build phase.
|
183
|
-
#
|
184
|
-
# @return [PBXBuildFile] the build file generated.
|
185
|
-
#
|
186
|
-
def add_file_reference(file)
|
187
|
-
build_file = project.new(PBXBuildFile)
|
188
|
-
build_file.file_ref = file
|
189
|
-
files << build_file
|
190
|
-
build_file
|
191
|
-
end
|
192
|
-
|
193
|
-
# Removes the build file associated with the given file reference from
|
194
|
-
# the phase.
|
195
|
-
#
|
196
|
-
# @param [PBXFileReference] file the file to remove
|
197
|
-
#
|
198
|
-
# @return [void]
|
199
|
-
#
|
200
|
-
def remove_file_reference(file)
|
201
|
-
build_file = files.find { |bf| bf.file_ref == file }
|
202
|
-
if build_file
|
203
|
-
build_file.file_ref = nil
|
204
|
-
build_file.remove_from_project
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
# Removes a build file from the phase and clears its relationship to
|
209
|
-
# the file reference.
|
210
|
-
#
|
211
|
-
# @param [PBXBuildFile] build_file the file to remove
|
212
|
-
#
|
213
|
-
# @return [void]
|
214
|
-
#
|
215
|
-
def remove_build_file(build_file)
|
216
|
-
build_file.file_ref = nil
|
217
|
-
build_file.remove_from_project
|
218
|
-
end
|
219
|
-
|
220
|
-
# Removes all the build files from the phase and clears their
|
221
|
-
# relationship to the file reference.
|
222
|
-
#
|
223
|
-
# @return [void]
|
224
|
-
#
|
225
|
-
def clear_build_files
|
226
|
-
files.objects.each do |bf|
|
227
|
-
remove_build_file(bf)
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
243
|
end
|
232
244
|
end
|
233
245
|
end
|
@@ -14,38 +14,44 @@ module Xcodeproj
|
|
14
14
|
|
15
15
|
# @return [String] a string representing what compiler to use.
|
16
16
|
#
|
17
|
-
#
|
17
|
+
# @example
|
18
|
+
# `com.apple.compilers.proxy.script`.
|
18
19
|
#
|
19
20
|
attribute :compiler_spec, String
|
20
21
|
|
21
22
|
# @return [String] the type of the files that should be processed by
|
22
|
-
#
|
23
|
+
# this rule.
|
23
24
|
#
|
24
|
-
#
|
25
|
+
# @example
|
26
|
+
# `pattern.proxy`.
|
25
27
|
#
|
26
28
|
attribute :file_type, String
|
27
29
|
|
28
30
|
# @return [String] the pattern of the files that should be processed by
|
29
|
-
#
|
31
|
+
# this rule. This attribute is an alternative to to
|
32
|
+
# `file_type`.
|
30
33
|
#
|
31
|
-
#
|
34
|
+
# @example
|
35
|
+
# `*.css`.
|
32
36
|
#
|
33
37
|
attribute :file_patterns, String
|
34
38
|
|
35
39
|
# @return [String] whether the rule is editable.
|
36
40
|
#
|
37
|
-
#
|
41
|
+
# @example
|
42
|
+
# `1`.
|
38
43
|
#
|
39
44
|
attribute :is_editable, String, '1'
|
40
45
|
|
41
46
|
# @return [ObjectList<PBXFileReference>] the file references for the
|
42
|
-
#
|
47
|
+
# output files.
|
43
48
|
#
|
44
49
|
attribute :output_files, Array
|
45
50
|
|
46
51
|
# @return [String] the content of the script to use for the build rule.
|
47
52
|
#
|
48
|
-
#
|
53
|
+
# @note This attribute is present if the #{#compiler_spec} is
|
54
|
+
# `com.apple.compilers.proxy.script`
|
49
55
|
#
|
50
56
|
attribute :script, String
|
51
57
|
|
@@ -28,6 +28,8 @@ module Xcodeproj
|
|
28
28
|
|
29
29
|
#---------------------------------------------------------------------#
|
30
30
|
|
31
|
+
public
|
32
|
+
|
31
33
|
# @!group Helpers
|
32
34
|
|
33
35
|
# Returns the build settings of the build configuration with
|
@@ -39,10 +41,12 @@ module Xcodeproj
|
|
39
41
|
# @return [Hash {String=>String}] the build settings
|
40
42
|
#
|
41
43
|
def build_settings(build_configuration_name)
|
42
|
-
|
43
|
-
|
44
|
-
end
|
44
|
+
config = build_configurations.find { |bc| bc.name == build_configuration_name }
|
45
|
+
config.build_settings if config
|
45
46
|
end
|
47
|
+
|
48
|
+
#---------------------------------------------------------------------#
|
49
|
+
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -5,16 +5,16 @@ module Xcodeproj
|
|
5
5
|
# Apparently a proxy for another object which might belong another
|
6
6
|
# project contained in the same workspace of the project document.
|
7
7
|
#
|
8
|
-
# This class is referenced by {PBXTargetDependency}
|
9
|
-
#
|
8
|
+
# This class is referenced by {PBXTargetDependency} for information about
|
9
|
+
# it usage see the specs of that class.
|
10
10
|
#
|
11
|
-
# @note
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
11
|
+
# @note This class references the other objects by UUID instead of
|
12
|
+
# creating proper relationships because the other objects might be
|
13
|
+
# part of another project. This implies that the references to
|
14
|
+
# other objects should not increase the retain count of the
|
15
|
+
# targets.
|
16
16
|
#
|
17
|
-
# @todo:
|
17
|
+
# @todo: This class needs some work to support targets across workspaces,
|
18
18
|
# as the container portal might not be initialized leading
|
19
19
|
# xcodeproj to raise because ti can't find the UUID.
|
20
20
|
#
|
@@ -23,44 +23,46 @@ module Xcodeproj
|
|
23
23
|
# @!group Attributes
|
24
24
|
|
25
25
|
# @return [String] apparently the UUID of the root object
|
26
|
-
#
|
26
|
+
# {PBXProject} of the project containing the represented
|
27
|
+
# object.
|
27
28
|
#
|
28
|
-
# @todo
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
29
|
+
# @todo this is an attribute because a it is usually a reference to
|
30
|
+
# the root object or to a file reference to another project.
|
31
|
+
# The reference to the root object causes a retain cycle that
|
32
|
+
# could cause issues (e.g. in to_tree_hash). Usually those
|
33
|
+
# objects are retained by at least another object (the
|
34
|
+
# {Project} for the root object and a {PBXGroup} for the
|
35
|
+
# reference to another project) and so the referenced object
|
36
|
+
# should be serialized.
|
35
37
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
+
# If this assumption is incorrect, there could be loss of
|
39
|
+
# information opening and saving an existing project.
|
38
40
|
#
|
39
41
|
attribute :container_portal, String
|
40
42
|
|
41
43
|
# @return [String] the type of the proxy.
|
42
44
|
#
|
43
|
-
#
|
45
|
+
# @note {PBXNativeTarget} is `1`.
|
44
46
|
#
|
45
47
|
attribute :proxy_type, String
|
46
48
|
|
47
49
|
# @return [String] apparently the UUID of the represented
|
48
|
-
#
|
50
|
+
# object.
|
49
51
|
#
|
50
|
-
# @note
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
52
|
+
# @note If the object is in another project the UUID would not be
|
53
|
+
# present in the {Project#objects_by_uuid} hash. For this
|
54
|
+
# reason this is not an `has_one` attribute. It is assumes that
|
55
|
+
# if the object belongs to the project at least another object
|
56
|
+
# should be retaining it. This assumption is reasonable because
|
57
|
+
# this is a proxy class.
|
56
58
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
+
# If this assumption is incorrect, there could be loss of
|
60
|
+
# information opening and saving an existing project.
|
59
61
|
#
|
60
62
|
attribute :remote_global_id_string, String
|
61
63
|
|
62
64
|
# @return [String] apparently the name of the object represented by
|
63
|
-
#
|
65
|
+
# the proxy.
|
64
66
|
#
|
65
67
|
attribute :remote_info, String
|
66
68
|
|