Commit ef74b2b3 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #6048 from CocoaPods/seg-ascii-plist-xcodeproj

Use native ruby plist serialization
parents 98a8ade7 5f1f03cb
osx_image: xcode7.3 language: ruby
language: objective-c cache:
cache: bundler bundler: true
git:
# we do these manually to just download a tarball of the master submodule
submodules: false
matrix:
include:
- rvm: system
env: COCOAPODS_CI_TASKS=EXAMPLES
osx_image: xcode7.3
language: objective-c
- rvm: 2.3.1
env: COCOAPODS_CI_TASKS=LINT
git:
submodules: false
rvm: rvm:
# OS X 10.9.5-10.10.0 (2.0.0-p481) # OS X 10.9.5-10.10.0 (2.0.0-p481)
- system - 2.0.0-p481
# OS X 10.9.3-10.9.4 # OS X 10.9.3-10.9.4
- 2.0.0-p451 - 2.0.0-p451
# OS X 10.9.0-10.9.2 # OS X 10.9.0-10.9.2
...@@ -11,25 +27,42 @@ rvm: ...@@ -11,25 +27,42 @@ rvm:
# - 2.0.0-p247 # - 2.0.0-p247
- 2.3.1 - 2.3.1
env:
- COCOAPODS_CI_TASKS=SPECS
branches: branches:
only: only:
- master - master
- /.+-stable$/ - /.+-stable$/
before_install: before_install:
- |
if [ "$COCOAPODS_CI_TASKS" != "LINT" ]; then
master_sha="$(ruby -e "puts '`git submodule status spec/fixtures/spec-repos/master`'.strip.sub(/^-/, '').split(/\s/, 2).first")"
curl -ssL "https://github.com/CocoaPods/Specs/archive/$master_sha.tar.gz" | tar xz -C spec/fixtures/spec-repos
git rm spec/fixtures/spec-repos/master
mv "spec/fixtures/spec-repos/Specs-$master_sha" spec/fixtures/spec-repos/master
(
cd spec/fixtures/spec-repos/master
git init
git remote add origin https://github.com/CocoaPods/Specs.git
)
git submodule update --init
fi
# There is a bug in travis. When using system ruby, bundler is not # There is a bug in travis. When using system ruby, bundler is not
# installed and causes the default install action to fail. # installed and causes the default install action to fail.
- sudo gem install bundler - if [ "$TRAVIS_RUBY_VERSION" = "system" ]; then sudo gem install "bundler:~> 1.13"; else gem install "bundler:~> 1.13"; fi
# RubyGems 2.0.14 isn't a fun time on 2.0.0p648 # RubyGems 2.0.14 isn't a fun time on 2.0.0p648
- if [ "$(ruby -v | cut -d ' ' -f2)" = "2.0.0p648" ]; then sudo gem update --system; fi - if [ "$TRAVIS_RUBY_VERSION" = "system" ]; then sudo gem update --system; fi
before_script: before_script:
- bundle exec pod repo update --silent - git config --global user.email "tests@cocoapods.org"
- git config --global user.name "CocoaPods Tests"
- bundle exec pod env - bundle exec pod env
script: script:
- bundle exec rake - bundle exec rake spec:all
- bundle exec danger - if [ "$COCOAPODS_CI_TASKS" = "LINT" ]; then bundle exec danger; fi
addons: addons:
code_climate: code_climate:
......
...@@ -8,7 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -8,7 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements ##### Enhancements
* None. * Add support for running CocoaPods on Linux.
[Samuel Giddins](https://github.com/segiddins)
* Use native Ruby ASCII plist parsing and serialization, removing dependencies
on FFI, Xcode, and macOS.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes ##### Bug Fixes
......
...@@ -34,7 +34,8 @@ group :development do ...@@ -34,7 +34,8 @@ group :development do
cp_gem 'cocoapods-trunk', 'cocoapods-trunk' cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try' cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo' cp_gem 'molinillo', 'Molinillo'
cp_gem 'xcodeproj', 'Xcodeproj' cp_gem 'nanaimo', 'Nanaimo'
cp_gem 'xcodeproj', 'Xcodeproj', 'seg-ascii-plist'
gem 'cocoapods-dependencies', '~> 1.0.beta.1' gem 'cocoapods-dependencies', '~> 1.0.beta.1'
......
...@@ -23,14 +23,23 @@ GIT ...@@ -23,14 +23,23 @@ GIT
molinillo (0.5.1) molinillo (0.5.1)
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Nanaimo.git
revision: c533bc0273d7678755852d33353446dfd3283ca4 revision: 58e84fe93a1c16788e9ab67a85b5a1e9d58dbd6f
branch: master branch: master
specs:
nanaimo (0.1.0)
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: be928b7f09a29009a8e34e0e6047faf815796be1
branch: seg-ascii-plist
specs: specs:
xcodeproj (1.3.3) xcodeproj (1.3.3)
CFPropertyList (~> 2.3.3)
activesupport (>= 3) activesupport (>= 3)
claide (>= 1.0.1, < 2.0) claide (>= 1.0.1, < 2.0)
colored (~> 1.2) colored (~> 1.2)
nanaimo (~> 0.1.0)
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-deintegrate.git remote: https://github.com/CocoaPods/cocoapods-deintegrate.git
...@@ -111,11 +120,13 @@ PATH ...@@ -111,11 +120,13 @@ PATH
gh_inspector (~> 1.0) gh_inspector (~> 1.0)
molinillo (~> 0.5.1, != 0.5.2) molinillo (~> 0.5.1, != 0.5.2)
nap (~> 1.0) nap (~> 1.0)
ruby-macho (~> 0.2.5)
xcodeproj (>= 1.3.3, < 2.0) xcodeproj (>= 1.3.3, < 2.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
CFPropertyList (2.3.3)
activesupport (4.2.7.1) activesupport (4.2.7.1)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
...@@ -219,6 +230,7 @@ GEM ...@@ -219,6 +230,7 @@ GEM
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 0.3) unicode-display_width (~> 0.3)
ruby-graphviz (1.2.2) ruby-graphviz (1.2.2)
ruby-macho (0.2.5)
ruby-prof (0.15.2) ruby-prof (0.15.2)
ruby-progressbar (1.7.5) ruby-progressbar (1.7.5)
safe_yaml (1.0.4) safe_yaml (1.0.4)
...@@ -268,6 +280,7 @@ DEPENDENCIES ...@@ -268,6 +280,7 @@ DEPENDENCIES
mocha mocha
mocha-on-bacon mocha-on-bacon
molinillo! molinillo!
nanaimo!
prettybacon prettybacon
rake (~> 10.0) rake (~> 10.0)
rb-fsevent rb-fsevent
......
...@@ -136,26 +136,41 @@ begin ...@@ -136,26 +136,41 @@ begin
# to be run separately. # to be run separately.
# #
task :all => 'fixture_tarballs:unpack' do task :all => 'fixture_tarballs:unpack' do
tasks = ENV.fetch('COCOAPODS_CI_TASKS') { 'ALL' }.upcase.split(/\s+/)
if %w(ALL SPECS EXAMPLES LINT).&(tasks).empty?
raise "Unknown tasks #{tasks} -- supported options for COCOAPODS_CI_TASKS are " \
'ALL, SPECS, EXAMPLES, LINT'
end
specs = %w(ALL SPECS).&(tasks).any?
examples = %w(ALL EXAMPLES).&(tasks).any?
lint = %w(ALL LINT).&(tasks).any?
# Forcing colored to be included on String before Term::ANSIColor, so that Inch will work correctly. # Forcing colored to be included on String before Term::ANSIColor, so that Inch will work correctly.
require 'colored' require 'colored'
ENV['GENERATE_COVERAGE'] = 'true' ENV['GENERATE_COVERAGE'] = 'true'
puts "\033[0;32mUsing #{`ruby --version`}\033[0m" puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
if specs
title 'Running the specs' title 'Running the specs'
sh "bundle exec bacon #{specs('**/*')}" sh "bundle exec bacon #{specs('**/*')}"
title 'Running Integration tests' title 'Running Integration tests'
sh 'bundle exec bacon spec/integration.rb' sh 'bundle exec bacon spec/integration.rb'
end
if examples
title 'Running examples' title 'Running examples'
Rake::Task['examples:build'].invoke Rake::Task['examples:build'].invoke
end
if lint
title 'Running RuboCop' title 'Running RuboCop'
Rake::Task['rubocop'].invoke Rake::Task['rubocop'].invoke
title 'Running Inch' title 'Running Inch'
Rake::Task['inch'].invoke Rake::Task['inch'].invoke
end end
end
namespace :fixture_tarballs do namespace :fixture_tarballs do
task :default => :unpack task :default => :unpack
......
...@@ -47,6 +47,7 @@ Gem::Specification.new do |s| ...@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'fourflusher', '~> 2.0.1' s.add_runtime_dependency 'fourflusher', '~> 2.0.1'
s.add_runtime_dependency 'gh_inspector', '~> 1.0' s.add_runtime_dependency 'gh_inspector', '~> 1.0'
s.add_runtime_dependency 'nap', '~> 1.0' s.add_runtime_dependency 'nap', '~> 1.0'
s.add_runtime_dependency 'ruby-macho', '~> 0.2.5'
s.add_development_dependency 'bacon', '~> 1.1' s.add_development_dependency 'bacon', '~> 1.1'
s.add_development_dependency 'bundler', '~> 1.3' s.add_development_dependency 'bundler', '~> 1.3'
......
autoload :MachO, 'macho'
module Pod module Pod
class Sandbox class Sandbox
# Resolves the file patterns of a specification against its root directory, # Resolves the file patterns of a specification against its root directory,
...@@ -371,8 +373,9 @@ module Pod ...@@ -371,8 +373,9 @@ module Pod
# #
def dynamic_binary?(binary) def dynamic_binary?(binary)
return unless binary.file? return unless binary.file?
output, status = Executable.capture_command('file', [binary], :capture => :out) MachO.open(binary).dylib?
status.success? && output =~ /dynamically linked/ rescue MachO::MachOError
false
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
......
...@@ -258,8 +258,10 @@ module Pod ...@@ -258,8 +258,10 @@ module Pod
# @return [String] the SWIFT_VERSION in the .swift-version file or nil. # @return [String] the SWIFT_VERSION in the .swift-version file or nil.
# #
def dot_swift_version def dot_swift_version
return unless file
swift_version_path = file.dirname + '.swift-version' swift_version_path = file.dirname + '.swift-version'
swift_version_path.read.strip if swift_version_path.exist? return unless swift_version_path.exist?
swift_version_path.read.strip
end end
# @return [String] A string representing the Swift version used during linting # @return [String] A string representing the Swift version used during linting
...@@ -518,7 +520,7 @@ module Pod ...@@ -518,7 +520,7 @@ module Pod
# @return [void] # @return [void]
# #
def build_pod def build_pod
if Executable.which('xcodebuild').nil? if !xcodebuild_available?
UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow
else else
UI.message "\nBuilding with xcodebuild.\n".yellow do UI.message "\nBuilding with xcodebuild.\n".yellow do
...@@ -549,6 +551,10 @@ module Pod ...@@ -549,6 +551,10 @@ module Pod
end end
end end
def xcodebuild_available?
!Executable.which('xcodebuild').nil? && ENV['COCOAPODS_VALIDATOR_SKIP_XCODEBUILD'].nil?
end
FILE_PATTERNS = %i(source_files resources preserve_paths vendored_libraries FILE_PATTERNS = %i(source_files resources preserve_paths vendored_libraries
vendored_frameworks public_header_files preserve_paths vendored_frameworks public_header_files preserve_paths
private_header_files resource_bundles).freeze private_header_files resource_bundles).freeze
......
Subproject commit 2f1efd0d419e73adaede1b293747a4c0ab37e201 Subproject commit a2470cb751b032bf9617332b3d1589e8daa27c24
...@@ -47,7 +47,7 @@ require 'bundler/setup' ...@@ -47,7 +47,7 @@ require 'bundler/setup'
require 'pretty_bacon' require 'pretty_bacon'
require 'colored' require 'colored'
require 'clintegracon' require 'CLIntegracon'
require 'cocoapods-core/lockfile' require 'cocoapods-core/lockfile'
require 'cocoapods-core/yaml_helper' require 'cocoapods-core/yaml_helper'
...@@ -126,11 +126,11 @@ describe_cli 'pod' do ...@@ -126,11 +126,11 @@ describe_cli 'pod' do
subject do |s| subject do |s|
s.executable = "ruby #{ROOT + 'bin/pod'}" s.executable = "ruby #{ROOT + 'bin/pod'}"
s.environment_vars = { s.environment_vars = {
'CP_REPOS_DIR' => ROOT + 'spec/fixtures/spec-repos',
'COCOAPODS_SKIP_CACHE' => 'TRUE',
'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE',
'CLAIDE_DISABLE_AUTO_WRAP' => 'TRUE', 'CLAIDE_DISABLE_AUTO_WRAP' => 'TRUE',
'COCOAPODS_DISABLE_STATS' => 'TRUE', 'COCOAPODS_DISABLE_STATS' => 'TRUE',
'COCOAPODS_SKIP_CACHE' => 'TRUE',
'COCOAPODS_VALIDATOR_SKIP_XCODEBUILD' => 'TRUE',
'CP_REPOS_DIR' => ROOT + 'spec/fixtures/spec-repos',
} }
s.default_args = [ s.default_args = [
'--verbose', '--verbose',
......
...@@ -5,7 +5,7 @@ module FileTree ...@@ -5,7 +5,7 @@ module FileTree
path = Pathname(path) path = Pathname(path)
indentation = ' ' * depth * 2 indentation = ' ' * depth * 2
tree = indentation << path.to_path << "\n" tree = indentation << path.to_path << "\n"
path.children.each do |child| path.children.sort_by { |p| p.to_s.downcase }.each do |child|
tree << to_tree(child, depth + 1) tree << to_tree(child, depth + 1)
end if path.directory? end if path.directory?
tree tree
......
...@@ -56,7 +56,7 @@ module Pod ...@@ -56,7 +56,7 @@ module Pod
generator.save_as(file) generator.save_as(file)
`plutil -lint #{file}` `plutil -lint #{file}`
$?.should.be.success $?.should.be.success
end end if Executable.which('plutil')
it 'generates a correct Info.plist file' do it 'generates a correct Info.plist file' do
generator = Generator::InfoPlistFile.new(mock('Target', :platform => stub(:name => :ios))) generator = Generator::InfoPlistFile.new(mock('Target', :platform => stub(:name => :ios)))
......
...@@ -84,7 +84,7 @@ module Pod ...@@ -84,7 +84,7 @@ module Pod
it 'handles symlinks in /tmp' do it 'handles symlinks in /tmp' do
tmp_sandbox = Pod::Sandbox.new('/tmp/CocoaPods') tmp_sandbox = Pod::Sandbox.new('/tmp/CocoaPods')
tmp_sandbox.root.should.be == Pathname.new('/private/tmp/CocoaPods') tmp_sandbox.root.should.be == Pathname.new('/tmp/CocoaPods').realpath
require 'fileutils' require 'fileutils'
FileUtils.rm_rf(tmp_sandbox.root) FileUtils.rm_rf(tmp_sandbox.root)
end end
......
...@@ -17,6 +17,7 @@ module Pod ...@@ -17,6 +17,7 @@ module Pod
describe Validator do describe Validator do
before do before do
Validator.any_instance.stubs(:xcodebuild).returns('') Validator.any_instance.stubs(:xcodebuild).returns('')
Validator.any_instance.stubs(:xcodebuild_available?).returns(true)
end end
# @return [void] # @return [void]
...@@ -413,7 +414,6 @@ module Pod ...@@ -413,7 +414,6 @@ module Pod
git = Executable.which(:git) git = Executable.which(:git)
Executable.stubs(:which).with('git').returns(git) Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:which).with(:xcrun) Executable.stubs(:which).with(:xcrun)
Executable.expects(:which).with('xcodebuild').times(4).returns('/usr/bin/xcodebuild')
status = mock status = mock
status.stubs(:success?).returns(false) status.stubs(:success?).returns(false)
validator.stubs(:_xcodebuild).returns(['Output', status]) validator.stubs(:_xcodebuild).returns(['Output', status])
...@@ -434,7 +434,6 @@ module Pod ...@@ -434,7 +434,6 @@ module Pod
Executable.stubs(:which).with('git').returns(git) Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git']) Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git'])
Executable.stubs(:which).with(:xcrun) Executable.stubs(:which).with(:xcrun)
Executable.expects(:which).with('xcodebuild').times(4).returns('/usr/bin/xcodebuild')
command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'App', '-configuration', 'Release'] command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'App', '-configuration', 'Release']
Executable.expects(:capture_command).with('xcodebuild', command, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:capture_command).with('xcodebuild', command, :capture => :merge).once.returns(['', stub(:success? => true)])
args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p') args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p')
......
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