mirror of
https://github.com/zhigang1992/CocoaPods.git
synced 2026-01-12 08:54:14 +08:00
Make building a iOS lib work again.
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/CocoaPods/Xcodeproj.git
|
||||
revision: b3db4601c47bf78cb5e6fa8ada5bcb4cda18e05f
|
||||
revision: c7a2acb7f49005823a37cea0089e558ff4a13af7
|
||||
specs:
|
||||
xcodeproj (0.1.0)
|
||||
|
||||
|
||||
2
TODO
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.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require 'colored'
|
||||
|
||||
module Pod
|
||||
class Installer
|
||||
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
|
||||
@@ -47,7 +49,7 @@ module Pod
|
||||
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 @@ module Pod
|
||||
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
|
||||
|
||||
@@ -77,13 +77,17 @@ module Pod
|
||||
|
||||
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 @@ module Pod
|
||||
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
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require 'colored'
|
||||
|
||||
module Pod
|
||||
class Resolver
|
||||
include Config::Mixin
|
||||
|
||||
1
spec/fixtures/integration/Reachability
vendored
Submodule
1
spec/fixtures/integration/Reachability
vendored
Submodule
Submodule spec/fixtures/integration/Reachability added at c8a3e521ee
@@ -6,20 +6,16 @@ require 'yaml'
|
||||
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 @@ else
|
||||
|
||||
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 @@ else
|
||||
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!
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ module Bacon
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user