xcodeproj 0.13.1 → 0.14.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
- ---
2
- SHA1:
3
- metadata.gz: a6d41966c286020a61f2c4949fa22b2482db9036
4
- data.tar.gz: 4d8ca5070e741ca5026c55730625b14025c3b0a2
5
- SHA512:
6
- metadata.gz: 0b032960ff420b5922f581cb18d1e4b0632890f107a0a91e2f9cb6ed571eee0cf9201b3a5e9fb921d28ae3c325086717ddd534219070b6e5b05c94ca51f7b89e
7
- data.tar.gz: b3f72482cdd5fedc0769f878d51b8119e386bfd7e466a34246527598b1968c4cbce10e63efce4ab488df97966b75b2d922121490f4fb7967f2367d9e8db0dddf
1
+ ---
2
+ SHA512:
3
+ metadata.gz: 351a1fb41b97253c60d3c98cb49f40afd0a9524bf7f32d2f4980ef7e1bd79917b01ad1f1c9744e5a0a28dc6c4be72d6a936e316ae8a9d69ffaa739184c8870ab
4
+ data.tar.gz: 670743ec71585ed4947346781d55c367a9268b51e85abb8baebd24edf44e06b70998c9094da7b40023b085582b8069a5d0ae2d3370c0977b8248b7c4b9b8a682
5
+ SHA1:
6
+ metadata.gz: 46aff37bf34d1243b63df3624720605bfe432430
7
+ data.tar.gz: e34469dacd968ad842532427b7c44620bd767455
@@ -0,0 +1,36 @@
1
+ desc 'Creates a Makefile only if needed. (Explicitly control with XCODEPROJ_BUILD)'
2
+ task :ext do
3
+ use_prebuilt = case ENV['XCODEPROJ_BUILD']
4
+ when '1'
5
+ false
6
+ when '0'
7
+ true
8
+ else
9
+ require 'rbconfig'
10
+ if RbConfig::CONFIG['prefix'] =~ %r{^/System/Library/Frameworks/Ruby.framework/}
11
+ prebuilt_ext = File.join('prebuilt', "#{RUBY_PLATFORM}-#{RUBY_VERSION}", 'xcodeproj_ext.bundle')
12
+ File.exist?(prebuilt_ext)
13
+ else
14
+ false
15
+ end
16
+ end
17
+
18
+ if use_prebuilt
19
+ # TODO It might be important that we communicate this, but there is no other way than this hack.
20
+ # Can't change the spec anymore to have a post install message nor can we output to stdout/stderr,
21
+ # because RubyGems catches all output and only shows it in case of a build failure.
22
+ #
23
+ # Do we want this?
24
+ #
25
+ if File.writable?('/dev/tty')
26
+ File.open('/dev/tty', 'w') do |out|
27
+ out.puts "[!] You are using the prebuilt binary version of the xcodeproj gem."
28
+ end
29
+ end
30
+ else
31
+ ruby 'extconf.rb'
32
+ sh 'make'
33
+ end
34
+ end
35
+
36
+ task :default => :ext
@@ -42,10 +42,10 @@ unless have_framework('CoreFoundation')
42
42
  end
43
43
  end
44
44
 
45
- have_header 'CoreFoundation/CoreFoundation.h'
46
- have_header 'CoreFoundation/CFStream.h'
47
- have_header 'CoreFoundation/CFPropertyList.h'
48
- have_header 'ruby/st.h' or have_header 'st.h' or abort 'xcodeproj currently requires the (ruby/)st.h header'
45
+ have_header('CoreFoundation/CoreFoundation.h')
46
+ have_header('CoreFoundation/CFStream.h')
47
+ have_header('CoreFoundation/CFPropertyList.h')
48
+ have_header('ruby/st.h') || have_header('st.h') || abort('xcodeproj currently requires the (ruby/)st.h header')
49
49
 
50
50
  create_header
51
51
  create_makefile 'xcodeproj_ext'
