-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Bundling sometimes fails on JRuby #4102
Comments
The same failure happens for JRuby 1.7.22 as well |
I created a simple gem called lib/bundler/definition.rb seems to be where the This code then goes on to construct the def resolve
@resolve ||= begin
last_resolve = converge_locked_specs
if Bundler.settings[:frozen] || (!@unlocking && nothing_changed?)
last_resolve
else
# Run a resolve against the locally available gems
requested_ruby_version = ruby_version.version if ruby_version
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, requested_ruby_version)
end
end
end Now, I was able to dig in and hack a fix, but I don't really understand what all the pieces are supposed to do yet. So, I don't really understand what the purpose of
The key thing to notice is that it starts with the def expanded_dependencies
@expanded_dependencies ||= expand_dependencies(dependencies, @remote)
end
def expand_dependencies(dependencies, remote = false)
deps = []
dependencies.each do |dep|
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
next unless remote || dep.current_platform?
dep.gem_platforms(@platforms).each do |p|
# ========> NOTE: The following line is my patch <========
next if p == "ruby" && dep.name == "example"
deps << DepProxy.new(dep, p) if remote || p == generic(Gem::Platform.local)
end
end
deps
end So this drops the Let's dig deeper into what's going on by looking at lib/bundler/resolver.rb.
The last line of search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform(platform) } The Let's look at where In the reverse case (going from Now.... what needs to change...? |
Wow, great job investigating! I think the platform in the dependency is the problem here, but I can't be sure. |
…in the gemspec This fixes rubygems#4102
@segiddins thanks! After more investigating, I think I figured out a solution that works, and yeah, the dependency platforms was the problem. My solution restricts the platforms to what the gemspec indicates the platforms are, which causes the |
Restrict platforms when using gemspec in DSL When referencing a `gemspec` in the `Gemfile`, restrict what platforms to check against to just those defined by the `gemspec` itself. This fixes #4102
…reaking-windows, r=indirect Restrict gemspec platforms without breaking windows This keeps the fix for #4102 but also fixes #4150 I added a test which fails if #4102 is broken, but also fails if #4150 is broken. I have run the specs in the following scenarios: * With the original Bundler code: the JRuby spec breaks but the Windows one passes * With my previous fix attempt: the JRuby spec passes but the Windows one breaks * With this new fix: both pass
Platform related dependencies are resolved in Resolver now. So we don't need to register all available platforms explicitly. This reverts commit 0a8ca48. See also: rubygems#4150 and rubygems#4102
Platform related dependencies are resolved in Resolver now. So we don't need to register all available platforms explicitly. This reverts commit 0a8ca48. See also: rubygems#4150 and rubygems#4102
Platform related dependencies are resolved in Resolver now. So we don't need to register all available platforms explicitly. This reverts commit 0a8ca48. See also: rubygems#4150 and rubygems#4102
Platform related dependencies are resolved in Resolver now. So we don't need to register all available platforms explicitly. This reverts commit 0a8ca48. See also: rubygems#4150 and rubygems#4102
If I bundle Gemstash from MRI, creating a
Gemfile.lock
and then switch to JRuby, bundling with missing gems fails with the following error:Doing the reverse works fine. (see the shell session at the bottom to see a full example of the problem)
The
Gemfile
simply points to the gemspec:I suspect the key to the problem may be how I specified the platform:
Which produces this in my lock on MRI:
And this in JRuby:
I am using MRI 2.2.2 and JRuby 9.0.3.0.
Example shell session illustrating the problem:
The text was updated successfully, but these errors were encountered: