Commit c5cd47f9 authored by Honza Dvorsky's avatar Honza Dvorsky

Merge pull request #1 from CocoaPods/master

Sync main master with czechboy0 master
parents b03c496e db45e7a6
......@@ -8,11 +8,21 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* Build for iOS simulator only during validation. This allows validation without having
provisioning profiles set up.
[Boris Bügling](https://github.com/neonichu)
[#3083](https://github.com/CocoaPods/CocoaPods/issues/3083)
[Swift#13](https://github.com/CocoaPods/swift/issues/13)
* Explicitly inform the user to close existing project when switching to
a workspace for the first time.
[Kyle Fuller](https://github.com/kylef)
[#2996](https://github.com/CocoaPods/CocoaPods/issues/2996)
* Automatically detect conflicts between framework names.
[Samuel Giddins](https://github.com/segiddins)
[#2943](https://github.com/CocoaPods/CocoaPods/issues/2943)
##### Bug Fixes
* Fixed installation for app-extension targets which had no dependencies
......@@ -24,6 +34,29 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Seán Labastille](https://github.com/flufff42)
[#3082](https://github.com/CocoaPods/CocoaPods/issues/3082)
* Correctly update sources when calling `pod outdated`, and also respect the
`--[no-]repo-update` flag.
[Samuel Giddins](https://github.com/segiddins)
[#3137](https://github.com/CocoaPods/CocoaPods/issues/3137)
* Fix the `OTHER_SWIFT_FLAGS` generated, so `#if COCOAPODS` works in Swift.
[Samuel Giddins](https://github.com/segiddins)
[#2983](https://github.com/CocoaPods/CocoaPods/issues/2983)
* Output a properly-formed `Podfile` when running `pod init` with a target that
contains a `'` in its name.
[Samuel Giddins](https://github.com/segiddins)
[#3136](https://github.com/CocoaPods/CocoaPods/issues/3136)
* Remove the stored lockfile checkout source when switching to a development
pod.
[Samuel Giddins][https://github.com/segiddins]
[#3141](https://github.com/CocoaPods/CocoaPods/issues/3141)
* Migrate local Ruby podspecs to JSON, allowing updating those pods to work.
[Samuel Giddins](https://github.com/segiddins)
[#3038](https://github.com/CocoaPods/CocoaPods/issues/3038)
## 0.36.0.beta.2
......
......@@ -72,7 +72,7 @@ module Pod
# @return [String] the text for the target module
#
def target_module(target)
target_module = "\ntarget '#{target.name}' do\n"
target_module = "\ntarget '#{target.name.gsub(/'/, "\\\\\'")}' do\n"
if target.name =~ /tests?/i
target_module << template_contents(config.default_test_podfile_path)
......
......@@ -13,7 +13,7 @@ module Pod
end
def initialize(argv)
config.skip_repo_update = argv.flag?('repo-update', config.skip_repo_update)
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
super
end
......@@ -96,6 +96,7 @@ module Pod
def spec_sets
@spec_sets ||= begin
analyzer.send(:update_repositories_if_needed)
aggregate = Source::Aggregate.new(analyzer.sources.map(&:repo))
installed_pods.map do |pod_name|
aggregate.search(Dependency.new(pod_name))
......
......@@ -19,6 +19,7 @@ module Pod
store_podspec(sandbox, podspec, podspec.extname == '.json')
is_absolute = absolute?(declared_path)
sandbox.store_local_path(name, podspec.dirname, is_absolute)
sandbox.remove_checkout_source(name)
end
end
......
......@@ -160,7 +160,7 @@ module Pod
def self.add_language_specific_settings(target, xcconfig)
if target.uses_swift?
build_settings = {
'OTHER_SWIFT_FLAGS' => quote(['-D COCOAPODS']),
'OTHER_SWIFT_FLAGS' => quote(%w(-D COCOAPODS)),
}
xcconfig.merge!(build_settings)
end
......
......@@ -90,6 +90,7 @@ module Pod
resolve_dependencies
download_dependencies
determine_dependency_product_types
verify_no_duplicate_framework_names
generate_pods_project
integrate_user_project if config.integrate_targets?
perform_post_install_actions
......@@ -327,6 +328,23 @@ module Pod
end
end
def verify_no_duplicate_framework_names
aggregate_targets.each do |aggregate_target|
aggregate_target.user_build_configurations.keys.each do |config|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks)
frameworks = vendored_frameworks.map { |fw| fw.basename('.framework') }
frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
duplicates = frameworks.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
unless duplicates.empty?
raise Informative, "The '#{aggregate_target.label}' target has " \
"frameworks with conflicting names: #{duplicates.to_sentence}."
end
end
end
end
# Performs any post-installation actions
#
# @return [void]
......
......@@ -52,6 +52,14 @@ module Pod
def migrate_to_0_36(sandbox)
UI.message('Migrating to CocoaPods 0.36') do
move(sandbox.root + 'Headers/Build', sandbox.root + 'Headers/Private')
sandbox.specifications_root.children.each do |child|
next unless child.basename.to_s =~ /\.podspec$/
spec = Specification.from_file(child)
child.delete
child = Pathname("#{child}.json")
child.write(spec.to_pretty_json)
end
end
end
......
......@@ -354,6 +354,18 @@ module Pod
checkout_sources[root_name] = source
end
# Removes the checkout source of a Pod.
#
# @param [String] name
# The name of the Pod.
#
# @return [void]
#
def remove_checkout_source(name)
root_name = Specification.root_name(name)
checkout_sources.delete(root_name)
end
# @return [Hash{String=>Hash}] The options necessary to recreate the exact
# checkout of a given Pod grouped by its name.
#
......
......@@ -519,8 +519,11 @@ module Pod
# returns its output (both STDOUT and STDERR).
#
def xcodebuild
UI.puts 'xcodebuild clean build -target Pods' if config.verbose?
output = `xcodebuild clean build -target Pods 2>&1`
command = 'xcodebuild clean build -target Pods CODE_SIGN_IDENTITY=-'
command << ' -sdk iphonesimulator' if consumer.platform_name == :ios
UI.puts command if config.verbose?
output = `#{command} 2>&1`
unless $?.success?
message = 'Returned a unsuccessful exit code.'
......
Subproject commit 05d1f9a8e4f28691c5c5fd5a68a2634763b54bba
Subproject commit a6bbd0cbc48c3038cd9374c3b7b259a2505ab067
......@@ -52,6 +52,7 @@ module Pod
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, 'AppA', :ios)
project.new_target(:application, 'AppB', :ios)
project.new_target(:application, "App'C", :ios)
project.save
run_command('init')
......@@ -60,6 +61,7 @@ module Pod
config.podfile.target_definitions.length.should == project.targets.length + 1
config.podfile.target_definitions['AppA'].nil?.should == false
config.podfile.target_definitions['AppB'].nil?.should == false
config.podfile.target_definitions["App'C"].nil?.should == false
end
end
......
......@@ -6,6 +6,7 @@ module Pod
before do
Command::Outdated.any_instance.stubs(:unlocked_pods).returns([])
config.stubs(:skip_repo_update?).returns(true)
end
it 'tells the user that no Podfile was found in the project dir' do
......@@ -47,5 +48,34 @@ module Pod
run_command('outdated', '--no-repo-update')
UI.output.should.include('in favor of BlocksKit')
end
it "updates the Podfile's sources by default" do
config.stubs(:podfile).returns Podfile.new do
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking'
end
config.stubs(:skip_repo_update?).returns(false)
lockfile = mock
lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).once
run_command('outdated')
end
it "doesn't updates the Podfile's sources with --no-repo-update" do
config.stubs(:podfile).returns Podfile.new do
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking'
end
config.unstub(:skip_repo_update?)
config.skip_repo_update = false
lockfile = mock
lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).never
run_command('outdated', '--no-repo-update')
end
end
end
......@@ -36,6 +36,12 @@ module Pod
}
end
it 'removes sandbox lockfile checkout options for the pod' do
config.sandbox.store_checkout_source('Reachability', :http => 'https://example.com')
@subject.fetch(config.sandbox)
config.sandbox.checkout_sources['pod'].should.be.nil
end
it 'raises if the podspec cannot be found' do
@subject.stubs(:params).returns(:path => temporary_directory)
should.raise Informative do
......
......@@ -143,7 +143,7 @@ module Pod
end
it 'adds the COCOAPODS macro definition' do
@xcconfig.to_hash['OTHER_SWIFT_FLAGS'].should.include '-D COCOAPODS'
@xcconfig.to_hash['OTHER_SWIFT_FLAGS'].should.include '"-D" "COCOAPODS"'
end
end
......
......@@ -49,6 +49,7 @@ module Pod
@installer.stubs(:resolve_dependencies)
@installer.stubs(:download_dependencies)
@installer.stubs(:determine_dependency_product_types)
@installer.stubs(:verify_no_duplicate_framework_names)
@installer.stubs(:generate_pods_project)
@installer.stubs(:integrate_user_project)
@installer.stubs(:run_plugins_post_install_hooks)
......@@ -144,6 +145,28 @@ module Pod
#-------------------------------------------------------------------------#
describe '#verify_no_duplicate_framework_names' do
it 'detects duplicate framework names' do
Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks).returns([Pathname('monkey.framework')])
fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Pod::Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
end
lockfile = generate_lockfile
config.integrate_targets = false
@installer = Installer.new(config.sandbox, podfile, lockfile)
should.raise(Informative) { @installer.install! }.message.should.match /conflict.*monkey/
end
end
#-------------------------------------------------------------------------#
describe 'Dependencies Resolution' do
describe '#analyze' do
it 'prints a warning if the version of the Lockfile is higher than the one of the executable' do
......
......@@ -371,6 +371,18 @@ module Pod
validator.result_type.should == :error
end
it 'runs xcodebuild with correct arguments for code signing' do
Validator.any_instance.unstub(:xcodebuild)
validator = Validator.new(podspec_path, SourcesManager.master.map(&:url))
validator.stubs(:check_file_patterns)
validator.stubs(:validate_url)
validator.expects(:`).with('which xcodebuild').twice.returns('/usr/bin/xcodebuild')
command = 'xcodebuild clean build -target Pods CODE_SIGN_IDENTITY=-'
validator.expects(:`).with("#{command} 2>&1").once.returns('')
validator.expects(:`).with("#{command} -sdk iphonesimulator 2>&1").once.returns('')
validator.validate
end
it 'does filter InputFile errors completely' do
validator = Validator.new(podspec_path, SourcesManager.master.map(&:url))
validator.stubs(:check_file_patterns)
......
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