xcodeproj 0.19.4 → 0.20.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/lib/xcodeproj.rb +0 -2
- data/lib/xcodeproj/constants.rb +8 -4
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/plist_helper.rb +14 -36
- data/lib/xcodeproj/project.rb +1 -0
- data/lib/xcodeproj/project/object.rb +1 -5
- data/lib/xcodeproj/project/object/build_phase.rb +25 -0
- data/lib/xcodeproj/project/object/container_item_proxy.rb +23 -1
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +1 -1
- data/lib/xcodeproj/project/object/native_target.rb +52 -38
- data/lib/xcodeproj/project/object/reference_proxy.rb +4 -0
- metadata +3 -5
- data/ext/xcodeproj/xcodeproj_ext.bundle +0 -0
- data/lib/xcodeproj/ext.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c251c9a9b1362652e5dc8ea5c23901b8c0327e
|
4
|
+
data.tar.gz: 56c1bfb43c09840aa85c5cff8655be63de176207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83d70e140a46ad9f7418ec5ca2587d0878c63ae67a0dcd51eb210fc1f271dd472690af92ffe579892fd405b5ee604500e582cd2950a2c83b5a342f5769a7fc85
|
7
|
+
data.tar.gz: 0b18b6ca17245519fcfa4955596c0163c5390db3f89a9d51a292ec21cad7a4d71c2374d70625fd67d549d77fac39b72cb2222bca637909d437c4e090828c9140
|
data/lib/xcodeproj.rb
CHANGED
data/lib/xcodeproj/constants.rb
CHANGED
@@ -37,6 +37,7 @@ module Xcodeproj
|
|
37
37
|
PBXProject
|
38
38
|
PBXTargetDependency
|
39
39
|
PBXReferenceProxy
|
40
|
+
AbstractTarget
|
40
41
|
),
|
41
42
|
|
42
43
|
'AbstractBuildPhase' => %w(
|
@@ -60,10 +61,6 @@ module Xcodeproj
|
|
60
61
|
),
|
61
62
|
}.freeze
|
62
63
|
|
63
|
-
# @return [Array] The list of the super classes for each ISA.
|
64
|
-
#
|
65
|
-
ISAS_SUPER_CLASSES = %w(AbstractObject AbstractBuildPhase PBXGroup)
|
66
|
-
|
67
64
|
# @return [Hash] The known file types corresponding to each extension.
|
68
65
|
#
|
69
66
|
FILE_TYPES_BY_EXTENSION = {
|
@@ -216,6 +213,13 @@ module Xcodeproj
|
|
216
213
|
:plug_ins => '13',
|
217
214
|
}.freeze
|
218
215
|
|
216
|
+
# @return [Hash] The corresponding numeric value of each proxy type for
|
217
|
+
# PBXContainerItemProxy.
|
218
|
+
PROXY_TYPES = {
|
219
|
+
:native_target => '1',
|
220
|
+
:reference => '2',
|
221
|
+
}.freeze
|
222
|
+
|
219
223
|
# @return [Hash] The extensions which are associated with header files.
|
220
224
|
#
|
221
225
|
HEADER_FILES_EXTENSIONS = %w(.h .hh .hpp .ipp).freeze
|
@@ -37,6 +37,7 @@ module Xcodeproj
|
|
37
37
|
raise TypeError, "The given `#{path}` must be a string or 'pathname'."
|
38
38
|
end
|
39
39
|
path = path.to_s
|
40
|
+
raise IOError, 'Empty path.' if path == ''
|
40
41
|
|
41
42
|
CoreFoundation.RubyHashPropertyListWrite(hash, path)
|
42
43
|
end
|
@@ -52,45 +53,22 @@ module Xcodeproj
|
|
52
53
|
unless File.exist?(path)
|
53
54
|
raise ArgumentError, "The plist file at path `#{path}` doesn't exist."
|
54
55
|
end
|
56
|
+
if file_in_conflict?(path)
|
57
|
+
raise ArgumentError, "The file `#{path}` is in a merge conflict"
|
58
|
+
end
|
55
59
|
CoreFoundation.RubyHashPropertyListRead(path)
|
56
60
|
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
61
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# @
|
64
|
-
#
|
65
|
-
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
unless defined?(SIZEOF_INTPTR_T)
|
74
|
-
require 'dl'
|
75
|
-
SIZEOF_INTPTR_T = DL::SIZEOF_VOIDP
|
76
|
-
end
|
77
|
-
|
78
|
-
unless defined?(Handle)
|
79
|
-
require 'dl'
|
80
|
-
Handle = DL::Handle
|
81
|
-
end
|
82
|
-
|
83
|
-
unless respond_to?(:dlopen)
|
84
|
-
require 'dl'
|
85
|
-
def self.dlopen(library)
|
86
|
-
DL.dlopen(library)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
class Function
|
91
|
-
unless public_method_defined?(:to_i)
|
92
|
-
def to_i
|
93
|
-
@ptr.to_i
|
62
|
+
# @return [Bool] Checks whether there are merge conflicts in the file.
|
63
|
+
#
|
64
|
+
# @param [#to_s] path
|
65
|
+
# The path of the file.
|
66
|
+
#
|
67
|
+
def file_in_conflict?(path)
|
68
|
+
file = File.open(path)
|
69
|
+
file.each_line.any? { |l| l.match(/^(<|=|>){7}/) }
|
70
|
+
ensure
|
71
|
+
file.close
|
94
72
|
end
|
95
73
|
end
|
96
74
|
end
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -471,14 +471,10 @@ require 'xcodeproj/project/object_list'
|
|
471
471
|
|
472
472
|
# Required because some classes have cyclical references to each other.
|
473
473
|
#
|
474
|
-
# In ruby 1.8.7 the hash are not sorted so it is necessary to use an array to
|
475
|
-
# preserve the proper loading order of the various super classes.
|
476
|
-
#
|
477
474
|
# @todo I'm sure that there is a method to achieve the same result which
|
478
475
|
# doesn't present the risk of some rubist laughing at me :-)
|
479
476
|
#
|
480
|
-
Xcodeproj::Constants::
|
481
|
-
isas = Xcodeproj::Constants::KNOWN_ISAS[superclass_name]
|
477
|
+
Xcodeproj::Constants::KNOWN_ISAS.each do |superclass_name, isas|
|
482
478
|
superklass = Xcodeproj::Project::Object.const_get(superclass_name)
|
483
479
|
isas.each do |isa|
|
484
480
|
c = Class.new(superklass)
|
@@ -195,6 +195,31 @@ module Xcodeproj
|
|
195
195
|
# copied to.
|
196
196
|
#
|
197
197
|
attribute :dst_subfolder_spec, String, Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[:resources]
|
198
|
+
|
199
|
+
# Alias method for #dst_subfolder_spec=, which accepts symbol values
|
200
|
+
# instead of numeric string values.
|
201
|
+
#
|
202
|
+
# @param [Symbol] value
|
203
|
+
# one of `COPY_FILES_BUILD_PHASE_DESTINATIONS.keys`
|
204
|
+
#
|
205
|
+
# @raise [StandardError] if value is not a valid known key
|
206
|
+
#
|
207
|
+
def symbol_dst_subfolder_spec=(value)
|
208
|
+
numeric_value = Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[value]
|
209
|
+
raise "[Xcodeproj] Value checking error: got `#{value.inspect}` for" \
|
210
|
+
' attribute: dst_subfolder_spec' if numeric_value.nil?
|
211
|
+
self.dst_subfolder_spec = numeric_value
|
212
|
+
end
|
213
|
+
|
214
|
+
# Alias method for #dst_subfolder_spec, which returns symbol values
|
215
|
+
# instead of numeric string values.
|
216
|
+
#
|
217
|
+
# @return [Symbol]
|
218
|
+
#
|
219
|
+
def symbol_dst_subfolder_spec
|
220
|
+
key = Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS.find { |_, num| num == dst_subfolder_spec }
|
221
|
+
key ? key.first : nil
|
222
|
+
end
|
198
223
|
end
|
199
224
|
|
200
225
|
#-----------------------------------------------------------------------#
|
@@ -42,7 +42,7 @@ module Xcodeproj
|
|
42
42
|
|
43
43
|
# @return [String] the type of the proxy.
|
44
44
|
#
|
45
|
-
# @note {
|
45
|
+
# @note @see {Constants::PROXY_TYPE.values} for valid values.
|
46
46
|
#
|
47
47
|
attribute :proxy_type, String
|
48
48
|
|
@@ -65,6 +65,28 @@ module Xcodeproj
|
|
65
65
|
# the proxy.
|
66
66
|
#
|
67
67
|
attribute :remote_info, String
|
68
|
+
|
69
|
+
# Checks whether the reference points to a remote project.
|
70
|
+
#
|
71
|
+
# @return [Bool]
|
72
|
+
#
|
73
|
+
def remote?
|
74
|
+
project.root_object.uuid != container_portal
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the proxied object
|
78
|
+
#
|
79
|
+
# @return [AbstractObject]
|
80
|
+
#
|
81
|
+
def proxied_object
|
82
|
+
if remote?
|
83
|
+
container_portal_file_ref = project.objects_by_uuid[container_portal]
|
84
|
+
container_portal_object = Project.open(container_portal_file_ref.real_path)
|
85
|
+
else
|
86
|
+
container_portal_object = project
|
87
|
+
end
|
88
|
+
container_portal_object.objects_by_uuid[remote_global_id_string]
|
89
|
+
end
|
68
90
|
end
|
69
91
|
end
|
70
92
|
end
|
@@ -184,7 +184,7 @@ module Xcodeproj
|
|
184
184
|
subproj.products_group.files.each do |product_reference|
|
185
185
|
container_proxy = group.project.new(PBXContainerItemProxy)
|
186
186
|
container_proxy.container_portal = ref.uuid
|
187
|
-
container_proxy.proxy_type =
|
187
|
+
container_proxy.proxy_type = Constants::PROXY_TYPES[:reference]
|
188
188
|
container_proxy.remote_global_id_string = product_reference.uuid
|
189
189
|
container_proxy.remote_info = 'Subproject'
|
190
190
|
|
@@ -194,7 +194,7 @@ module Xcodeproj
|
|
194
194
|
# @return [void]
|
195
195
|
#
|
196
196
|
def add_dependency(target)
|
197
|
-
unless
|
197
|
+
unless dependency_for_target(target)
|
198
198
|
container_proxy = project.new(Xcodeproj::Project::PBXContainerItemProxy)
|
199
199
|
if target.project == project
|
200
200
|
container_proxy.container_portal = project.root_object.uuid
|
@@ -203,18 +203,36 @@ module Xcodeproj
|
|
203
203
|
raise ArgumentError, 'add_dependency got target that belongs to a project is not this project and is not a subproject of this project' unless subproject_reference
|
204
204
|
container_proxy.container_portal = subproject_reference.uuid
|
205
205
|
end
|
206
|
-
container_proxy.proxy_type =
|
206
|
+
container_proxy.proxy_type = Constants::PROXY_TYPES[:native_target]
|
207
207
|
container_proxy.remote_global_id_string = target.uuid
|
208
208
|
container_proxy.remote_info = target.name
|
209
209
|
|
210
210
|
dependency = project.new(Xcodeproj::Project::PBXTargetDependency)
|
211
|
-
dependency.
|
211
|
+
dependency.name = target.name
|
212
|
+
dependency.target = target if target.project == project
|
212
213
|
dependency.target_proxy = container_proxy
|
213
214
|
|
214
215
|
dependencies << dependency
|
215
216
|
end
|
216
217
|
end
|
217
218
|
|
219
|
+
# Checks whether this target has a dependency on the given target.
|
220
|
+
#
|
221
|
+
# @param [AbstractTarget] target
|
222
|
+
# the target to search for.
|
223
|
+
#
|
224
|
+
# @return [PBXTargetDependency]
|
225
|
+
#
|
226
|
+
def dependency_for_target(target)
|
227
|
+
dependencies.find do |dep|
|
228
|
+
if dep.target_proxy.remote?
|
229
|
+
dep.target_proxy.remote_global_id_string == target.uuid
|
230
|
+
else
|
231
|
+
dep.target == target
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
218
236
|
# Creates a new copy files build phase.
|
219
237
|
#
|
220
238
|
# @param [String] name
|
@@ -382,10 +400,12 @@ module Xcodeproj
|
|
382
400
|
# @param [Hash{String=>String}] compiler_flags
|
383
401
|
# the compiler flags for the source files.
|
384
402
|
#
|
385
|
-
# @
|
403
|
+
# @yield_param [PBXBuildFile] each created build file.
|
404
|
+
#
|
405
|
+
# @return [Array<PBXBuildFile>] the created build files.
|
386
406
|
#
|
387
407
|
def add_file_references(file_references, compiler_flags = {})
|
388
|
-
file_references.
|
408
|
+
file_references.map do |file|
|
389
409
|
build_file = project.new(PBXBuildFile)
|
390
410
|
build_file.file_ref = file
|
391
411
|
|
@@ -399,6 +419,10 @@ module Xcodeproj
|
|
399
419
|
end
|
400
420
|
source_build_phase.files << build_file
|
401
421
|
end
|
422
|
+
|
423
|
+
yield build_file if block_given?
|
424
|
+
|
425
|
+
build_file
|
402
426
|
end
|
403
427
|
end
|
404
428
|
|
@@ -424,19 +448,7 @@ module Xcodeproj
|
|
424
448
|
# @return [PBXHeadersBuildPhase] the headers build phase.
|
425
449
|
#
|
426
450
|
def headers_build_phase
|
427
|
-
|
428
|
-
headers_build_phase = build_phases.find { |bp| bp.class == PBXHeadersBuildPhase }
|
429
|
-
unless headers_build_phase
|
430
|
-
# Working around a bug in Xcode 4.2 betas, remove this once the
|
431
|
-
# Xcode bug is fixed:
|
432
|
-
# https://github.com/alloy/cocoapods/issues/13
|
433
|
-
# phase = copy_header_phase || headers_build_phases.first
|
434
|
-
headers_build_phase = project.new(PBXHeadersBuildPhase)
|
435
|
-
build_phases << headers_build_phase
|
436
|
-
end
|
437
|
-
@headers_build_phase = headers_build_phase
|
438
|
-
end
|
439
|
-
@headers_build_phase
|
451
|
+
find_or_create_build_phase_by_class(PBXHeadersBuildPhase)
|
440
452
|
end
|
441
453
|
|
442
454
|
# Finds or creates the source build phase of the target.
|
@@ -446,15 +458,7 @@ module Xcodeproj
|
|
446
458
|
# @return [PBXSourcesBuildPhase] the source build phase.
|
447
459
|
#
|
448
460
|
def source_build_phase
|
449
|
-
|
450
|
-
source_build_phase = build_phases.find { |bp| bp.class == PBXSourcesBuildPhase }
|
451
|
-
unless source_build_phase
|
452
|
-
source_build_phase = project.new(PBXSourcesBuildPhase)
|
453
|
-
build_phases << source_build_phase
|
454
|
-
end
|
455
|
-
@source_build_phase = source_build_phase
|
456
|
-
end
|
457
|
-
@source_build_phase
|
461
|
+
find_or_create_build_phase_by_class(PBXSourcesBuildPhase)
|
458
462
|
end
|
459
463
|
|
460
464
|
# Finds or creates the frameworks build phase of the target.
|
@@ -464,12 +468,7 @@ module Xcodeproj
|
|
464
468
|
# @return [PBXFrameworksBuildPhase] the frameworks build phase.
|
465
469
|
#
|
466
470
|
def frameworks_build_phase
|
467
|
-
|
468
|
-
unless phase
|
469
|
-
phase = project.new(PBXFrameworksBuildPhase)
|
470
|
-
build_phases << phase
|
471
|
-
end
|
472
|
-
phase
|
471
|
+
find_or_create_build_phase_by_class(PBXFrameworksBuildPhase)
|
473
472
|
end
|
474
473
|
|
475
474
|
# Finds or creates the resources build phase of the target.
|
@@ -479,12 +478,27 @@ module Xcodeproj
|
|
479
478
|
# @return [PBXResourcesBuildPhase] the resources build phase.
|
480
479
|
#
|
481
480
|
def resources_build_phase
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
481
|
+
find_or_create_build_phase_by_class(PBXResourcesBuildPhase)
|
482
|
+
end
|
483
|
+
|
484
|
+
private
|
485
|
+
|
486
|
+
# @!group Internal Helpers
|
487
|
+
#--------------------------------------#
|
488
|
+
|
489
|
+
# Find or create a build phase by a given class
|
490
|
+
#
|
491
|
+
# @param [Class] phase_class the class of the build phase to find or create.
|
492
|
+
#
|
493
|
+
# @return [AbstractBuildPhase] the build phase whose class match the given phase_class.
|
494
|
+
#
|
495
|
+
def find_or_create_build_phase_by_class(phase_class)
|
496
|
+
@phases ||= {}
|
497
|
+
unless phase_class < AbstractBuildPhase
|
498
|
+
raise ArgumentError, "#{phase_class} must be a subclass of #{AbstractBuildPhase.class}"
|
486
499
|
end
|
487
|
-
|
500
|
+
@phases[phase_class] ||= build_phases.find { |bp| bp.class == phase_class } \
|
501
|
+
|| project.new(phase_class).tap { |bp| build_phases << bp }
|
488
502
|
end
|
489
503
|
|
490
504
|
public
|
@@ -9,6 +9,10 @@ module Xcodeproj
|
|
9
9
|
class PBXReferenceProxy < AbstractObject
|
10
10
|
# @!group Attributes
|
11
11
|
|
12
|
+
# @return [String] the name of the reference.
|
13
|
+
#
|
14
|
+
attribute :name, String
|
15
|
+
|
12
16
|
# @return [String] the path of the referenced filed.
|
13
17
|
#
|
14
18
|
attribute :path, String
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodeproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -49,7 +49,6 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- README.md
|
51
51
|
- LICENSE
|
52
|
-
- ext/xcodeproj/xcodeproj_ext.bundle
|
53
52
|
- lib/xcodeproj/command/project_diff.rb
|
54
53
|
- lib/xcodeproj/command/show.rb
|
55
54
|
- lib/xcodeproj/command/sort.rb
|
@@ -59,7 +58,6 @@ files:
|
|
59
58
|
- lib/xcodeproj/config.rb
|
60
59
|
- lib/xcodeproj/constants.rb
|
61
60
|
- lib/xcodeproj/differ.rb
|
62
|
-
- lib/xcodeproj/ext.rb
|
63
61
|
- lib/xcodeproj/gem_version.rb
|
64
62
|
- lib/xcodeproj/helper.rb
|
65
63
|
- lib/xcodeproj/plist_helper.rb
|
@@ -104,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
102
|
requirements:
|
105
103
|
- - '>='
|
106
104
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
105
|
+
version: 2.0.0
|
108
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
107
|
requirements:
|
110
108
|
- - '>='
|
Binary file
|
data/lib/xcodeproj/ext.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'xcodeproj/plist_helper'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rbconfig'
|
5
|
-
if RUBY_VERSION == '1.8.7' && RbConfig::CONFIG['prefix'] =~ %r{^/System/Library/Frameworks/Ruby.framework/}
|
6
|
-
$:.unshift(File.expand_path('../../../ext', __FILE__))
|
7
|
-
require 'xcodeproj/xcodeproj_ext'
|
8
|
-
else
|
9
|
-
raise 'The xcodeproj gem is only supported on Ruby versions that include' \
|
10
|
-
'the Fiddle API or with Ruby 1.8.7 that came with OS X 10.8.x.'
|
11
|
-
end
|
12
|
-
end
|