xcodeproj 0.27.2 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b0f8d63361f82eb6bc44be2e0976a42bb971198
4
- data.tar.gz: 992549aadead9840e9b0625f93b1d07df5be2695
3
+ metadata.gz: c7d00b03edaadced305aa8777a0d05a924c03c0e
4
+ data.tar.gz: 0a68995ecb9c3345dd3551f16dc3870b4aa82cdd
5
5
  SHA512:
6
- metadata.gz: 2c21d709018ec479ccdb644149027e3b5bfc39a6341d3c3fe99f3ebcdbf63f7caee22c881914690cae59c53484f7082a3e79391c305b170df4c845338f010f31
7
- data.tar.gz: 32d2d5498206cbd37afdc008cea026ea885bce673ba4a5e30b9b7a167eebb8685b419a6585e420541d733e3732528d6c3a5d487daa63ddf018d0909b180b672a
6
+ metadata.gz: 7eebcc5974da2e09f13f8cf3502a4c6544681822bc8434e88c343aafd39cee71b34e7980e1a6756485c1ed2eb0d6f4fa96bcddb7dd5d7e1b5cb0f9038bebee0a
7
+ data.tar.gz: 040a7c2c88ceb88e0fa8184c9b8efbf67829558576751c82891f254d7bcdbc1e8b5a23c511e4073acdd6599f8391e3adae49bebe9faa7d3d38fa1a1ce685e9d3
@@ -4,13 +4,16 @@ module Xcodeproj
4
4
  module Constants
5
5
  # @return [String] The last known iOS SDK (stable).
6
6
  #
7
- LAST_KNOWN_IOS_SDK = '8.3'
7
+ LAST_KNOWN_IOS_SDK = '9.0'
8
8
 
9
9
  # @return [String] The last known OS X SDK (stable).
10
10
  #
11
- LAST_KNOWN_OSX_SDK = '10.10'
11
+ LAST_KNOWN_OSX_SDK = '10.11'
12
12
 
13
- # @return [String] The last known watchOS SDK (unstable).
13
+ # @return [String] The last known tvOS SDK (unstable).
14
+ LAST_KNOWN_TVOS_SDK = '9.0'
15
+
16
+ # @return [String] The last known watchOS SDK.
14
17
  LAST_KNOWN_WATCHOS_SDK = '2.0'
15
18
 
16
19
  # @return [String] The last known archive version to Xcodeproj.
@@ -150,6 +153,9 @@ module Xcodeproj
150
153
  [:osx] => {
151
154
  'SDKROOT' => 'macosx',
152
155
  }.freeze,
156
+ [:tvos] => {
157
+ 'SDKROOT' => 'appletvos',
158
+ }.freeze,
153
159
  [:watchos] => {
154
160
  'SDKROOT' => 'watchos',
155
161
  }.freeze,
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '0.27.2' unless defined? Xcodeproj::VERSION
4
+ VERSION = '0.28.0' unless defined? Xcodeproj::VERSION
5
5
  end
@@ -31,7 +31,7 @@ module Xcodeproj
31
31
  #
32
32
  def pretty_print
33
33
  data = {}
34
- data['Build Settings'] = build_settings
34
+ data['Build Settings'] = sorted_build_settings
35
35
  if base_configuration_reference
36
36
  data['Base Configuration'] = base_configuration_reference.pretty_print
37
37
  end
@@ -44,11 +44,19 @@ module Xcodeproj
44
44
  # @return [void]
45
45
  #
46
46
  def sort(_options = nil)
47
+ self.build_settings = sorted_build_settings
48
+ end
49
+
50
+ #---------------------------------------------------------------------#
51
+
52
+ private
53
+
54
+ def sorted_build_settings
47
55
  sorted = {}
48
56
  build_settings.keys.sort.each do |key|
49
57
  sorted[key] = build_settings[key]
50
58
  end
51
- self.build_settings = sorted
59
+ sorted
52
60
  end
53
61
 
54
62
  #---------------------------------------------------------------------#
@@ -11,7 +11,7 @@ module Xcodeproj
11
11
  def parent(object)
