@@ -126,39 +126,40 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
126126	return  gps.SimpleManifest {}, nil , nil 
127127}
128128
129- func  (a  * rootAnalyzer ) FinalizeRootManifestAndLock (m  * dep.Manifest , l  * dep.Lock ) {
130- 	// Remove dependencies from the manifest that aren't used 
131- 	for  pr  :=  range  m .Constraints  {
132- 		var  used  bool 
133- 		for  _ , y  :=  range  l .Projects () {
134- 			if  pr  ==  y .Ident ().ProjectRoot  {
135- 				used  =  true 
136- 				break 
137- 			}
138- 		}
139- 		if  ! used  {
140- 			delete (m .Constraints , pr )
141- 		}
142- 	}
143- 	// Pick the direct dependencies from the solution lock and add to manifest. 
144- 	// This is done to fill up the manifest constraints with the dependencies 
145- 	// solved over the network. 
129+ func  (a  * rootAnalyzer ) FinalizeRootManifestAndLock (m  * dep.Manifest , l  * dep.Lock , ol  dep.Lock ) {
130+ 	a .removeTransitiveDependencies (m )
131+ 
132+ 	// Iterate through the new projects in solved lock and add them to manifest 
133+ 	// if they are direct deps and log feedback for all the new projects. 
146134	for  _ , y  :=  range  l .Projects () {
147135		var  f  * fb.ConstraintFeedback 
148136		pr  :=  y .Ident ().ProjectRoot 
137+ 		// New constraints: in new lock and dir dep but not in manifest 
149138		if  _ , ok  :=  a .directDeps [string (pr )]; ok  {
150- 			pp  :=  getProjectPropertiesFromVersion (y .Version ())
151- 			if  pp .Constraint  !=  nil  {
152- 				m .Constraints [pr ] =  pp 
153- 				pc  :=  gps.ProjectConstraint {Ident : y .Ident (), Constraint : pp .Constraint }
154- 				f  =  fb .NewConstraintFeedback (pc , fb .DepTypeDirect )
155- 			} else  {
156- 				f  =  fb .NewLockedProjectFeedback (y , fb .DepTypeDirect )
139+ 			if  _ , ok  :=  m .Constraints [pr ]; ! ok  {
140+ 				pp  :=  getProjectPropertiesFromVersion (y .Version ())
141+ 				if  pp .Constraint  !=  nil  {
142+ 					m .Constraints [pr ] =  pp 
143+ 					pc  :=  gps.ProjectConstraint {Ident : y .Ident (), Constraint : pp .Constraint }
144+ 					f  =  fb .NewConstraintFeedback (pc , fb .DepTypeDirect )
145+ 				} else  {
146+ 					f  =  fb .NewLockedProjectFeedback (y , fb .DepTypeDirect )
147+ 				}
148+ 				f .LogFeedback (a .ctx .Err )
157149			}
158150		} else  {
159- 			f  =  fb .NewLockedProjectFeedback (y , fb .DepTypeTransitive )
151+ 			// New locked projects: in new lock but not in old lock 
152+ 			newProject  :=  true 
153+ 			for  _ , opl  :=  range  ol .Projects () {
154+ 				if  pr  ==  opl .Ident ().ProjectRoot  {
155+ 					newProject  =  false 
156+ 				}
157+ 			}
158+ 			if  newProject  {
159+ 				f  =  fb .NewLockedProjectFeedback (y , fb .DepTypeTransitive )
160+ 				f .LogFeedback (a .ctx .Err )
161+ 			}
160162		}
161- 		f .LogFeedback (a .ctx .Err )
162163	}
163164}
164165
0 commit comments