Commit 0f818375 authored by Danielle Tomlinson's avatar Danielle Tomlinson Committed by GitHub

Merge pull request #6900 from CocoaPods/seg-molinillo-0.6

Update Molinillo to 0.6
parents 9862ea30 4c4f7483
......@@ -8,7 +8,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* None.
* Show full requirement trees when a version conflict is encountered during
dependency resolution.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes
......
......@@ -17,10 +17,10 @@ GIT
GIT
remote: https://github.com/CocoaPods/Molinillo.git
revision: c2f655cd697812574a8537cc7c9cf68a0c0357b3
revision: 4ff9652b3b58566ea70dd7919de799e2b3b7beb0
branch: master
specs:
molinillo (0.5.7)
molinillo (0.6.0)
GIT
remote: https://github.com/CocoaPods/Nanaimo.git
......@@ -117,7 +117,7 @@ PATH
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.7)
molinillo (~> 0.6.0)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.1, < 2.0)
......@@ -293,4 +293,4 @@ DEPENDENCIES
xcodeproj!
BUNDLED WITH
1.15.1
1.15.3
......@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'cocoapods-stats', '>= 1.0.0', '< 2.0'
s.add_runtime_dependency 'cocoapods-trunk', '>= 1.2.0', '< 2.0'
s.add_runtime_dependency 'cocoapods-try', '>= 1.1.0', '< 2.0'
s.add_runtime_dependency 'molinillo', '~> 0.5.7'
s.add_runtime_dependency 'molinillo', '~> 0.6.0'
s.add_runtime_dependency 'xcodeproj', '>= 1.5.1', '< 2.0'
## Version 5 needs Ruby 2.2, so we specify an upper bound to stay compatible with system ruby
......
......@@ -208,13 +208,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-AFNetworking Example-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
CC1632E381344B54BA63986B /* [CP] Copy Pods Resources */ = {
......
......@@ -320,13 +320,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-AFNetworking iOS Example-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
......
......@@ -179,21 +179,33 @@ module Pod
# @param [Specification] spec the specification in question.
#
def requirement_satisfied_by?(requirement, activated, spec)
existing_vertices = activated.vertices.values.select do |v|
Specification.root_name(v.name) == requirement.root_name
version = spec.version
return false unless requirement.requirement.satisfied_by?(version)
shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
return false if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
return false if version.prerelease? && !prerelease_requirement
return false unless spec_is_platform_compatible?(activated, requirement, spec)
true
end
existing = existing_vertices.map(&:payload).compact.first
requirement_satisfied =
if existing
existing.version == spec.version && requirement.requirement.satisfied_by?(spec.version)
def possibility_versions_for_root_name(requirement, activated)
prerelease_requirement = requirement.prerelease? || requirement.external_source
existing = activated.vertices.values.flat_map do |vertex|
next unless vertex.payload
next unless Specification.root_name(vertex.name) == requirement.root_name
prerelease_requirement ||= vertex.requirements.any? { |r| r.prerelease? || r.external_source }
if vertex.payload.respond_to?(:possibilities)
vertex.payload.possibilities.map(&:version)
else
requirement.requirement.satisfied_by? spec.version
vertex.payload.version
end
requirement_satisfied && !(
spec.version.prerelease? &&
existing_vertices.flat_map(&:requirements).none? { |r| r.prerelease? || r.external_source }
) && spec_is_platform_compatible?(activated, requirement, spec)
end.compact
[existing, prerelease_requirement]
end
private :possibility_versions_for_root_name
# Sort dependencies so that the ones that are easiest to resolve are first.
# Easiest to resolve is (usually) defined by:
......@@ -399,25 +411,29 @@ module Pod
# @param [Molinillo::ResolverError] error
#
def handle_resolver_error(error)
message = error.message.dup
message = error.message
type = Informative
case error
when Molinillo::VersionConflict
error.conflicts.each do |name, conflict|
message = error.message_with_trees(
:solver_name => 'CocoaPods',
:possibility_type => 'pod',
:version_for_spec => lambda(&:version),
:additional_message_for_conflict => lambda do |o, name, conflict|
local_pod_parent = conflict.requirement_trees.flatten.reverse.find(&:local?)
lockfile_reqs = conflict.requirements[name_for_locking_dependency_source]
if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing
message = 'Due to the previous naïve CocoaPods resolver, ' \
o << "\nDue to the previous naïve CocoaPods resolver, " \
"you were using a pre-release version of `#{name}`, " \
'without explicitly asking for a pre-release version, which now leads to a conflict. ' \
'Please decide to either use that pre-release version by adding the ' \
'version requirement to your Podfile ' \
"(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
"or revert to a stable version by running `pod update #{name}`."
elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility
elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility && conflict.locked_requirement
# Conflict was caused by a requirement from a local dependency.
# Tell user to use `pod update`.
message << "\n\nIt seems like you've changed the constraints of dependency `#{name}` " \
o << "\nIt seems like you've changed the constraints of dependency `#{name}` " \
"inside your development pod `#{local_pod_parent.name}`.\nYou should run `pod update #{name}` to apply " \
"changes you've made."
elsif (conflict.possibility && conflict.possibility.version.prerelease?) &&
......@@ -427,13 +443,13 @@ module Pod
)
# Conflict was caused by not specifying an explicit version for the requirement #[name],
# and there is no available stable version satisfying constraints for the requirement.
message = "There are only pre-release versions available satisfying the following requirements:\n"
o << "\nThere are only pre-release versions available satisfying the following requirements:\n"
conflict.requirements.values.flatten.each do |r|
unless search_for(r).empty?
message << "\n\t'#{name}', '#{r.requirement}'\n"
o << "\n\t'#{name}', '#{r.requirement}'\n"
end
end
message << "\nYou should explicitly specify the version in order to install a pre-release version"
o << "\nYou should explicitly specify the version in order to install a pre-release version"
elsif !conflict.existing
conflicts = conflict.requirements.values.flatten.uniq
found_conflicted_specs = conflicts.reject { |c| search_for(c).empty? }
......@@ -441,22 +457,23 @@ module Pod
# There are no existing specification inside any of the spec repos with given requirements.
type = NoSpecFoundError
dependencies = conflicts.count == 1 ? 'dependency' : 'dependencies'
message << "\n\nNone of your spec sources contain a spec satisfying "\
o << "\nNone of your spec sources contain a spec satisfying "\
"the #{dependencies}: `#{conflicts.join(', ')}`." \
"\n\nYou have either:"
unless specs_updated?
message << "\n * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`."
o << "\n * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`."
end
message << "\n * mistyped the name or version." \
o << "\n * mistyped the name or version." \
"\n * not added the source repo that hosts the Podspec to your Podfile." \
"\n\nNote: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default."
else
message << "\n\nSpecs satisfying the `#{conflicts.join(', ')}` dependency were found, " \
o << "\nSpecs satisfying the `#{conflicts.join(', ')}` dependency were found, " \
'but they required a higher minimum deployment target.'
end
end
end
end,
)
end
raise type, message
end
......
......@@ -349,9 +349,13 @@ module Pod
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, config.sources_manager.all)
e = lambda { resolver.resolve }.should.raise Informative
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`JSONKit \(= 1.4\)` required by `Podfile`/)
e.message.should.match(/`JSONKit \(= 1.5pre\)` required by `Podfile`/)
e.message.should.include <<-EOS.strip
[!] CocoaPods could not find compatible versions for pod "JSONKit":
In Podfile:
JSONKit (= 1.4)
JSONKit (= 1.5pre)
EOS
end
it 'raises if it finds two conflicting dependencies' do
......@@ -362,9 +366,16 @@ module Pod
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, config.sources_manager.all)
e = lambda { resolver.resolve }.should.raise Informative
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`AFNetworking \(~> 1.3.0\)` required by `RestKit\/Network \(.*\)`/)
e.message.should.match(/`AFNetworking \(> 2\)` required by `Podfile`/)
e.message.should.include <<-EOS.strip
[!] CocoaPods could not find compatible versions for pod "AFNetworking":
In Podfile:
AFNetworking (> 2)
RestKit (= 0.23.3) was resolved to 0.23.3, which depends on
RestKit/Core (= 0.23.3) was resolved to 0.23.3, which depends on
RestKit/Network (= 0.23.3) was resolved to 0.23.3, which depends on
AFNetworking (~> 1.3.0)
EOS
end
it 'raises if no such version of a dependency exists' do
......@@ -374,14 +385,20 @@ module Pod
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, config.sources_manager.all)
e = lambda { resolver.resolve }.should.raise NoSpecFoundError
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`AFNetworking \(= 999\.999\.999\)` required by `Podfile`/)
e.message.should.match(/None of your spec sources contain a spec satisfying the dependency: `AFNetworking \(= 999\.999\.999\)`./)
e.message.should.match(/You have either:/)
e.message.should.match(/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./)
e.message.should.match(/ * mistyped the name or version./)
e.message.should.match(/ * not added the source repo that hosts the Podspec to your Podfile./)
e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./)
e.message.should.include <<-EOS.strip
[!] CocoaPods could not find compatible versions for pod "AFNetworking":
In Podfile:
AFNetworking (= 999.999.999)
None of your spec sources contain a spec satisfying the dependency: `AFNetworking \(= 999\.999\.999\)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
EOS
e.exit_status.should.equal(31)
end
......@@ -393,14 +410,19 @@ module Pod
resolver = Resolver.new(config.sandbox, podfile, empty_graph, config.sources_manager.all)
resolver.specs_updated = true
e = lambda { resolver.resolve }.should.raise NoSpecFoundError
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`AFNetworking \(= 999\.999\.999\)` required by `Podfile`/)
e.message.should.match(/None of your spec sources contain a spec satisfying the dependency: `AFNetworking \(= 999\.999\.999\)`./)
e.message.should.match(/You have either:/)
e.message.should.not.match(/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./)
e.message.should.match(/ * mistyped the name or version./)
e.message.should.match(/ * not added the source repo that hosts the Podspec to your Podfile./)
e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./)
e.message.should.include <<-EOS.strip
[!] CocoaPods could not find compatible versions for pod "AFNetworking":
In Podfile:
AFNetworking (= 999.999.999)
None of your spec sources contain a spec satisfying the dependency: `AFNetworking (= 999.999.999)`.
You have either:
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
EOS
e.exit_status.should.equal(31)
end
......@@ -413,16 +435,23 @@ module Pod
resolver = Resolver.new(config.sandbox, podfile, locked_deps, config.sources_manager.all)
e = lambda { resolver.resolve }.should.raise NoSpecFoundError
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`AFNetworking \(= 3.0.1\)` required by `Podfile`/)
e.message.should.match(/`AFNetworking \(= 1.4\)` required by `Podfile.lock`/)
e.message.should.match(/None of your spec sources contain a spec satisfying the dependencies:/)
e.message.should.match(/`AFNetworking \(= 3.0.1\), AFNetworking \(= 1.4\)`/)
e.message.should.match(/You have either:/)
e.message.should.match(/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./)
e.message.should.match(/ * mistyped the name or version./)
e.message.should.match(/ * not added the source repo that hosts the Podspec to your Podfile./)
e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./)
e.message.should.include <<-EOS.strip
[!] CocoaPods could not find compatible versions for pod "AFNetworking":
In snapshot (Podfile.lock):
AFNetworking (= 1.4)
In Podfile:
AFNetworking (= 3.0.1)
None of your spec sources contain a spec satisfying the dependencies: `AFNetworking (= 3.0.1), AFNetworking (= 1.4)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
EOS
e.exit_status.should.equal(31)
end
......
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