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: objective-c
cache: bundler
language: ruby
cache:
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:
# 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
- 2.0.0-p451
# OS X 10.9.0-10.9.2
......@@ -11,25 +27,42 @@ rvm:
# - 2.0.0-p247
- 2.3.1
env:
- COCOAPODS_CI_TASKS=SPECS
branches:
only:
- master
- /.+-stable$/
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
# 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
- 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:
- 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
script:
- bundle exec rake
- bundle exec danger
- bundle exec rake spec:all
- if [ "$COCOAPODS_CI_TASKS" = "LINT" ]; then bundle exec danger; fi
addons:
code_climate:
......
......@@ -8,7 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### 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
......@@ -199,7 +204,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Hash scope suffixes if they are over 50 characters to prevent file paths from being too long.
* Hash scope suffixes if they are over 50 characters to prevent file paths from being too long.
[Danielle Tomlinson](https://github.com/dantoml)
[#5491](https://github.com/CocoaPods/CocoaPods/issues/5491)
......
......@@ -34,7 +34,8 @@ group :development do
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
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'
......
......@@ -23,14 +23,23 @@ GIT
molinillo (0.5.1)
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: c533bc0273d7678755852d33353446dfd3283ca4
remote: https://github.com/CocoaPods/Nanaimo.git
revision: 58e84fe93a1c16788e9ab67a85b5a1e9d58dbd6f
branch: master
specs:
nanaimo (0.1.0)
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: be928b7f09a29009a8e34e0e6047faf815796be1
branch: seg-ascii-plist
specs:
xcodeproj (1.3.3)
CFPropertyList (~> 2.3.3)
activesupport (>= 3)
claide (>= 1.0.1, < 2.0)
colored (~> 1.2)
nanaimo (~> 0.1.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-deintegrate.git
......@@ -111,11 +120,13 @@ PATH
gh_inspector (~> 1.0)
molinillo (~> 0.5.1, != 0.5.2)
nap (~> 1.0)
ruby-macho (~> 0.2.5)
xcodeproj (>= 1.3.3, < 2.0)
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.3)
activesupport (4.2.7.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
......@@ -219,6 +230,7 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 0.3)
ruby-graphviz (1.2.2)
ruby-macho (0.2.5)
ruby-prof (0.15.2)
ruby-progressbar (1.7.5)
safe_yaml (1.0.4)
......@@ -268,6 +280,7 @@ DEPENDENCIES
mocha
mocha-on-bacon
molinillo!
nanaimo!
prettybacon
rake (~> 10.0)
rb-fsevent
......
......@@ -136,25 +136,40 @@ begin
# to be run separately.
#
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.
require 'colored'
ENV['GENERATE_COVERAGE'] = 'true'
puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
title 'Running the specs'
sh "bundle exec bacon #{specs('**/*')}"
if specs
title 'Running the specs'
sh "bundle exec bacon #{specs('**/*')}"
title 'Running Integration tests'
sh 'bundle exec bacon spec/integration.rb'
title 'Running Integration tests'
sh 'bundle exec bacon spec/integration.rb'
end
title 'Running examples'
Rake::Task['examples:build'].invoke
if examples
title 'Running examples'
Rake::Task['examples:build'].invoke
end
title 'Running RuboCop'
Rake::Task['rubocop'].invoke
if lint
title 'Running RuboCop'
Rake::Task['rubocop'].invoke
title 'Running Inch'
Rake::Task['inch'].invoke
title 'Running Inch'
Rake::Task['inch'].invoke
end
end
namespace :fixture_tarballs do
......
......@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'fourflusher', '~> 2.0.1'
s.add_runtime_dependency 'gh_inspector', '~> 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 'bundler', '~> 1.3'
......
autoload :MachO, 'macho'
module Pod
class Sandbox
# Resolves the file patterns of a specification against its root directory,
......@@ -371,8 +373,9 @@ module Pod
#
def dynamic_binary?(binary)
return unless binary.file?
output, status = Executable.capture_command('file', [binary], :capture => :out)
status.success? && output =~ /dynamically linked/
MachO.open(binary).dylib?
rescue MachO::MachOError
false
end
#-----------------------------------------------------------------------#
......
......@@ -258,8 +258,10 @@ module Pod
# @return [String] the SWIFT_VERSION in the .swift-version file or nil.
#
def dot_swift_version
return unless file
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
# @return [String] A string representing the Swift version used during linting
......@@ -518,7 +520,7 @@ module Pod
# @return [void]
#
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
else
UI.message "\nBuilding with xcodebuild.\n".yellow do
......@@ -549,6 +551,10 @@ module Pod
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
vendored_frameworks public_header_files preserve_paths
private_header_files resource_bundles).freeze
......
Subproject commit 2f1efd0d419e73adaede1b293747a4c0ab37e201
Subproject commit a2470cb751b032bf9617332b3d1589e8daa27c24
......@@ -47,7 +47,7 @@ require 'bundler/setup'
require 'pretty_bacon'
require 'colored'
require 'clintegracon'
require 'CLIntegracon'
require 'cocoapods-core/lockfile'
require 'cocoapods-core/yaml_helper'
......@@ -126,11 +126,11 @@ describe_cli 'pod' do
subject do |s|
s.executable = "ruby #{ROOT + 'bin/pod'}"
s.environment_vars = {
'CP_REPOS_DIR' => ROOT + 'spec/fixtures/spec-repos',
'COCOAPODS_SKIP_CACHE' => 'TRUE',
'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE',
'CLAIDE_DISABLE_AUTO_WRAP' => 'TRUE',
'COCOAPODS_DISABLE_STATS' => 'TRUE',
'CLAIDE_DISABLE_AUTO_WRAP' => '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 = [
'--verbose',
......
......@@ -5,7 +5,7 @@ module FileTree
path = Pathname(path)
indentation = ' ' * depth * 2
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)
end if path.directory?
tree
......
......@@ -56,7 +56,7 @@ module Pod
generator.save_as(file)
`plutil -lint #{file}`
$?.should.be.success
end
end if Executable.which('plutil')
it 'generates a correct Info.plist file' do
generator = Generator::InfoPlistFile.new(mock('Target', :platform => stub(:name => :ios)))
......
......@@ -84,7 +84,7 @@ module Pod
it 'handles symlinks in /tmp' do
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'
FileUtils.rm_rf(tmp_sandbox.root)
end
......
......@@ -17,6 +17,7 @@ module Pod
describe Validator do
before do
Validator.any_instance.stubs(:xcodebuild).returns('')
Validator.any_instance.stubs(:xcodebuild_available?).returns(true)
end
# @return [void]
......@@ -413,7 +414,6 @@ module Pod
git = Executable.which(:git)
Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:which).with(:xcrun)
Executable.expects(:which).with('xcodebuild').times(4).returns('/usr/bin/xcodebuild')
status = mock
status.stubs(:success?).returns(false)
validator.stubs(:_xcodebuild).returns(['Output', status])
......@@ -434,7 +434,6 @@ module Pod
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(: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']
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')
......
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