12
12
  referrers = object.referrers.uniq
13
13
  if referrers.count > 1
14
- referrers = referrers.select { |obj| obj.isa == 'PBXGroup' }
14
+ referrers = referrers.grep(PBXGroup)
15
15
  end
16
16
 
17
17
  if referrers.count == 0
@@ -94,6 +94,8 @@ module Xcodeproj
94
94
  :ios
95
95
  elsif sdk.include? 'macosx'
96
96
  :osx
97
+ elsif sdk.include? 'appletvos'
98
+ :tvos
97
99
  elsif sdk.include? 'watchos'
98
100
  :watchos
99
101
  end
@@ -113,6 +115,7 @@ module Xcodeproj
113
115
  case platform_name
114
116
  when :ios then common_resolved_build_setting('IPHONEOS_DEPLOYMENT_TARGET')
115
117
  when :osx then common_resolved_build_setting('MACOSX_DEPLOYMENT_TARGET')
118
+ when :tvos then common_resolved_build_setting('TVOS_DEPLOYMENT_TARGET')
116
119
  when :watchos then common_resolved_build_setting('WATCHOS_DEPLOYMENT_TARGET')
117
120
  end
118
121
  end
@@ -296,6 +299,10 @@ module Xcodeproj
296
299
  group = project.frameworks_group['OS X'] || project.frameworks_group.new_group('OS X')
297
300
  path_sdk_name = 'MacOSX'
298
301
  path_sdk_version = sdk_version || Constants::LAST_KNOWN_OSX_SDK
302
+ when :tvos
303
+ group = project.frameworks_group['tvOS'] || project.frameworks_group.new_group('tvOS')
304
+ path_sdk_name = 'AppleTVOS'
305
+ path_sdk_version = sdk_version || Constants::LAST_KNOWN_TVOS_SDK
299
306
  when :watchos
300
307
  group = project.frameworks_group['watchOS'] || project.frameworks_group.new_group('watchOS')
301
308
  path_sdk_name = 'WatchOS'
@@ -39,6 +39,19 @@ module Xcodeproj
39
39
  return target_proxy.remote_info if target_proxy
40
40
  end
41
41
 
42
+ # @note This override is necessary because Xcode allows for circular
43
+ # target dependencies.
44
+ #
45
+ # @return [Hash<String => String>] Returns a cascade representation of
46
+ # the object without UUIDs.
47
+ #
48
+ def to_tree_hash
49
+ hash = {}
50
+ hash['displayName'] = display_name
51
+ hash['isa'] = isa
52
+ hash
53
+ end
54
+
42
55
  # @note This is a no-op, because the targets could theoretically depend
43
56
  # on each other, leading to a stack level too deep error.
44
57
  #
@@ -237,6 +237,7 @@ module Xcodeproj
237
237
  case platform
238
238
  when :ios then settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
