Commit 291e2e2e authored by Eloy Duran's avatar Eloy Duran

Check that a lib with the expected arch is built and fetch repos from spec/fixtures/integration.

parent 56d0b4b1
...@@ -6,16 +6,16 @@ require 'yaml' ...@@ -6,16 +6,16 @@ require 'yaml'
module SpecHelper module SpecHelper
class Installer < Pod::Installer class Installer < Pod::Installer
# Here we override the `source' of the pod specifications to point to the integration fixtures. # Here we override the `source' of the pod specifications to point to the integration fixtures.
def dependency_specifications def specs_by_target
@dependency_specifications ||= super @specs_by_target ||= super.tap do |hash|
@dependency_specifications.each do |spec| hash.values.flatten.each do |spec|
unless spec.part_of_other_pod? unless spec.part_of_other_pod?
source = spec.source source = spec.source
source[:git] = SpecHelper.fixture("integration/#{spec.name}").to_s source[:git] = SpecHelper.fixture("integration/#{spec.name}").to_s
spec.source = source spec.source = source
end end
end end
@dependency_specifications end
end end
end end
end end
...@@ -66,6 +66,18 @@ else ...@@ -66,6 +66,18 @@ else
$?.should.be.success $?.should.be.success
end end
def should_xcodebuild(target_definition)
target = target_definition
with_xcodebuild_available do
Dir.chdir(config.project_pods_root) do
puts "\n[!] Compiling #{target.label} static library..."
should_successfully_perform "xcodebuild -target '#{target.label}'"
lib_path = config.project_pods_root + "build/Release#{'-iphoneos' if target.platform == :ios}" + target.lib_name
`lipo -info '#{lib_path}'`.should.include "architecture: #{target.platform == :ios ? 'armv7' : 'x86_64'}"
end
end
end
# Lame way to run on one platform only # Lame way to run on one platform only
if platform == :ios if platform == :ios
it "installs a Pod directly from its repo" do it "installs a Pod directly from its repo" do
...@@ -134,7 +146,7 @@ else ...@@ -134,7 +146,7 @@ else
change_log.should.not.include '1.3' change_log.should.not.include '1.3'
end end
it "creates targets for different targets" do it "creates targets for different platforms" do
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
self.platform :ios self.platform :ios
dependency 'JSONKit', '1.4' dependency 'JSONKit', '1.4'
...@@ -156,21 +168,8 @@ else ...@@ -156,21 +168,8 @@ else
"DEPENDENCIES" => ["ASIHTTPRequest", "JSONKit (= 1.4)"] "DEPENDENCIES" => ["ASIHTTPRequest", "JSONKit (= 1.4)"]
} }
with_xcodebuild_available do should_xcodebuild(podfile.target_definitions[:ios_target])
Dir.chdir(config.project_pods_root) do should_xcodebuild(podfile.target_definitions[:osx_target])
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}'"
lib_path = config.project_pods_root + 'build/Release' + target_definition.lib_name
`lipo -info '#{lib_path}'`.should.include 'architecture: x86_64'
end
end
end end
if Pod::Generator::Documentation.appledoc_installed? if Pod::Generator::Documentation.appledoc_installed?
...@@ -228,7 +227,7 @@ else ...@@ -228,7 +227,7 @@ else
config.rootspec = self config.rootspec = self
self.platform platform self.platform platform
dependency 'Reachability', '< 2.0.5' if platform == :ios dependency 'Reachability', '> 2.0.5' if platform == :ios
dependency 'ASIWebPageRequest', '>= 1.8.1' dependency 'ASIWebPageRequest', '>= 1.8.1'
dependency 'JSONKit', '>= 1.0' dependency 'JSONKit', '>= 1.0'
dependency 'SSZipArchive', '< 2' dependency 'SSZipArchive', '< 2'
...@@ -242,13 +241,13 @@ else ...@@ -242,13 +241,13 @@ else
{ 'ASIHTTPRequest (1.8.1)' => ["Reachability"] }, { 'ASIHTTPRequest (1.8.1)' => ["Reachability"] },
{ 'ASIWebPageRequest (1.8.1)' => ["ASIHTTPRequest (= 1.8.1)"] }, { 'ASIWebPageRequest (1.8.1)' => ["ASIHTTPRequest (= 1.8.1)"] },
'JSONKit (1.4)', 'JSONKit (1.4)',
{ 'Reachability (2.0.4)' => ["ASIHTTPRequest (>= 1.8)"] }, 'Reachability (3.0.0)',
'SSZipArchive (0.1.2)', 'SSZipArchive (0.1.2)',
], ],
'DEPENDENCIES' => [ 'DEPENDENCIES' => [
"ASIWebPageRequest (>= 1.8.1)", "ASIWebPageRequest (>= 1.8.1)",
"JSONKit (>= 1.0)", "JSONKit (>= 1.0)",
"Reachability (< 2.0.5)", "Reachability (> 2.0.5)",
"SSZipArchive (< 2)", "SSZipArchive (< 2)",
] ]
} }
...@@ -265,12 +264,7 @@ else ...@@ -265,12 +264,7 @@ else
project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s
Xcodeproj.read_plist(project_file).should == installer.project.to_hash Xcodeproj.read_plist(project_file).should == installer.project.to_hash
with_xcodebuild_available do should_xcodebuild(podfile.target_definitions[:default])
puts "\n[!] Compiling static library..."
Dir.chdir(config.project_pods_root) do
should_successfully_perform "xcodebuild"
end
end
end end
if platform == :ios if platform == :ios
...@@ -382,16 +376,9 @@ else ...@@ -382,16 +376,9 @@ else
(root + 'Pods-debug-resources.sh').should.exist (root + 'Pods-debug-resources.sh').should.exist
(root + 'Pods-test-resources.sh').should.exist (root + 'Pods-test-resources.sh').should.exist
with_xcodebuild_available do should_xcodebuild(podfile.target_definitions[:default])
Dir.chdir(config.project_pods_root) do should_xcodebuild(podfile.target_definitions[:debug])
puts "\n[!] Compiling static library `Pods'..." should_xcodebuild(podfile.target_definitions[:test])
should_successfully_perform "xcodebuild -target Pods"
puts "\n[!] Compiling static library `Pods-debug'..."
should_successfully_perform "xcodebuild -target Pods-debug"
puts "\n[!] Compiling static library `Pods-test'..."
should_successfully_perform "xcodebuild -target Pods-test"
end
end
end end
it "sets up an existing project with pods" do it "sets up an existing project with pods" do
......
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