Skip to content
Browse files

Make building a iOS lib work again.

  • Loading branch information...
1 parent 7ee5b4b commit 4a709b8791d0d197aa072b1da5716b51e018cf0a @alloy alloy committed
View
3 .gitmodules
@@ -13,3 +13,6 @@
[submodule "spec/fixtures/spec-repos/master"]
path = spec/fixtures/spec-repos/master
url = https://github.com/CocoaPods/Specs.git
+[submodule "spec/fixtures/integration/Reachability"]
+ path = spec/fixtures/integration/Reachability
+ url = https://github.com/tonymillion/Reachability.git
View
2 Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
- revision: b3db4601c47bf78cb5e6fa8ada5bcb4cda18e05f
+ revision: c7a2acb7f49005823a37cea0089e558ff4a13af7
specs:
xcodeproj (0.1.0)
View
2 TODO
@@ -1,5 +1,7 @@
+* For now, remove ability to set things like link_with and platform through the target options.
* Resolve all dependencies together and write out all dependencies to Podfile.lock together.
* Add integration spec with multiple platforms.
* Validate platforms for each target definition.
* Validate that there are dependencies in a Podfile.
* Validate that the dependencies in the targets don't conflict. E.g. two different versions of the same pod.
+* Move Podfile.lock generator from Installer into its own file.
View
9 lib/cocoapods/installer.rb
@@ -1,3 +1,5 @@
+require 'colored'
+
module Pod
class Installer
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
@@ -47,7 +49,7 @@ def install_dependencies!
unless should_install = !pod.exists? && !pod.specification.local?
puts marker + "Using #{pod}" unless config.silent?
else
- puts marker + "Installing #{spec}".green unless config.silent?
+ puts marker + "Installing #{pod.specification}".green unless config.silent?
downloader = Downloader.for_pod(pod)
downloader.download
@@ -111,9 +113,8 @@ def generate_lock_file!(pods)
file.puts "PODS:"
pods.map do |pod|
# TODO this should list _all_ the pods, so merge the platforms
- dependencies = pod.specification.dependencies[@podfile.target_definitions[:default].platform.to_sym]
- [pod.specification.to_s, dependencies.map(&:to_s).sort]
- end.sort_by(&:first).each do |name, deps|
+ [pod.specification.to_s, pod.dependencies.map(&:to_s).sort]
+ end.uniq.sort_by(&:first).each do |name, deps|
if deps.empty?
file.puts " - #{name}"
else
View
8 lib/cocoapods/local_pod.rb
@@ -77,13 +77,17 @@ def link_headers
def add_to_target(target)
implementation_files.each do |file|
- target.add_source_file(file, nil, specification.compiler_flags[@platform.to_sym].strip)
+ target.add_source_file(file, nil, specification.compiler_flags[@platform.name].strip)
end
end
def requires_arc?
specification.requires_arc
end
+
+ def dependencies
+ specification.dependencies[@platform.name]
+ end
private
@@ -107,7 +111,7 @@ def copy_header_mappings
end
def expanded_paths(platforms_with_patterns, options = {})
- patterns = platforms_with_patterns.is_a?(Hash) ? (platforms_with_patterns[@platform.to_sym] || []) : platforms_with_patterns
+ patterns = platforms_with_patterns.is_a?(Hash) ? platforms_with_patterns[@platform.name] : platforms_with_patterns
patterns.map do |pattern|
pattern = root + pattern
View
2 lib/cocoapods/resolver.rb
@@ -1,3 +1,5 @@
+require 'colored'
+
module Pod
class Resolver
include Config::Mixin
1 spec/fixtures/integration/Reachability
@@ -0,0 +1 @@
+Subproject commit c8a3e521ee57ce2e6fa73c55a3e2f0042cc2033a
View
66 spec/integration_spec.rb
@@ -6,20 +6,16 @@
module SpecHelper
class Installer < Pod::Installer
# Here we override the `source' of the pod specifications to point to the integration fixtures.
- def dependent_specification_sets
- @dependent_specification_sets ||= super
- @dependent_specification_sets.each do |set|
- def set.specification
- spec = super
- unless spec.part_of_other_pod?
- source = spec.source
- source[:git] = SpecHelper.fixture("integration/#{spec.name}").to_s
- spec.source = source
- end
- spec
+ def dependency_specifications
+ @dependency_specifications ||= super
+ @dependency_specifications.each do |spec|
+ unless spec.part_of_other_pod?
+ source = spec.source
+ source[:git] = SpecHelper.fixture("integration/#{spec.name}").to_s
+ spec.source = source
end
end
- @dependent_specification_sets
+ @dependency_specifications
end
end
end
@@ -33,7 +29,11 @@ def set.specification
def create_config!
Pod::Config.instance = nil
- config.silent = true
+ if ENV['VERBOSE_SPECS']
+ config.verbose = true
+ else
+ config.silent = true
+ end
config.repos_dir = fixture('spec-repos')
config.project_root = temporary_directory
config.doc_install = false
@@ -134,7 +134,45 @@ def should_successfully_perform(command)
change_log.should.not.include '1.3'
end
- if !`which appledoc`.strip.empty?
+ it "creates targets for different targets" do
+ podfile = Pod::Podfile.new do
+ self.platform :ios
+ dependency 'JSONKit', '1.4'
+ target :ios_target do
+ # This brings in Reachability on iOS
+ dependency 'ASIHTTPRequest'
+ end
+ target :osx_target do
+ self.platform :osx
+ dependency 'ASIHTTPRequest'
+ end
+ end
+
+ installer = SpecHelper::Installer.new(podfile)
+ installer.install!
+
+ YAML.load(installer.lock_file.read).should == {
+ "PODS" => [{ "ASIHTTPRequest (1.8.1)" => ["Reachability"] }, "JSONKit (1.4)", "Reachability (3.0.0)"],
+ "DEPENDENCIES" => ["ASIHTTPRequest", "JSONKit (= 1.4)"]
+ }
+
+ with_xcodebuild_available do
+ Dir.chdir(config.project_pods_root) do
+ puts "\n[!] Compiling iOS static library..."
+ target_definition = podfile.target_definitions[:ios_target]
+ should_successfully_perform "xcodebuild -target '#{target_definition.label}'"
+ lib_path = config.project_pods_root + 'build/Release-iphoneos' + target_definition.lib_name
+ `lipo -info '#{lib_path}'`.should.include 'architecture: armv7'
+
+ puts "\n[!] Compiling OS X static library..."
+ target_definition = podfile.target_definitions[:osx_target]
+ should_successfully_perform "xcodebuild -target '#{target_definition.label}'"
+ exec 'ls'
+ end
+ end
+ end
+
+ if Pod::Generator::Documentation.appledoc_installed?
it "generates documentation of all pods by default" do
create_config!
View
3 spec/spec_helper.rb
@@ -30,8 +30,9 @@ def argv(*argv)
Pod::Command::ARGV.new(argv)
end
+ require 'colored'
def xit(description, *args)
- puts "\e[34m - #{description} [DISABLED]\e[0m"
+ puts "- #{description} [DISABLED]".blue
ErrorLog << "[DISABLED] #{self.name} #{description}\n\n"
end
end

0 comments on commit 4a709b8

Please sign in to comment.
Something went wrong with that request. Please try again.