239
239
  when :osx then settings['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
240
+ when :tvos then settings['TVOS_DEPLOYMENT_TARGET'] = deployment_target
240
241
  when :watchos then settings['WATCHOS_DEPLOYMENT_TARGET'] = deployment_target
241
242
  end
242
243
  end
@@ -42,6 +42,7 @@ module Xcodeproj
42
42
 
43
43
  def generate_paths(object, path = '')
44
44
  existing = @paths_by_object[object] || path
45
+ return existing if @paths_by_object.key?(object)
45
46
  @paths_by_object[object] = path.size > existing.size ? path : existing
46
47
 
47
48
  object.to_one_attributes.each do |attrb|
@@ -245,6 +245,7 @@ module Xcodeproj
245
245
  if attributes
246
246
  klass = Object.const_get(attributes['isa'])
247
247
  object = klass.new(self, uuid)
248
+ objects_by_uuid[uuid] = object
248
249
  object.add_referrer(self) if root_object
249
250
  object.configure_with_plist(objects_by_uuid_plist)
250
251
  object
@@ -28,13 +28,27 @@ module Xcodeproj
28
28
  end
29
29
 
30
30
  # @param [Bool] flag
31
- # Set Whether this Test Action should use the same arguments and environment variables
31
+ # Set whether this Test Action should use the same arguments and environment variables
32
32
  # as the Launch Action.
33
33
  #
34
34
  def should_use_launch_scheme_args_env=(flag)
35
35
  @xml_element.attributes['shouldUseLaunchSchemeArgsEnv'] = bool_to_string(flag)
36
36
  end
37
37
 
38
+ # @return [Bool]
39
+ # Whether Clang Code Coverage is enabled ('Gather coverage data' turned ON)
40
+ #
41
+ def code_coverage_enabled?
42
+ string_to_bool(@xml_element.attributes['codeCoverageEnabled'])
43
+ end
44
+
45
+ # @rparam [Bool] flag
46
+ # Set whether Clang Code Coverage is enabled ('Gather coverage data' turned ON)
47
+ #
48
+ def code_coverage_enabled=(flag)
49
+ @xml_element.attributes['codeCoverageEnabled'] = bool_to_string(flag)
50
+ end
51
+
38
52
  # @return [Array<TestableReference>]
39
53
  # The list of TestableReference (test bundles) associated with this Test Action
40
54
  #
@@ -29,6 +29,7 @@ module Xcodeproj
29
29
  #
30
30
  def initialize(file_path = nil)
31
31
  if file_path
32
+ @file_path = file_path
32
33
  @doc = REXML::Document.new(File.new(file_path))
33
34
  @doc.context[:attribute_quote] = :quote
34
35
 
@@ -311,6 +312,19 @@ module Xcodeproj
311
312
  end
312
313
  end
313
314
 
315
+ # Serializes the current state of the object to the original ".xcscheme"
316
+ # file this XCScheme was created from, overriding the original file.
317
+ #
318
+ # Requires that the XCScheme object was initialized using a file path.
319
+ #
320
+ def save!
321
+ raise Informative, 'This XCScheme object was not initialized ' \
322
+ 'using a file path. Use save_as instead.' unless @file_path
323
+ File.open(@file_path, 'w') do |f|
324
+ f.write(to_s)
325
+ end
326
+ end
327
+
314
328
  #-------------------------------------------------------------------------#
315
329
 
316
330
  # XML formatter which closely mimics the output generated by Xcode.
@@ -20,6 +20,13 @@ module Xcodeproj
20
20
  versions_by_sdk[:osx].sort.last
21
21
  end
22
22
 
23
+ # @return [String] The version of the last tvOS sdk.
24
+ #
25
+ def last_tvos_sdk
26
+ parse_sdks_if_needed
27
+ versions_by_sdk[:tvos].sort.last
28
+ end
29
+
23
30
  # @return [String] The version of the last watchOS sdk.
24
31
  #
25
32
  def last_watchos_sdk
@@ -45,6 +52,7 @@ module Xcodeproj
45
52
  @versions_by_sdk = {}
46
53
  @versions_by_sdk[:osx] = []
47
54
  @versions_by_sdk[:ios] = []
55
+ @versions_by_sdk[:tvos] = []
48
56
  @versions_by_sdk[:watchos] = []
49
57
  if xcodebuild_available?
50
58
  sdks = parse_sdks_information(xcodebuild_sdks)
@@ -52,6 +60,7 @@ module Xcodeproj
52
60
  case
53
61
  when name == 'macosx' then @versions_by_sdk[:osx] << version
54
62
  when name == 'iphoneos' then @versions_by_sdk[:ios] << version
63
+ when name == 'appletvos' then @versions_by_sdk[:tvos] << version
55
64
  when name == 'watchos' then @versions_by_sdk[:watchos] << version
56
65
  end
57
66
  end
@@ -73,7 +82,7 @@ module Xcodeproj
73
82
  # is the name of the SDK and the second is the version.
74
83
  #
75
84
  def parse_sdks_information(output)
76
- output.scan(/-sdk (macosx|iphoneos|watchos)(.+\w)/)
85
+ output.scan(/-sdk (macosx|iphoneos|watchos|appletvos)(.+\w)/)
77
86
  end
78
87
 
79
88
  # @return [String] The sdk information reported by xcodebuild.
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.27.2
4
+ version: 0.28.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: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport