@@ -99,15 +99,24 @@ def to_lock
9999 out
100100 end
101101
102- def materialize_for_installation ( most_specific_locked_platform = nil )
102+ def materialize_strictly
103103 source . local!
104104
105- matching_specs = source . specs . search ( use_exact_resolved_specifications? ( most_specific_locked_platform ) ? self : [ name , version ] )
105+ matching_specs = source . specs . search ( self )
106106 return self if matching_specs . empty?
107107
108- candidates = if use_exact_resolved_specifications? ( most_specific_locked_platform )
109- matching_specs
108+ __materialize__ ( matching_specs )
109+ end
110+
111+ def materialize_for_installation ( most_specific_locked_platform = nil )
112+ source . local!
113+
114+ if use_exact_resolved_specifications? ( most_specific_locked_platform )
115+ materialize_strictly
110116 else
117+ matching_specs = source . specs . search ( [ name , version ] )
118+ return self if matching_specs . empty?
119+
111120 target_platform = source . is_a? ( Source ::Path ) ? platform : local_platform
112121
113122 installable_candidates = GemHelpers . select_best_platform_match ( matching_specs , target_platform )
@@ -119,10 +128,8 @@ def materialize_for_installation(most_specific_locked_platform = nil)
119128 installable_candidates = GemHelpers . select_best_platform_match ( matching_specs , platform )
120129 end
121130
122- installable_candidates
131+ __materialize__ ( installable_candidates )
123132 end
124-
125- __materialize__ ( candidates )
126133 end
127134
128135 # If in frozen mode, we fallback to a non-installable candidate because by
@@ -143,8 +150,12 @@ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bund
143150 # `bundler/setup` performance
144151 if search . is_a? ( StubSpecification )
145152 search . dependencies = dependencies
146- elsif !source . is_a? ( Source ::Path ) && search . runtime_dependencies . sort != dependencies . sort
147- raise IncorrectLockfileDependencies . new ( self )
153+ else
154+ if !source . is_a? ( Source ::Path ) && search . runtime_dependencies . sort != dependencies . sort
155+ raise IncorrectLockfileDependencies . new ( self )
156+ end
157+
158+ search . locked_platform = platform if search . instance_of? ( RemoteSpecification ) || search . instance_of? ( EndpointSpecification )
148159 end
149160 end
150161 search
0 commit comments