xcodeproj 0.12.0 → 0.13.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: f165be51aaefe9f3f60310905c4a81e9c01d7868
4
- data.tar.gz: 9f07f26df8ac52efd7b8f7f3f922113d13c2f077
3
+ metadata.gz: 758b380d1a1b1be6189e2aaad39dd5b5e8bc21a8
4
+ data.tar.gz: dbff6c8152af77a624432d9f63c19452146e8db3
5
5
  SHA512:
6
- metadata.gz: e4059f10f78ab4dcd313288657e33684bf535d57a4ae8c6060b044a1e435d1f8d7d57263dcdf80b891b86dd61ce146754302aadf7ac48795858448386b9e056b
7
- data.tar.gz: d8c324cc0aace1bc07dbcca1996bb8ea269024093b5d4f28139cc36856174201612d8d87d0bd457a5ac27f4b6bc84a40bea62df1c82be768779570da1ece7d0d
6
+ metadata.gz: d5ccf1647397824c714e6a089563864687f2a9d6941981f226e3e699d4cf88e400d5cb922b24856129158ff298d370d00e49112523381beaf9245951fdc75461
7
+ data.tar.gz: e18c4f8367e934160bba7b4264f9f2a4599acf81e735cf59052377982d907070b52a32c913ad9aaa3ca64c943e4f14b17bf839b253bf0e624df8f3596b9790ee
@@ -1,6 +1,6 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '0.12.0' unless defined? Xcodeproj::VERSION
4
+ VERSION = '0.13.0' unless defined? Xcodeproj::VERSION
5
5
  end
6
6
 
@@ -41,12 +41,6 @@ module Xcodeproj
41
41
  { name => data }
42
42
  end
43
43
 
44
-
45
- public
46
-
47
- # @!group Helpers
48
- # --------------------------------------------------------------------#
49
-
50
44
  # Sorts the build settings. Valid only in Ruby > 1.9.2 because in
51
45
  # previous versions the hash are not sorted.
52
46
  #
@@ -48,7 +48,7 @@ module Xcodeproj
48
48
  # the given name.
49
49
  #
50
50
  # @param [String] build_configuration_name
51
- # the name of the build configuration.
51
+ # The name of the build configuration.
52
52
  #
53
53
  # @return [Hash {String=>String}] the build settings
54
54
  #
@@ -58,6 +58,40 @@ module Xcodeproj
58
58
  end
59
59
  end
60
60
 
61
+ # Gets the value for the given build setting in all the build
62
+ # configurations.
63
+ #
64
+ # @param [String] key
65
+ # the key of the build setting.
66
+ #
67
+ # @return [Hash{String => String}] The value of the build setting
68
+ # grouped by the name of the build configuration.
69
+ #
70
+ def get_setting(key)
71
+ result = {}
72
+ build_configurations.each do |bc|
73
+ result[bc.name] = bc.build_settings[key]
74
+ end
75
+ result
76
+ end
77
+
78
+ # Sets the given value for the build setting associated with the given
79
+ # key across all the build configurations.
80
+ #
81
+ # @param [String] key
82
+ # the key of the build setting.
83
+ #
84
+ # @param [String] value
85
+ # the value for the build setting.
86
+ #
87
+ # @return [void]
88
+ #
89
+ def set_setting(key, value)
90
+ build_configurations.each do |bc|
91
+ bc.build_settings[key] = value
92
+ end
93
+ end
94
+
61
95
  #---------------------------------------------------------------------#
62
96
 
63
97
  end
@@ -37,11 +37,51 @@ module Xcodeproj
37
37
  # @!group Helpers
38
38
  #--------------------------------------#
39
39
 
40
+ # Gets the value for the given build setting in all the build
41
+ # configurations or the value inheriting the value from the project
42
+ # ones if needed.
43
+ #
44
+ # @param [String] key
45
+ # the key of the build setting.
46
+ #
47
+ # @return [Hash{String => String}] The value of the build setting
48
+ # grouped by the name of the build configuration.
49
+ #
50
+ # TODO: Full support for this would require to take into account
51
+ # any associated xcconfig and the default values for the
52
+ # platform.
53
+ #
54
+ def resolved_build_setting(key)
55
+ target_settings = build_configuration_list.get_setting(key)
56
+ project_settings = project.build_configuration_list.get_setting(key)
57
+ target_settings.merge(project_settings) do |key, target_val, proj_val|
58
+ target_val || proj_val
59
+ end
60
+ end
61
+
62
+ # Gets the value for the given build setting, properly inherited if
63
+ # need, if shared across the build configurations.
64
+ #
65
+ # @param [String] key
66
+ # the key of the build setting.
67
+ #
68
+ # @raise If the build setting has multiple values.
69
+ #
70
+ # @return [String] The value of the build setting.
71
+ #
72
+ def common_resolved_build_setting(key)
73
+ values = resolved_build_setting(key).values.uniq
74
+ if values.count == 1
75
+ values.first
76
+ else
77
+ raise "Build setting `#{key}` has multiple values: `#{resolved_build_setting(key)}`"
78
+ end
79
+ end
80
+
40
81
  # @return [String] the SDK that the target should use.
41
82
  #
42
83
  def sdk
43
- build_configurations.first.build_settings['SDKROOT'] \
44
- || project.build_configurations.first.build_settings['SDKROOT']
84
+ common_resolved_build_setting('SDKROOT')
45
85
  end
46
86
 
47
87
  # @return [Symbol] the name of the platform of the target.
@@ -63,11 +103,9 @@ module Xcodeproj
63
103
  #
64
104
  def deployment_target
65
105
  if platform_name == :ios
66
- build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] ||
67
- project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
106
+ common_resolved_build_setting('IPHONEOS_DEPLOYMENT_TARGET')
68
107
  else
69
- build_configurations.first.build_settings['MACOSX_DEPLOYMENT_TARGET'] ||
70
- project.build_configurations.first.build_settings['MACOSX_DEPLOYMENT_TARGET']
108
+ common_resolved_build_setting('MACOSX_DEPLOYMENT_TARGET')
71
109
  end
72
110
  end
73
111
 
@@ -495,6 +495,13 @@ module Xcodeproj
495
495
  main_group['Frameworks'] || main_group.new_group('Frameworks')
496
496
  end
497
497
 
498
+ # @return [ObjectList<XCConfigurationList>] The build configuration list of
499
+ # the project.
500
+ #
501
+ def build_configuration_list
502
+ root_object.build_configuration_list
503
+ end
504
+
498
505
  # @return [ObjectList<XCBuildConfiguration>] A list of project wide
499
506
  # build configurations.
500
507
  #
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.12.0
4
+ version: 0.13.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: 2013-10-08 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport