xcodeproj 1.3.3 → 1.4.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/gem_version.rb +1 -1
- data/lib/xcodeproj/plist.rb +25 -27
- data/lib/xcodeproj/project.rb +19 -1
- data/lib/xcodeproj/project/object.rb +25 -3
- data/lib/xcodeproj/project/object/build_configuration.rb +52 -0
- data/lib/xcodeproj/project/object/build_file.rb +4 -0
- data/lib/xcodeproj/project/object/build_phase.rb +8 -0
- data/lib/xcodeproj/project/object/build_rule.rb +4 -0
- data/lib/xcodeproj/project/object/configuration_list.rb +9 -0
- data/lib/xcodeproj/project/object/container_item_proxy.rb +26 -3
- data/lib/xcodeproj/project/object/file_reference.rb +7 -1
- data/lib/xcodeproj/project/object/group.rb +4 -0
- data/lib/xcodeproj/project/object/reference_proxy.rb +4 -0
- data/lib/xcodeproj/project/object/root_object.rb +14 -0
- data/lib/xcodeproj/project/object/target_dependency.rb +4 -0
- data/lib/xcodeproj/project/object_dictionary.rb +5 -1
- metadata +34 -11
- data/lib/xcodeproj/plist/ffi.rb +0 -153
- data/lib/xcodeproj/plist/ffi/chdir_override.rb +0 -27
- data/lib/xcodeproj/plist/ffi/core_foundation.rb +0 -441
- data/lib/xcodeproj/plist/ffi/dev_tools_core.rb +0 -194
- data/lib/xcodeproj/plist/plist_gem.rb +0 -27
@@ -1,194 +0,0 @@
|
|
1
|
-
require 'fiddle'
|
2
|
-
|
3
|
-
module Xcodeproj
|
4
|
-
module Plist
|
5
|
-
module FFI
|
6
|
-
module DevToolsCore
|
7
|
-
def self.silence_stderr
|
8
|
-
orig_stderr = $stderr.clone
|
9
|
-
$stderr.reopen File.new('/dev/null', 'w')
|
10
|
-
yield
|
11
|
-
ensure
|
12
|
-
$stderr.reopen orig_stderr
|
13
|
-
end
|
14
|
-
|
15
|
-
# rubocop:disable Style/MethodName
|
16
|
-
# rubocop:disable Style/VariableName
|
17
|
-
|
18
|
-
class NSObject
|
19
|
-
private
|
20
|
-
|
21
|
-
def self.objc_class
|
22
|
-
@objc_class ||= CoreFoundation.objc_getClass(name.split('::').last)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.image
|
26
|
-
@image ||= Fiddle::Handle.new
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.extern(symbol, parameter_types, return_type)
|
30
|
-
CoreFoundation.extern_image(image, symbol, parameter_types, return_type)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.objc_msgSend(args, return_type = CoreFoundation::VoidPointer)
|
34
|
-
arguments = [CoreFoundation::VoidPointer, CoreFoundation::VoidPointer] + args
|
35
|
-
|
36
|
-
Fiddle::Function.new(image['objc_msgSend'], arguments, return_type)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.respondsToSelector(instance, sel)
|
40
|
-
selector = CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(sel))
|
41
|
-
respondsToSelector = objc_msgSend([CoreFoundation::CharPointer], CoreFoundation::Boolean)
|
42
|
-
result = respondsToSelector.call(
|
43
|
-
instance,
|
44
|
-
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString('respondsToSelector:')),
|
45
|
-
selector)
|
46
|
-
result == CoreFoundation::TRUE ? true : false
|
47
|
-
end
|
48
|
-
|
49
|
-
Class = CoreFoundation::VoidPointer
|
50
|
-
ID = CoreFoundation::VoidPointer
|
51
|
-
SEL = CoreFoundation::VoidPointer
|
52
|
-
|
53
|
-
extern :NSSelectorFromString, [CoreFoundation::CFTypeRef], SEL
|
54
|
-
|
55
|
-
extern :objc_getClass, [CoreFoundation::CharPointer], Class
|
56
|
-
extern :class_getName, [Class], CoreFoundation::CharPointer
|
57
|
-
end
|
58
|
-
|
59
|
-
XCODE_PATH = Pathname.new(`xcrun xcode-select --print-path`.strip).dirname
|
60
|
-
XCODE_VERSION = Gem::Version.new(`xcodebuild -version`.split(' ')[1])
|
61
|
-
|
62
|
-
def self.load_xcode_framework(framework)
|
63
|
-
Fiddle.dlopen(XCODE_PATH.join(framework).to_s)
|
64
|
-
rescue Fiddle::DLError
|
65
|
-
nil
|
66
|
-
end
|
67
|
-
|
68
|
-
# @note The IB frameworks only seem to be necessary on Xcode 7+
|
69
|
-
#
|
70
|
-
def self.load_xcode_frameworks
|
71
|
-
is_80_or_later = XCODE_VERSION >= Gem::Version.new('8.0')
|
72
|
-
|
73
|
-
DevToolsCore.silence_stderr do
|
74
|
-
load_xcode_framework('SharedFrameworks/DVTFoundation.framework/DVTFoundation')
|
75
|
-
load_xcode_framework('SharedFrameworks/DVTServices.framework/DVTServices')
|
76
|
-
load_xcode_framework('SharedFrameworks/DVTPortal.framework/DVTPortal')
|
77
|
-
load_xcode_framework('SharedFrameworks/DVTSourceControl.framework/DVTSourceControl')
|
78
|
-
load_xcode_framework('SharedFrameworks/CSServiceClient.framework/CSServiceClient') unless is_80_or_later
|
79
|
-
load_xcode_framework('Frameworks/IBFoundation.framework/IBFoundation')
|
80
|
-
load_xcode_framework('Frameworks/IBAutolayoutFoundation.framework/IBAutolayoutFoundation')
|
81
|
-
if is_80_or_later
|
82
|
-
load_xcode_framework('SharedFrameworks/DVTAnalyticsClient.framework/DVTAnalyticsClient')
|
83
|
-
load_xcode_framework('SharedFrameworks/DVTAnalytics.framework/DVTAnalytics')
|
84
|
-
load_xcode_framework('SharedFrameworks/DVTDocumentation.framework/DVTDocumentation')
|
85
|
-
load_xcode_framework('SharedFrameworks/SourceKit.framework/SourceKit')
|
86
|
-
end
|
87
|
-
load_xcode_framework('Frameworks/IDEFoundation.framework/IDEFoundation')
|
88
|
-
load_xcode_framework('PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core')
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
class CFDictionary < NSObject
|
93
|
-
public
|
94
|
-
|
95
|
-
def initialize(dictionary)
|
96
|
-
@dictionary = dictionary
|
97
|
-
end
|
98
|
-
|
99
|
-
def plistDescriptionUTF8Data
|
100
|
-
selector = 'plistDescriptionUTF8Data'
|
101
|
-
return nil unless NSObject.respondsToSelector(@dictionary, selector)
|
102
|
-
|
103
|
-
plistDescriptionUTF8Data = CFDictionary.objc_msgSend([])
|
104
|
-
plistDescriptionUTF8Data.call(
|
105
|
-
@dictionary,
|
106
|
-
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)))
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.image
|
110
|
-
@image ||= DevToolsCore.load_xcode_frameworks
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class NSData < NSObject
|
115
|
-
public
|
116
|
-
|
117
|
-
def initialize(data)
|
118
|
-
@data = data
|
119
|
-
end
|
120
|
-
|
121
|
-
def writeToFileAtomically(path)
|
122
|
-
selector = 'writeToFile:atomically:'
|
123
|
-
return false unless NSObject.respondsToSelector(@data, selector)
|
124
|
-
|
125
|
-
writeToFileAtomically = NSData.objc_msgSend([CoreFoundation::VoidPointer, CoreFoundation::Boolean], CoreFoundation::Boolean)
|
126
|
-
result = writeToFileAtomically.call(
|
127
|
-
@data,
|
128
|
-
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
129
|
-
CoreFoundation.RubyStringToCFString(path),
|
130
|
-
1)
|
131
|
-
result == CoreFoundation::TRUE ? true : false
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
class PBXProject < NSObject
|
136
|
-
public
|
137
|
-
|
138
|
-
def initialize(path)
|
139
|
-
DevToolsCore.silence_stderr do
|
140
|
-
CoreFoundation.IDEInitialize(1, CoreFoundation::NULL)
|
141
|
-
|
142
|
-
# The parameter is whether UI must be initialized (which we don't need)
|
143
|
-
CoreFoundation.XCInitializeCoreIfNeeded(0)
|
144
|
-
end
|
145
|
-
|
146
|
-
selector = 'projectWithFile:'
|
147
|
-
|
148
|
-
if NSObject.respondsToSelector(PBXProject.objc_class, selector)
|
149
|
-
projectWithFile = PBXProject.objc_msgSend([CoreFoundation::VoidPointer])
|
150
|
-
@project = projectWithFile.call(
|
151
|
-
PBXProject.objc_class,
|
152
|
-
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
153
|
-
CoreFoundation.RubyStringToCFString(path))
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def close
|
158
|
-
selector = 'close'
|
159
|
-
return unless NSObject.respondsToSelector(@project, selector)
|
160
|
-
|
161
|
-
close = PBXProject.objc_msgSend([], CoreFoundation::Void)
|
162
|
-
close.call(@project, CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)))
|
163
|
-
end
|
164
|
-
|
165
|
-
def writeToFileSystemProjectFile
|
166
|
-
selector = 'writeToFileSystemProjectFile:userFile:checkNeedsRevert:'
|
167
|
-
return unless NSObject.respondsToSelector(@project, selector)
|
168
|
-
|
169
|
-
writeToFile = PBXProject.objc_msgSend([CoreFoundation::Boolean, CoreFoundation::Boolean, CoreFoundation::Boolean], CoreFoundation::Boolean)
|
170
|
-
result = writeToFile.call(
|
171
|
-
@project,
|
172
|
-
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
173
|
-
1,
|
174
|
-
0,
|
175
|
-
1)
|
176
|
-
result == CoreFoundation::TRUE ? true : false
|
177
|
-
end
|
178
|
-
|
179
|
-
private
|
180
|
-
|
181
|
-
def self.image
|
182
|
-
@image ||= DevToolsCore.load_xcode_frameworks
|
183
|
-
end
|
184
|
-
|
185
|
-
extern :IDEInitialize, [CoreFoundation::Boolean, ID], CoreFoundation::Void
|
186
|
-
extern :XCInitializeCoreIfNeeded, [CoreFoundation::Boolean], CoreFoundation::Void
|
187
|
-
end
|
188
|
-
|
189
|
-
# rubocop:enable Style/MethodName
|
190
|
-
# rubocop:enable Style/VariableName
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Xcodeproj
|
2
|
-
module Plist
|
3
|
-
# @visibility private
|
4
|
-
module PlistGem
|
5
|
-
def self.attempt_to_load!
|
6
|
-
return @attempt_to_load if defined?(@attempt_to_load)
|
7
|
-
@attempt_to_load = begin
|
8
|
-
require 'plist/parser'
|
9
|
-
require 'plist/generator'
|
10
|
-
nil
|
11
|
-
rescue LoadError
|
12
|
-
'Xcodeproj relies on a library called `plist` to read and write ' \
|
13
|
-
'Xcode project files. Ensure you have the `plist` gem installed ' \
|
14
|
-
'and try again.'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.write_to_path(hash, path)
|
19
|
-
::Plist::Emit.save_plist(hash, path)
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.read_from_path(path)
|
23
|
-
::Plist.parse_xml(path)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|