Commit 70e18447 authored by Fabio Pelosin's avatar Fabio Pelosin

[Analizer] Never consider aggregate targets for integration (from 109af82e).

parent ec06a64f
...@@ -72,7 +72,7 @@ module Pod ...@@ -72,7 +72,7 @@ module Pod
# @return [Bool] Whether the sandbox is in synch with the lockfile. # @return [Bool] Whether the sandbox is in synch with the lockfile.
# #
def sandbox_needs_install? def sandbox_needs_install?
lockfile =! sandbox.manifest lockfile != sandbox.manifest
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -324,7 +324,7 @@ module Pod ...@@ -324,7 +324,7 @@ module Pod
root_specs = specifications.map(&:root).uniq root_specs = specifications.map(&:root).uniq
is_changed = lambda do |name| is_changed = lambda do |name|
spec = root_specs.find { |spec| spec.name == name } spec = root_specs.find { |r_spec| r_spec.name == name }
spec.version != sandbox_lockfile.version(name) \ spec.version != sandbox_lockfile.version(name) \
|| spec.checksum != sandbox_lockfile.checksum(name) \ || spec.checksum != sandbox_lockfile.checksum(name) \
|| resolved_subspecs_names[name] =! sandbox_subspecs_names[name] \ || resolved_subspecs_names[name] =! sandbox_subspecs_names[name] \
...@@ -411,19 +411,27 @@ module Pod ...@@ -411,19 +411,27 @@ module Pod
# #
def compute_user_project_targets(target_definition, user_project) def compute_user_project_targets(target_definition, user_project)
if link_with = target_definition.link_with if link_with = target_definition.link_with
targets = user_project.targets.select { |t| link_with.include? t.name } targets = native_targets(user_project).select { |t| link_with.include? t.name }
raise Informative, "Unable to find the targets named `#{link_with.to_sentence}` to link with target definition `#{target_definition.name}`" if targets.empty? raise Informative, "Unable to find the targets named `#{link_with.to_sentence}` to link with target definition `#{target_definition.name}`" if targets.empty?
elsif target_definition.name != :default elsif target_definition.name != :default
target = user_project.targets.find { |t| t.name == target_definition.name.to_s } target = native_targets(user_project).find { |t| t.name == target_definition.name.to_s }
targets = [ target ].compact targets = [ target ].compact
raise Informative, "Unable to find a target named `#{target_definition.name.to_s}`" if targets.empty? raise Informative, "Unable to find a target named `#{target_definition.name.to_s}`" if targets.empty?
else else
targets = [ user_project.targets.first ].compact targets = [ native_targets(user_project).first ].compact
raise Informative, "Unable to find a target" if targets.empty? raise Informative, "Unable to find a target" if targets.empty?
end end
targets targets
end end
# @return [Array<PBXNativeTarget>] Returns the user’s targets, excluding
# aggregate targets.
def native_targets(user_project)
user_project.targets.reject do |target|
target.is_a? Xcodeproj::Project::Object::PBXAggregateTarget
end
end
# @return [Hash{String=>Symbol}] A hash representing the user build # @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a # configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or `:release`). # configuration and its value to its type (`:debug` or `:release`).
......
...@@ -211,6 +211,16 @@ module Pod ...@@ -211,6 +211,16 @@ module Pod
e = lambda { @analyzer.send(:compute_user_project_path, target_definition) }.should.raise Informative e = lambda { @analyzer.send(:compute_user_project_path, target_definition) }.should.raise Informative
e.message.should.match /Could not.*select.*project/ e.message.should.match /Could not.*select.*project/
end end
it "does not take aggregate targets into consideration" do
aggregate_class = Xcodeproj::Project::Object::PBXAggregateTarget
sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
sample_project = Xcodeproj::Project.new(sample_project_path)
sample_project.targets.map(&:class).should.include(aggregate_class)
native_targets = @analyzer.send(:native_targets, sample_project).map(&:class)
native_targets.should.not.include(aggregate_class)
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -27,7 +27,10 @@ module Pod ...@@ -27,7 +27,10 @@ module Pod
lib = Library.new(target_definition) lib = Library.new(target_definition)
lib.user_project_path = sample_project_path lib.user_project_path = sample_project_path
lib.target = @pods_project.new_target(:static_library, target_definition.label, target_definition.platform.name) lib.target = @pods_project.new_target(:static_library, target_definition.label, target_definition.platform.name)
lib.user_targets = sample_project.targets lib.user_targets = sample_project.targets.reject do |target|
target.is_a? Xcodeproj::Project::Object::PBXAggregateTarget
end
lib.support_files_root = config.sandbox.root lib.support_files_root = config.sandbox.root
lib.user_project = sample_project lib.user_project = sample_project
lib lib
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment