xcodeproj 1.3.0 → 1.3.1
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/constants.rb +1 -1
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/plist/ffi.rb +66 -6
- data/lib/xcodeproj/plist/ffi/dev_tools_core.rb +5 -8
- data/lib/xcodeproj/project.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80889f1543d932a364554166034555b0838ab081
|
4
|
+
data.tar.gz: 67b60068200d0226b81fb02441ad0a61919588b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a9cbd8cdece69a9118f93eaebccf888448db9bd67c3af3e7fa0cc0375339ae70683d48a3db6af5c4f1df44726e13da47f9f41119bc6ef5d7483d0e64a7e852
|
7
|
+
data.tar.gz: 7f96eb1680c4ad7e70cb9318266204fb03e88f81bfda553420bef222b93ab01043a7204f47efed0e89ee3b6c6f1ff100b92b90408a85c117a5dbf01744c22358
|
data/lib/xcodeproj/constants.rb
CHANGED
data/lib/xcodeproj/plist/ffi.rb
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
module Xcodeproj
|
2
2
|
module Plist
|
3
|
+
module Extensions
|
4
|
+
# Since Xcode 8 beta 4, calling `PBXProject.projectWithFile` breaks subsequent calls to
|
5
|
+
# `chdir`. While sounding ridiculous, this is unfortunately true and debugging it from the
|
6
|
+
# userland side showed no difference at all to successful calls to `chdir`, but the working
|
7
|
+
# directory is simply not changed in the end. This workaround is even more absurd, monkey
|
8
|
+
# patching all calls to `chdir` to use `__pthread_chdir` which appears to work.
|
9
|
+
module Dir
|
10
|
+
def self.chdir(path)
|
11
|
+
old_dir = Dir.getwd
|
12
|
+
res = actually_chdir(path)
|
13
|
+
|
14
|
+
if block_given?
|
15
|
+
begin
|
16
|
+
return yield
|
17
|
+
ensure
|
18
|
+
actually_chdir(old_dir)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
res
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.actually_chdir(path)
|
26
|
+
libc = Fiddle.dlopen '/usr/lib/libc.dylib'
|
27
|
+
f = Fiddle::Function.new(libc['__pthread_chdir'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT)
|
28
|
+
f.call(path.to_s)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
3
33
|
# Provides support for loading and serializing property list files via
|
4
34
|
# Fiddle and CoreFoundation / Xcode.
|
5
35
|
#
|
@@ -36,9 +66,12 @@ module Xcodeproj
|
|
36
66
|
def write_to_path(hash, path)
|
37
67
|
raise ThreadError, 'Can only write plists from the main thread.' unless Thread.current == Thread.main
|
38
68
|
|
39
|
-
|
40
|
-
|
41
|
-
|
69
|
+
path = File.expand_path(path)
|
70
|
+
|
71
|
+
should_fork = ENV['FORK_XCODE_WRITING']
|
72
|
+
success = ruby_hash_write_xcode(hash, path, should_fork)
|
73
|
+
|
74
|
+
unless success
|
42
75
|
CoreFoundation.RubyHashPropertyListWrite(hash, path)
|
43
76
|
fix_encoding(path)
|
44
77
|
end
|
@@ -95,8 +128,31 @@ module Xcodeproj
|
|
95
128
|
# @param [String] path
|
96
129
|
# The path of the file.
|
97
130
|
#
|
98
|
-
def ruby_hash_write_xcode(hash, path)
|
99
|
-
|
131
|
+
def ruby_hash_write_xcode(hash, path, should_fork)
|
132
|
+
return false unless path.end_with?('pbxproj')
|
133
|
+
if should_fork
|
134
|
+
require 'open3'
|
135
|
+
_output, status = Open3.capture2e(Gem.ruby, '-e', <<-RUBY, path, :stdin_data => Marshal.dump(hash))
|
136
|
+
$LOAD_PATH.replace #{$LOAD_PATH}
|
137
|
+
path = ARGV.first
|
138
|
+
hash = Marshal.load(STDIN)
|
139
|
+
require "xcodeproj"
|
140
|
+
require "xcodeproj/plist/ffi"
|
141
|
+
ffi = Xcodeproj::Plist::FFI
|
142
|
+
success = ffi::DevToolsCore.load_xcode_frameworks && ffi.send(:ruby_hash_write_devtoolscore, hash, path)
|
143
|
+
exit(success ? 0 : 1)
|
144
|
+
RUBY
|
145
|
+
|
146
|
+
status.success?
|
147
|
+
else
|
148
|
+
monkey_patch_chdir
|
149
|
+
success = DevToolsCore.load_xcode_frameworks && ruby_hash_write_devtoolscore(hash, path)
|
150
|
+
|
151
|
+
success
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def ruby_hash_write_devtoolscore(hash, path)
|
100
156
|
success = true
|
101
157
|
|
102
158
|
begin
|
@@ -111,7 +167,11 @@ module Xcodeproj
|
|
111
167
|
success = false
|
112
168
|
end
|
113
169
|
|
114
|
-
|
170
|
+
success
|
171
|
+
end
|
172
|
+
|
173
|
+
def monkey_patch_chdir
|
174
|
+
Dir.send(:include, Extensions::Dir)
|
115
175
|
end
|
116
176
|
end
|
117
177
|
end
|
@@ -5,14 +5,11 @@ module Xcodeproj
|
|
5
5
|
module FFI
|
6
6
|
module DevToolsCore
|
7
7
|
def self.silence_stderr
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
$stderr.reopen orig_stderr
|
14
|
-
end
|
15
|
-
retval
|
8
|
+
orig_stderr = $stderr.clone
|
9
|
+
$stderr.reopen File.new('/dev/null', 'w')
|
10
|
+
yield
|
11
|
+
ensure
|
12
|
+
$stderr.reopen orig_stderr
|
16
13
|
end
|
17
14
|
|
18
15
|
# rubocop:disable Style/MethodName
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -216,6 +216,7 @@ module Xcodeproj
|
|
216
216
|
if object_version.to_i > Constants::LAST_KNOWN_OBJECT_VERSION
|
217
217
|
raise '[Xcodeproj] Unknown object version.'
|
218
218
|
end
|
219
|
+
root_object.product_ref_group = root_object.main_group['Products'] || root_object.main_group.new_group('Products')
|
219
220
|
end
|
220
221
|
|
221
222
|
public
|
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: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|