@@ -0,0 +1,7 @@
1
+ # In case a binary built for the current Ruby exists, use that, otherwise see
2
+ # if a prebuilt binary exists for the current platform and Ruby version.
3
+ begin
4
+ require 'xcodeproj/xcodeproj_ext'
5
+ rescue LoadError
6
+ require "xcodeproj/prebuilt/#{RUBY_PLATFORM}-#{RUBY_VERSION}/xcodeproj_ext"
7
+ end
@@ -1,6 +1,6 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '0.13.1' unless defined? Xcodeproj::VERSION
4
+ VERSION = '0.14.0' unless defined? Xcodeproj::VERSION
5
5
  end
6
6
 
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'pathname'
3
- require 'xcodeproj/xcodeproj_ext'
3
+
4
+ require 'xcodeproj/ext'
4
5
  require 'xcodeproj/project/object'
5
6
  require 'xcodeproj/project/project_helper'
6
7
  require 'xcodeproj/project/xcproj_helper'
@@ -469,6 +470,24 @@ module Xcodeproj
469
470
  objects.select { |obj| obj.class == PBXFileReference }
470
471
  end
471
472
 
473
+ # Returns the file reference for the given absolute path.
474
+ #
475
+ # @param [#to_s] absolute_path
476
+ # The absolute path of the file whose reference is needed.
477
+ #
478
+ # @return [PBXFileReference] The file reference.
479
+ # @return [Nil] If no file reference could be found.
480
+ #
481
+ def reference_for_path(absolute_path)
482
+ unless Pathname.new(absolute_path).absolute?
483
+ raise ArgumentError, "Paths must be absolute #{absolute_path}"
484
+ end
485
+
486
+ objects.find do |child|
487
+ child.isa == 'PBXFileReference' && child.real_path == absolute_path
488
+ end
489
+ end
490
+
472
491
  # @return [ObjectList<PBXNativeTarget>] A list of all the targets in the
473
492
  # project.
474
493
  #
@@ -138,7 +138,7 @@ module Xcodeproj
138
138
  child_ref = new_file_reference(ref, child_path, :group)
139
139
  last_child_ref = child_ref
140
140
  elsif File.basename(child_path) == '.xccurrentversion'
141
- full_path = path + child_path
141
+ full_path = path + File.basename(child_path)
142
142
  xccurrentversion = Xcodeproj.read_plist(full_path)
143
143
  current_version_name = xccurrentversion['_XCCurrentVersionName']
144
144
  end
@@ -124,7 +124,8 @@ module Xcodeproj
124
124
  end
125
125
 
126
126
  # Adds a new build configuration to the target and populates its with
127
- # default settings according to the provided type.
127
+ # default settings according to the provided type if one doesn't
128
+ # exists.
128
129
  #
129
130
  # @note If a build configuration with the given name is already
130
131
  # present no new build configuration is added.
@@ -136,8 +137,13 @@ module Xcodeproj
136
137
  # The type of the build configuration used to populate the build
137
138
  # settings, must be :debug or :release.
138
139
  #
139
- def add_build_configuration(name, type, skip_existing_names = true)
140
- unless build_configuration_list[name]
140
+ # @return [XCBuildConfiguration] the created build configuration or the
141
+ # existing one with the same name.
142
+ #
143
+ def add_build_configuration(name, type)
144
+ if existing = build_configuration_list[name]
145
+ existing
146
+ else
141
147
  build_configuration = project.new(XCBuildConfiguration)
142
148
  build_configuration.name = name
143
149
  build_configuration.build_settings = ProjectHelper.common_build_settings(type, platform_name, deployment_target, product_type)
@@ -184,14 +190,22 @@ module Xcodeproj
184
190
  #
185
191
  # @param [AbstractTarget] target
186
192
  # the target which should be added to the dependencies list of
187
- # the receiver.
193
+ # the receiver. The target may be a target of this target's
194
+ # project or of a subproject of this project. Note that the
195
+ # subproject must already be added to this target's project.
188
196
  #
189
197
  # @return [void]
190
198
  #
191
199
  def add_dependency(target)
192
200
  unless dependencies.map(&:target).include?(target)
193
201
  container_proxy = project.new(Xcodeproj::Project::PBXContainerItemProxy)
194
- container_proxy.container_portal = project.root_object.uuid
202
+ if target.project == project
203
+ container_proxy.container_portal = project.root_object.uuid
204
+ else
205
+ subproject_reference = project.reference_for_path(target.project.path)
206
+ 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
207
+ container_proxy.container_portal = subproject_reference.uuid
208
+ end
195
209
  container_proxy.proxy_type = '1'
