@@ -126,39 +126,40 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
126
126
return gps.SimpleManifest {}, nil , nil
127
127
}
128
128
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
+ // Iterate through the new projects in solved lock and add them to manifest
131
+ // if they are direct deps and log feedback for all the new projects.
132
+ a .removeTransitiveDependencies (m )
133
+
146
134
for _ , y := range l .Projects () {
147
135
var f * fb.ConstraintFeedback
148
136
pr := y .Ident ().ProjectRoot
137
+ // New constraints: in new lock and dir dep but not in manifest
149
138
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 )
157
149
}
158
150
} 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
+ }
160
162
}
161
- f .LogFeedback (a .ctx .Err )
162
163
}
163
164
}
164
165
0 commit comments