[rubygems/rubygems] Remove unnecessary remapping of dependencies
Sometimes we'll resolve using bare `Gem::Dependency` instances rather than `Bundler::Dependency` instances, which is fine, simpler, and saves some memory. When resolving from scratch a Gemfile including only `"gem "rails", "~> 8.0.1"`, I get the following results: ### Before Total allocated: 277.48 MB (3384318 objects) Total retained: 117.53 MB (1338657 objects) ### After Total allocated: 265.06 MB (3186053 objects) Total retained: 116.98 MB (1302280 objects) https://github.com/rubygems/rubygems/commit/c6dc2966c5
This commit is contained in:
parent
4c0cf2deed
commit
7fed6c887d
@ -36,6 +36,7 @@ module Bundler
|
|||||||
def dependencies
|
def dependencies
|
||||||
@dependencies ||= @unbuilt_dependencies.map! {|dep, reqs| build_dependency(dep, reqs) }
|
@dependencies ||= @unbuilt_dependencies.map! {|dep, reqs| build_dependency(dep, reqs) }
|
||||||
end
|
end
|
||||||
|
alias_method :runtime_dependencies, :dependencies
|
||||||
|
|
||||||
# needed for standalone, load required_paths from local gemspec
|
# needed for standalone, load required_paths from local gemspec
|
||||||
# after the gem is installed
|
# after the gem is installed
|
||||||
@ -167,7 +168,7 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_dependency(name, requirements)
|
def build_dependency(name, requirements)
|
||||||
Gem::Dependency.new(name, requirements)
|
Dependency.new(name, requirements)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ module Bundler
|
|||||||
|
|
||||||
def dependencies
|
def dependencies
|
||||||
@dependencies ||= @specs.flat_map do |spec|
|
@dependencies ||= @specs.flat_map do |spec|
|
||||||
__dependencies(spec) + metadata_dependencies(spec)
|
spec.runtime_dependencies + metadata_dependencies(spec)
|
||||||
end.uniq.sort
|
end.uniq.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,15 +72,6 @@ module Bundler
|
|||||||
@specs.first
|
@specs.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def __dependencies(spec)
|
|
||||||
dependencies = []
|
|
||||||
spec.dependencies.each do |dep|
|
|
||||||
next if dep.type == :development
|
|
||||||
dependencies << Dependency.new(dep.name, dep.requirement)
|
|
||||||
end
|
|
||||||
dependencies
|
|
||||||
end
|
|
||||||
|
|
||||||
def metadata_dependencies(spec)
|
def metadata_dependencies(spec)
|
||||||
[
|
[
|
||||||
metadata_dependency("Ruby", spec.required_ruby_version),
|
metadata_dependency("Ruby", spec.required_ruby_version),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user