196
210
  container_proxy.remote_global_id_string = target.uuid
197
211
  container_proxy.remote_info = target.name
@@ -90,9 +90,9 @@ module Xcodeproj
90
90
  buildable_reference = build_action_entry.add_element 'BuildableReference'
91
91
  buildable_reference.attributes['BuildableIdentifier'] = 'primary'
92
92
  buildable_reference.attributes['BlueprintIdentifier'] = build_target.uuid
93
- buildable_reference.attributes['BuildableName'] = File.basename(build_target.product_reference.path)
93
+ buildable_reference.attributes['BuildableName'] = construct_buildable_name(build_target)
94
94
  buildable_reference.attributes['BlueprintName'] = build_target.name
95
- buildable_reference.attributes['ReferencedContainer'] = "container:#{build_target.project.path.basename}"
95
+ buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(build_target)
96
96
  end
97
97
 
98
98
  # Add a target to the list of targets to build in the build action.
@@ -109,7 +109,7 @@ module Xcodeproj
109
109
  buildable_reference.attributes['BlueprintIdentifier'] = test_target.uuid
110
110
  buildable_reference.attributes['BuildableName'] = "#{test_target.name}.octest"
111
111
  buildable_reference.attributes['BlueprintName'] = test_target.name
112
- buildable_reference.attributes['ReferencedContainer'] = "container:#{test_target.project.path.basename}"
112
+ buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(test_target)
113
113
  end
114
114
 
115
115
  # Sets a runnable target target to be the target of the launch action of the scheme.
@@ -125,7 +125,7 @@ module Xcodeproj
125
125
  launch_buildable_reference.attributes['BlueprintIdentifier'] = build_target.uuid
126
126
  launch_buildable_reference.attributes['BuildableName'] = "#{build_target.name}.app"
127
127
  launch_buildable_reference.attributes['BlueprintName'] = build_target.name
128
- launch_buildable_reference.attributes['ReferencedContainer'] = "container:#{build_target.project.path.basename}"
128
+ launch_buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(build_target)
129
129
 
130
130
  profile_product_runnable = @profile_action.add_element 'BuildableProductRunnable'
131
131
 
@@ -134,7 +134,7 @@ module Xcodeproj
134
134
  profile_buildable_reference.attributes['BlueprintIdentifier'] = build_target.uuid
135
135
  profile_buildable_reference.attributes['BuildableName'] = "#{build_target.name}.app"
136
136
  profile_buildable_reference.attributes['BlueprintName'] = build_target.name
137
- profile_buildable_reference.attributes['ReferencedContainer'] = "container:#{build_target.project.path.basename}"
137
+ profile_buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(build_target)
138
138
 
139
139
  macro_expansion = @test_action.add_element 'MacroExpansion'
140
140
 
@@ -143,7 +143,7 @@ module Xcodeproj
143
143
  buildable_reference.attributes['BlueprintIdentifier'] = build_target.uuid
144
144
  buildable_reference.attributes['BuildableName'] = File.basename(build_target.product_reference.path)
145
145
  buildable_reference.attributes['BlueprintName'] = build_target.name
146
- buildable_reference.attributes['ReferencedContainer'] = "container:#{build_target.project.path.basename}"
146
+ buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(build_target)
147
147
  end
148
148
 
149
149
  # @!group Class methods
@@ -271,5 +271,39 @@ module Xcodeproj
271
271
 
272
272
  #-------------------------------------------------------------------------#
273
273
 
274
+ private
275
+
276
+ # @!group Private helpers
277
+
278
+ # @param [Xcodeproj::Project::Object::AbstractTarget] target
279
+ #
280
+ # @return [String] The buildable name of the scheme.
281
+ #
282
+ def construct_buildable_name(build_target)
283
+ case build_target.isa
284
+ when 'PBXNativeTarget'
285
+ File.basename(build_target.product_reference.path)
286
+ when 'PBXAggregateTarget'
287
+ build_target.name
288
+ else
289
+ raise ArgumentError, "Unsupported build target type #{build_target.isa}"
290
+ end
291
+ end
292
+
293
+ # @param [Xcodeproj::Project::Object::AbstractTarget] target
294
+ #
295
+ # @return [String] A string in the format "container:[path to the project
296
+ # file relative to the project_dir_path, always ending with
297
+ # the actual project directory name]"
298
+ #
299
+ def construct_referenced_container_uri(target)
300
+ project = target.project
301
+ relative_path = project.path.relative_path_from(project.path + project.root_object.project_dir_path).to_s
302
+ relative_path = project.path.basename if relative_path == '.'
303
+ "container:#{relative_path}"
304
+ end
305
+
306
+ #-------------------------------------------------------------------------#
307
+
274
308
  end
