Skip to content

Commit

Permalink
Merge ddcd6cf into 50e19ae
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Sep 20, 2013
2 parents 50e19ae + ddcd6cf commit 0ab670b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 25 deletions.
14 changes: 7 additions & 7 deletions Gemfile.lock
Expand Up @@ -7,7 +7,7 @@ GIT

GIT
remote: https://github.com/CocoaPods/Core.git
revision: d7d34813894b7b08c8e19f137a3b04cd6fcc92b0
revision: faa9df47370af19677e66cda11986de025b2e948
branch: master
specs:
cocoapods-core (0.24.0)
Expand All @@ -17,7 +17,7 @@ GIT

GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: d7bacd932526540b6d447dcb4358cec2822a68f9
revision: b47feb937af209f6c3c96bd39c76c15c64ba31f5
branch: master
specs:
xcodeproj (0.10.1)
Expand Down Expand Up @@ -49,9 +49,9 @@ GIT

GIT
remote: https://github.com/lemurheavy/coveralls-ruby.git
revision: 2576b7d37545c6f28f0ad43f56cddc09ca2740f4
revision: b1a5dcc23a4a9cb02a6a1560c63861d102530cd9
specs:
coveralls (0.6.7)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
Expand Down Expand Up @@ -112,7 +112,7 @@ GEM
yajl-ruby (~> 1.1.0)
rake (10.1.0)
rb-fsevent (0.9.3)
rb-inotify (0.9.1)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
rb-kqueue (0.2.0)
ffi (>= 0.5.0)
Expand All @@ -128,9 +128,9 @@ GEM
term-ansicolor (1.2.2)
tins (~> 0.8)
thor (0.18.1)
tins (0.9.0)
tins (0.10.0)
yajl-ruby (1.1.0)
yard (0.8.7)
yard (0.8.7.2)

PLATFORMS
ruby
Expand Down
30 changes: 30 additions & 0 deletions lib/cocoapods/installer/analyzer.rb
Expand Up @@ -35,6 +35,7 @@ def initialize(sandbox, podfile, lockfile = nil)

@update_mode = false
@allow_pre_downloads = true
@archs_by_target_def = {}
end

# Performs the analysis.
Expand Down Expand Up @@ -176,6 +177,7 @@ def generate_targets
target.client_root = project_path.dirname
target.user_target_uuids = native_targets.map(&:uuid)
target.user_build_configurations = compute_user_build_configurations(target_definition, native_targets)
target.archs = @archs_by_target_def[target_definition]
else
target.client_root = config.installation_root
target.user_target_uuids = []
Expand All @@ -189,6 +191,7 @@ def generate_targets
grouped_specs.each do |pod_specs|
pod_target = PodTarget.new(pod_specs, target_definition, sandbox)
pod_target.user_build_configurations = target.user_build_configurations
pod_target.archs = @archs_by_target_def[target_definition]
target.pod_targets << pod_target
end
end
Expand Down Expand Up @@ -437,6 +440,31 @@ def compute_platform_for_target_definition(target_definition, user_targets)
Platform.new(name, deployment_target)
end

# @return [Platform] The platform for the library.
#
# @note This resolves to the lowest deployment target across the user
# targets.
#
# @todo Is assigning the platform to the target definition the best way
# to go?
#
def compute_archs_for_target_definition(target_definition, user_targets)
archs = []
user_targets.each do |target|
target.build_configurations.each do |configuration|
archs << configuration.build_settings['ARCHS']
end
end

archs = archs.compact.uniq.sort
if archs.count > 1
UI.warn "Found multiple values (`#{archs.join('`, `')}`) for the " \
"architectures (`ARCHS`) build setting for the " \
"`#{target_definition}` target definition. Using the first."
end
archs.first
end

# Precompute the platforms for each target_definition in the Podfile
#
# @note The platforms are computed and added to each target_definition
Expand All @@ -452,6 +480,8 @@ def compute_target_platforms
user_project = Xcodeproj::Project.open(project_path)
targets = compute_user_project_targets(target_definition, user_project)
platform = compute_platform_for_target_definition(target_definition, targets)
archs = compute_archs_for_target_definition(target_definition, targets)
@archs_by_target_def[target_definition] = archs
else
unless target_definition.platform
raise Informative, "It is necessary to specify the platform in the Podfile if not integrating."
Expand Down
6 changes: 4 additions & 2 deletions lib/cocoapods/installer/target_installer.rb
Expand Up @@ -44,8 +44,10 @@ def add_target
@target = project.new_target(:static_library, name, platform, deployment_target)

settings = {}
if library.platform.requires_legacy_ios_archs?
settings['ARCHS'] = "armv6 armv7"
if library.archs
settings['ARCHS'] = library.archs
else
settings.delete('ARCHS')
end

@target.build_settings('Debug').merge!(settings)
Expand Down
4 changes: 4 additions & 0 deletions lib/cocoapods/target.rb
Expand Up @@ -62,6 +62,10 @@ def platform
@platform ||= target_definition.platform
end

# @return [String] The value for the ARCHS build setting.
#
attr_accessor :archs

#-------------------------------------------------------------------------#

# @!group Support files
Expand Down
15 changes: 0 additions & 15 deletions spec/unit/installer/target_installer_spec.rb
Expand Up @@ -29,20 +29,5 @@ module Pod
@installer = Installer::TargetInstaller.new(config.sandbox, @pod_target)
end

it "sets the ARCHS" do
@installer.send(:add_target)
target = @project.targets.first
target.build_settings('Debug')["ONLY_ACTIVE_ARCH"].should.be.nil
target.build_settings('AppStore')["ONLY_ACTIVE_ARCH"].should.be.nil
end

it "sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3 for iOS targets" do
@pod_target.stubs(:platform).returns(Platform.new(:ios, '4.0'))
@installer.send(:add_target)
target = @project.targets.first
target.build_settings('Debug')["ARCHS"].should == "armv6 armv7"
target.build_settings('Release')["ARCHS"].should == "armv6 armv7"
end

end
end

0 comments on commit 0ab670b

Please sign in to comment.