Commit 2ca31f8f authored by Fabio Pelosin's avatar Fabio Pelosin

Load only required podspecs for external dependencies [see 15c4ca3]

parent 80809dc0
...@@ -15,8 +15,8 @@ module Pod ...@@ -15,8 +15,8 @@ module Pod
@specs = {} @specs = {}
result = @podfile.target_definitions.values.inject({}) do |result, target_definition| result = @podfile.target_definitions.values.inject({}) do |result, target_definition|
puts "\n--> Finding dependencies for #{target_definition.name}" if Config.instance.verbose? puts "\n--> Finding dependencies for #{target_definition.name}" if Config.instance.verbose?
@loaded_specs = [] @loaded_specs = []
find_dependency_sets(@podfile, target_definition.dependencies) find_dependency_sets(@podfile, target_definition.dependencies)
result[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name) result[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name)
result result
......
...@@ -3,28 +3,28 @@ require 'fileutils' ...@@ -3,28 +3,28 @@ require 'fileutils'
module Pod module Pod
class Sandbox class Sandbox
attr_reader :root attr_reader :root
HEADERS_DIR = "Headers" HEADERS_DIR = "Headers"
def initialize(path) def initialize(path)
@root = Pathname.new(path) @root = Pathname.new(path)
@header_search_paths = [HEADERS_DIR] @header_search_paths = [HEADERS_DIR]
FileUtils.mkdir_p(@root) FileUtils.mkdir_p(@root)
end end
def implode def implode
root.rmtree root.rmtree
end end
def headers_root def headers_root
root + HEADERS_DIR root + HEADERS_DIR
end end
def project_path def project_path
root + "Pods.xcodeproj" root + "Pods.xcodeproj"
end end
def add_header_file(namespace_path, relative_header_path) def add_header_file(namespace_path, relative_header_path)
namespaced_header_path = headers_root + namespace_path namespaced_header_path = headers_root + namespace_path
namespaced_header_path.mkpath unless File.exist?(namespaced_header_path) namespaced_header_path.mkpath unless File.exist?(namespaced_header_path)
...@@ -33,27 +33,31 @@ module Pod ...@@ -33,27 +33,31 @@ module Pod
@header_search_paths << namespaced_header_path.relative_path_from(root) @header_search_paths << namespaced_header_path.relative_path_from(root)
namespaced_header_path + relative_header_path.basename namespaced_header_path + relative_header_path.basename
end end
def add_header_files(namespace_path, relative_header_paths) def add_header_files(namespace_path, relative_header_paths)
relative_header_paths.map { |path| add_header_file(namespace_path, path) } relative_header_paths.map { |path| add_header_file(namespace_path, path) }
end end
def header_search_paths def header_search_paths
@header_search_paths.uniq.map { |path| "$(PODS_ROOT)/#{path}" } @header_search_paths.uniq.map { |path| "$(PODS_ROOT)/#{path}" }
end end
def prepare_for_install def prepare_for_install
headers_root.rmtree if headers_root.exist? headers_root.rmtree if headers_root.exist?
end end
def installed_pods def podspec_for_name(name)
Dir[root + "**/*.podspec"].map do |podspec| if spec_path = Dir[root + "#{name}/*.podspec"].first
LocalPod.from_podspec(Pathname.new(podspec), self) Pathname.new(spec_path)
elsif spec_path = Dir[root + "Local Podspecs/#{name}.podspec"].first
Pathname.new(spec_path)
end end
end end
def installed_pod_named(name) def installed_pod_named(name)
installed_pods.find { |pod| pod.name == name } if spec_path = podspec_for_name(name)
LocalPod.from_podspec(spec_path, self)
end
end end
end end
end end
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