mirror of
https://github.com/zhigang1992/CocoaPods.git
synced 2026-04-30 02:15:45 +08:00
Merge branch 'master' into list-new
* master:
Added note about set_arc_compatibility_flag to the CHANGELOG
Looks like the -fobj-arc flag we added to OTHER_LD_FLAGS in ea918cd was an unsupported feature as it has now been removed from Xcode 4.3.2, causing lib tool to complain about an unrecognised flag.
Instead of removing the VCR cache, namespace the cache by Ruby version.
Remove Guard dependencies. Use `rake spec:kick` for auto-test-running.
Make sure to use bundler for rake tasks that run bacon.
Oops, use correct rake task.
Move travis install commands to Rakefile and setup CFLAGS env for Travis/RVM.
Hmm, chicken and egg problem on Travis, copy travis:setup task from Xcodeproj.
Replace Xcodeproj git submodule by adding it to the Gemfile. Closes #172.
Improve error report template. Closes #187.
Conflicts:
.kick
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,7 +12,6 @@ examples/Pods
|
||||
examples/**/Pods
|
||||
spec/fixtures/banana-lib
|
||||
spec/fixtures/integration/Headers/
|
||||
pod
|
||||
/concatenated.*
|
||||
spec/fixtures/mercurial-repo/.hg/*cache
|
||||
.hg
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -10,9 +10,6 @@
|
||||
[submodule "spec/fixtures/integration/sstoolkit"]
|
||||
path = spec/fixtures/integration/sstoolkit
|
||||
url = https://github.com/samsoffes/sstoolkit.git
|
||||
[submodule "external/Xcodeproj"]
|
||||
path = external/Xcodeproj
|
||||
url = https://github.com/CocoaPods/Xcodeproj.git
|
||||
[submodule "spec/fixtures/spec-repos/master"]
|
||||
path = spec/fixtures/spec-repos/master
|
||||
url = https://github.com/CocoaPods/Specs.git
|
||||
|
||||
12
.kick
12
.kick
@@ -13,6 +13,18 @@ process do |files|
|
||||
Kicker::Recipes::Ruby.run_tests(specs)
|
||||
end
|
||||
|
||||
# Have written this so many times, probably should make a recipe out of it.
|
||||
process do |files|
|
||||
files.each do |file|
|
||||
case file
|
||||
when 'Gemfile'
|
||||
files.delete(file)
|
||||
execute 'bundle install'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
recipe :ignore
|
||||
ignore(/.*\/?tags/)
|
||||
ignore(/.*\/?\.git/)
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@ language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.3
|
||||
before_install: git submodule update --init && cd external/Xcodeproj && rake travis:setup && sudo apt-get install subversion
|
||||
script: cd ../.. && bundle exec rake spec
|
||||
install: rake travis:setup
|
||||
script: bundle exec rake spec
|
||||
|
||||
@@ -74,6 +74,12 @@ podspec, then update these method calls.
|
||||
|
||||
### Fixes
|
||||
|
||||
* [#142](https://github.com/CocoaPods/CocoaPods/issues/142): Xcode 4.3.2 no longer
|
||||
supports passing the -fobj-arc flag to the linker and will fail to build. The
|
||||
addition of this flag was a workaround for a compiler bug in previous versions.
|
||||
This flag is no longer included by default - to keep using this flag, you need to
|
||||
add `set_arc_compatibility_flag!` to your Podfile.
|
||||
|
||||
* [#183](https://github.com/CocoaPods/CocoaPods/issues/183): Fix for
|
||||
`.DS_Store` file in `~/.cocoapods` prevents `$ pod install` from running.
|
||||
|
||||
|
||||
11
Gemfile
11
Gemfile
@@ -3,14 +3,13 @@ source "http://rubygems.org"
|
||||
gem "open4"
|
||||
|
||||
group :development do
|
||||
gem "rake"
|
||||
gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git"
|
||||
|
||||
gem "bacon"
|
||||
gem "guard"
|
||||
gem "guard-shell"
|
||||
gem "rb-fsevent"
|
||||
gem "growl"
|
||||
gem "kicker"
|
||||
gem "mocha-on-bacon"
|
||||
gem "rake"
|
||||
gem "rb-fsevent"
|
||||
gem "vcr"
|
||||
gem "webmock"
|
||||
gem "kicker"
|
||||
end
|
||||
|
||||
16
Gemfile.lock
16
Gemfile.lock
@@ -1,14 +1,15 @@
|
||||
GIT
|
||||
remote: git://github.com/CocoaPods/Xcodeproj.git
|
||||
revision: 338e4d37f282121754f10f6d169256a57a64860d
|
||||
specs:
|
||||
xcodeproj (0.1.0)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
addressable (2.2.7)
|
||||
bacon (1.1.0)
|
||||
crack (0.3.1)
|
||||
growl (1.0.3)
|
||||
guard (0.8.8)
|
||||
thor (~> 0.14.6)
|
||||
guard-shell (0.3.0)
|
||||
guard (>= 0.2.0)
|
||||
kicker (2.5.0)
|
||||
rb-fsevent
|
||||
metaclass (0.0.1)
|
||||
@@ -19,7 +20,6 @@ GEM
|
||||
open4 (1.3.0)
|
||||
rake (0.9.2.2)
|
||||
rb-fsevent (0.9.0)
|
||||
thor (0.14.6)
|
||||
vcr (2.0.0)
|
||||
webmock (1.8.0)
|
||||
addressable (>= 2.2.7)
|
||||
@@ -30,9 +30,6 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
bacon
|
||||
growl
|
||||
guard
|
||||
guard-shell
|
||||
kicker
|
||||
mocha-on-bacon
|
||||
open4
|
||||
@@ -40,3 +37,4 @@ DEPENDENCIES
|
||||
rb-fsevent
|
||||
vcr
|
||||
webmock
|
||||
xcodeproj!
|
||||
|
||||
15
Guardfile
15
Guardfile
@@ -1,15 +0,0 @@
|
||||
# A sample Guardfile
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
def run_spec(s)
|
||||
`bundle exec bacon #{s}`
|
||||
end
|
||||
|
||||
# parameters:
|
||||
# output => the formatted to use
|
||||
# backtrace => number of lines, nil = everything
|
||||
guard :shell do
|
||||
watch(%r{^lib/cocoapods/(.+)\.rb$}) { |m| run_spec("spec/unit/#{m[1]}_spec.rb") }
|
||||
watch(%r{spec/.+\.rb$}) { |s| run_spec(s) }
|
||||
end
|
||||
|
||||
88
Rakefile
88
Rakefile
@@ -1,3 +1,51 @@
|
||||
# Travis support
|
||||
def on_rvm?
|
||||
`which ruby`.strip.include?('.rvm')
|
||||
end
|
||||
|
||||
def rvm_ruby_dir
|
||||
@rvm_ruby_dir ||= File.expand_path('../..', `which ruby`.strip)
|
||||
end
|
||||
|
||||
namespace :travis do
|
||||
# Used to create the deb package.
|
||||
#
|
||||
# Known to work with opencflite rev 248.
|
||||
task :prepare_deb do
|
||||
sh "sudo apt-get install subversion libicu-dev"
|
||||
sh "svn co https://opencflite.svn.sourceforge.net/svnroot/opencflite/trunk opencflite"
|
||||
sh "cd opencflite && ./configure --target=linux --with-uuid=/usr --with-tz-includes=./include --prefix=/usr/local && make && sudo make install"
|
||||
sh "sudo /sbin/ldconfig"
|
||||
end
|
||||
|
||||
task :install_opencflite_debs do
|
||||
sh "mkdir -p debs"
|
||||
Dir.chdir("debs") do
|
||||
base_url = "https://github.com/downloads/CocoaPods/OpenCFLite"
|
||||
%w{ opencflite1_248-1_i386.deb opencflite-dev_248-1_i386.deb }.each do |deb|
|
||||
sh "wget #{File.join(base_url, deb)}" unless File.exist?(deb)
|
||||
end
|
||||
sh "sudo dpkg -i *.deb"
|
||||
end
|
||||
end
|
||||
|
||||
task :fix_rvm_include_dir do
|
||||
unless File.exist?(File.join(rvm_ruby_dir, 'include'))
|
||||
# Make Ruby headers available, RVM seems to do not create a include dir on 1.8.7, but it does on 1.9.3.
|
||||
sh "mkdir '#{rvm_ruby_dir}/include'"
|
||||
sh "ln -s '#{rvm_ruby_dir}/lib/ruby/1.8/i686-linux' '#{rvm_ruby_dir}/include/ruby'"
|
||||
end
|
||||
end
|
||||
|
||||
task :install do
|
||||
sh "git submodule update --init"
|
||||
sh "sudo apt-get install subversion"
|
||||
sh "env CFLAGS='-I#{rvm_ruby_dir}/include' bundle install"
|
||||
end
|
||||
|
||||
task :setup => [:install_opencflite_debs, :fix_rvm_include_dir, :install]
|
||||
end
|
||||
|
||||
namespace :gem do
|
||||
def gem_version
|
||||
require File.join(File.dirname(__FILE__), *%w[lib cocoapods])
|
||||
@@ -41,42 +89,33 @@ namespace :gem do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :ext do
|
||||
XCODEPROJ_DIR = "./external/Xcodeproj"
|
||||
|
||||
task :clean do
|
||||
sh "cd #{XCODEPROJ_DIR} && rake ext:clean"
|
||||
end
|
||||
|
||||
task :build do
|
||||
sh "cd #{XCODEPROJ_DIR} && rake ext:build"
|
||||
end
|
||||
|
||||
task :cleanbuild => [:clean, :build]
|
||||
end
|
||||
|
||||
namespace :spec do
|
||||
def specs(dir)
|
||||
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
||||
end
|
||||
|
||||
desc "Automatically run specs for updated files"
|
||||
task :kick do
|
||||
exec "bundle exec kicker -c"
|
||||
end
|
||||
|
||||
desc "Run the unit specs"
|
||||
task :unit => :unpack_fixture_tarballs do
|
||||
sh "bacon #{specs('unit/**')} -q"
|
||||
sh "bundle exec bacon #{specs('unit/**')} -q"
|
||||
end
|
||||
|
||||
desc "Run the functional specs"
|
||||
task :functional => :clean_env do
|
||||
sh "bacon #{specs('functional/**')}"
|
||||
task :functional => :unpack_fixture_tarballs do
|
||||
sh "bundle exec bacon #{specs('functional/**')}"
|
||||
end
|
||||
|
||||
desc "Run the integration spec"
|
||||
task :integration => :clean_env do
|
||||
sh "bacon spec/integration_spec.rb"
|
||||
task :integration => :unpack_fixture_tarballs do
|
||||
sh "bundle exec bacon spec/integration_spec.rb"
|
||||
end
|
||||
|
||||
task :all => :clean_env do
|
||||
sh "bacon #{specs('**')}"
|
||||
task :all => :unpack_fixture_tarballs do
|
||||
sh "bundle exec bacon #{specs('**')}"
|
||||
end
|
||||
|
||||
desc "Run all specs and build all examples"
|
||||
@@ -104,13 +143,6 @@ namespace :spec do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Removes the stored VCR fixture"
|
||||
task :clean_vcr do
|
||||
sh "rm -f spec/fixtures/vcr/tarballs.yml"
|
||||
end
|
||||
|
||||
task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"]
|
||||
end
|
||||
|
||||
namespace :examples do
|
||||
|
||||
4
bin/pod
4
bin/pod
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
if $0 == __FILE__
|
||||
$:.unshift File.expand_path('../../external/Xcodeproj/ext', __FILE__)
|
||||
$:.unshift File.expand_path('../../external/Xcodeproj/lib', __FILE__)
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
$:.unshift File.expand_path('../../lib', __FILE__)
|
||||
end
|
||||
|
||||
|
||||
1
external/Xcodeproj
vendored
1
external/Xcodeproj
vendored
Submodule external/Xcodeproj deleted from 338e4d37f2
@@ -14,11 +14,20 @@ Search for existing github issues similar to yours:
|
||||
|
||||
https://github.com/CocoaPods/CocoaPods/issues/search?q=%22#{CGI.escape(error.message)}%22
|
||||
|
||||
If none exists, create a ticket with the following information to:
|
||||
If none exists, create a ticket, with the information in the below (markdown formatted) template, on:
|
||||
|
||||
https://github.com/CocoaPods/CocoaPods/issues/new
|
||||
|
||||
Don't forget to anonymize any private data!
|
||||
**Don't forget to anonymize any private data!**
|
||||
|
||||
|
||||
### Report
|
||||
|
||||
* What did you do?
|
||||
|
||||
* What did you expect to happen?
|
||||
|
||||
* What happened instead?
|
||||
|
||||
|
||||
### Stack
|
||||
|
||||
@@ -13,10 +13,8 @@ module Pod
|
||||
def xcconfig
|
||||
@xcconfig ||= Xcodeproj::Config.new({
|
||||
# In a workspace this is where the static library headers should be found.
|
||||
'PODS_ROOT' => '$(SRCROOT)/Pods',
|
||||
'PODS_ROOT' => '$(SRCROOT)/Pods',
|
||||
'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
|
||||
# This makes categories from static libraries work, which many libraries
|
||||
# require, so we add these by default.
|
||||
'OTHER_LDFLAGS' => default_ld_flags,
|
||||
})
|
||||
end
|
||||
@@ -118,7 +116,7 @@ module Pod
|
||||
|
||||
def default_ld_flags
|
||||
flags = %w{-ObjC -all_load}
|
||||
flags << '-fobjc-arc' if self.requires_arc
|
||||
flags << '-fobjc-arc' if @podfile.set_arc_compatibility_flag? && self.requires_arc
|
||||
flags.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -215,6 +215,19 @@ module Pod
|
||||
@post_install_callback = block
|
||||
end
|
||||
|
||||
# Specifies that the -fobjc-arc flag should be added to the OTHER_LD_FLAGS.
|
||||
#
|
||||
# This is used as a workaround for a compiler bug with non-ARC projects.
|
||||
# (see https://github.com/CocoaPods/CocoaPods/issues/142)
|
||||
#
|
||||
# This was originally done automatically but libtool as of Xcode 4.3.2 no
|
||||
# longer seems to support the -fobjc-arc flag. Therefore it now has to be
|
||||
# enabled explicitly using this method.
|
||||
#
|
||||
# This may be removed in a future release.
|
||||
def set_arc_compatibility_flag!
|
||||
@set_arc_compatibility_flag = true
|
||||
end
|
||||
|
||||
# Not attributes
|
||||
|
||||
@@ -236,6 +249,10 @@ module Pod
|
||||
def generate_bridge_support?
|
||||
@generate_bridge_support
|
||||
end
|
||||
|
||||
def set_arc_compatibility_flag?
|
||||
@set_arc_compatibility_flag
|
||||
end
|
||||
|
||||
def post_install!(installer)
|
||||
@post_install_callback.call(installer) if @post_install_callback
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'bacon'
|
||||
require 'mocha-on-bacon'
|
||||
@@ -7,8 +8,6 @@ Bacon.summary_at_exit
|
||||
require 'pathname'
|
||||
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
||||
|
||||
$:.unshift File.expand_path('../../external/Xcodeproj/ext', __FILE__)
|
||||
$:.unshift File.expand_path('../../external/Xcodeproj/lib', __FILE__)
|
||||
$:.unshift((ROOT + 'lib').to_s)
|
||||
require 'cocoapods'
|
||||
|
||||
@@ -56,7 +55,9 @@ require 'vcr'
|
||||
require 'webmock'
|
||||
|
||||
VCR.configure do |c|
|
||||
c.cassette_library_dir = (ROOT + 'spec/fixtures/vcr').to_s
|
||||
# Namespace the fixture by the Ruby version, because different Ruby versions
|
||||
# can lead to different ways the data is interpreted.
|
||||
c.cassette_library_dir = (ROOT + "spec/fixtures/vcr/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}").to_s
|
||||
c.hook_into :webmock # or :fakeweb
|
||||
c.allow_http_connections_when_no_cassette = true
|
||||
end
|
||||
|
||||
@@ -48,6 +48,10 @@ describe "Pod::Podfile" do
|
||||
Pod::Podfile.new {}.should.not.generate_bridge_support
|
||||
Pod::Podfile.new { generate_bridge_support! }.should.generate_bridge_support
|
||||
end
|
||||
|
||||
it 'specifies that ARC compatibility flag should be generated' do
|
||||
Pod::Podfile.new { set_arc_compatibility_flag! }.should.set_arc_compatibility_flag
|
||||
end
|
||||
|
||||
it "stores a block that will be called with the Installer instance once installation is finished (but the project is not written to disk yet)" do
|
||||
yielded = nil
|
||||
|
||||
@@ -8,7 +8,9 @@ describe Pod::Installer::TargetInstaller do
|
||||
@target_definition = stub('target', :lib_name => "FooLib")
|
||||
|
||||
platform = Pod::Platform.new(:ios)
|
||||
@podfile = stub('podfile', :platform => platform, :generate_bridge_support? => false)
|
||||
@podfile = stub('podfile', :platform => platform,
|
||||
:generate_bridge_support? => false,
|
||||
:set_arc_compatibility_flag? => false)
|
||||
|
||||
@project = Pod::Project.for_platform(platform)
|
||||
@project.main_group.groups.new('name' => 'Targets Support Files')
|
||||
@@ -45,9 +47,20 @@ describe Pod::Installer::TargetInstaller do
|
||||
@installer.xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include("\"#{@sandbox.header_search_paths.join(" ")}\"")
|
||||
end
|
||||
|
||||
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)' do
|
||||
@specification.stubs(:requires_arc).returns(true)
|
||||
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
|
||||
do_install!
|
||||
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
|
||||
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.not.include("-fobjc-arc")
|
||||
end
|
||||
|
||||
describe "when ARC compatibility flag is set" do
|
||||
before do
|
||||
@podfile.stubs(:set_arc_compatibility_flag? => true)
|
||||
end
|
||||
|
||||
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)' do
|
||||
@specification.stubs(:requires_arc).returns(true)
|
||||
@installer.install!(@pods, @sandbox)
|
||||
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user