275
309
  end
metadata CHANGED
@@ -1,53 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
- version: !ruby/object:Gem::Version
4
- version: 0.13.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.14.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-10 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
11
+
12
+ date: 2013-10-24 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
14
15
  name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :runtime
21
16
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '3.0'
27
- - !ruby/object:Gem::Dependency
28
- name: colored
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
31
19
  - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.2'
20
+ - !ruby/object:Gem::Version
21
+ version: "3.0"
34
22
  type: :runtime
23
+ version_requirements: *id001
24
+ - !ruby/object:Gem::Dependency
25
+ name: colored
35
26
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
27
+ requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirements:
38
29
  - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.2'
41
- description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
42
- boring management tasks or build Xcode-friendly libraries. Also includes support
43
- for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
30
+ - !ruby/object:Gem::Version
31
+ version: "1.2"
32
+ type: :runtime
33
+ version_requirements: *id002
34
+ description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script boring management tasks or build Xcode-friendly libraries. Also includes support for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
44
35
  email: eloy.de.enige@gmail.com
45
- executables:
36
+ executables:
46
37
  - xcodeproj
47
- extensions:
48
- - ext/xcodeproj/extconf.rb
38
+ extensions:
39
+ - ext/xcodeproj/Rakefile
49
40
  extra_rdoc_files: []
50
- files:
41
+
42
+ files:
43
+ - README.md
44
+ - LICENSE
51
45
  - lib/xcodeproj/command/project_diff.rb
52
46
  - lib/xcodeproj/command/show.rb
53
47
  - lib/xcodeproj/command/sort.rb
@@ -56,6 +50,7 @@ files:
56
50
  - lib/xcodeproj/config.rb
57
51
  - lib/xcodeproj/constants.rb
58
52
  - lib/xcodeproj/differ.rb
53
+ - lib/xcodeproj/ext.rb
59
54
  - lib/xcodeproj/gem_version.rb
60
55
  - lib/xcodeproj/helper.rb
61
56
  - lib/xcodeproj/project/object/build_configuration.rb
@@ -84,35 +79,40 @@ files:
84
79
  - lib/xcodeproj/workspace.rb
85
80
  - lib/xcodeproj/xcodebuild_helper.rb
86
81
  - lib/xcodeproj.rb
82
+ - ext/xcodeproj/Rakefile
87
83
  - ext/xcodeproj/extconf.rb
88
84
  - ext/xcodeproj/xcodeproj_ext.c
89
- - README.md
90
- - LICENSE
85
+ - ext/xcodeproj/prebuilt/universal-darwin12.0-1.8.7/xcodeproj_ext.bundle
86
+ - ext/xcodeproj/prebuilt/universal.x86_64-darwin13-2.0.0/xcodeproj_ext.bundle
91
87
  - bin/xcodeproj
92
88
  homepage: https://github.com/cocoapods/xcodeproj
93
- licenses:
89
+ licenses:
94
90
  - MIT
95
91
  metadata: {}
92
+
96
93
  post_install_message:
97
- rdoc_options: []
98
- require_paths:
94
+ rdoc_options:
95
+ - -x
96
+ - ext/.+\.(o|bundle)
97
+ require_paths:
99
98
  - ext
100
99
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - '>='
104
- - !ruby/object:Gem::Version
105
- version: '0'
106
- required_rubygems_version: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - &id003
103
+ - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - *id003
111
109
  requirements: []
110
+
112
111
  rubyforge_project:
113
- rubygems_version: 2.0.3
112
+ rubygems_version: 2.1.8
114
113
  signing_key:
115
114
  specification_version: 3
116
115
  summary: Create and modify Xcode projects from Ruby.
117
116
  test_files: []
117
+
118
118
  has_rdoc: