@@ -38,6 +38,9 @@ import {BranchName} from '../util/branch-name';
38
38
import { PatchVersionUpdate } from '../versioning-strategy' ;
39
39
import { CargoLock } from '../updaters/rust/cargo-lock' ;
40
40
import { ConfigurationError } from '../errors' ;
41
+ import { Strategy } from '../strategy' ;
42
+ import { Commit } from '../commit' ;
43
+ import { Release } from '../release' ;
41
44
42
45
interface CrateInfo {
43
46
/**
@@ -79,6 +82,9 @@ interface CrateInfo {
79
82
* into a single rust package.
80
83
*/
81
84
export class CargoWorkspace extends WorkspacePlugin < CrateInfo > {
85
+ private strategiesByPath : Record < string , Strategy > = { } ;
86
+ private releasesByPath : Record < string , Release > = { } ;
87
+
82
88
protected async buildAllPackages (
83
89
candidates : CandidateReleasePullRequest [ ]
84
90
) : Promise < {
@@ -252,6 +258,34 @@ export class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
252
258
originalManifest ,
253
259
updatedManifest
254
260
) ;
261
+
262
+ const updatedPackage = {
263
+ ...pkg ,
264
+ version : version . toString ( ) ,
265
+ } ;
266
+
267
+ const strategy = this . strategiesByPath [ updatedPackage . path ] ;
268
+ const latestRelease = this . releasesByPath [ updatedPackage . path ] ;
269
+ const basePullRequest = strategy
270
+ ? await strategy . buildReleasePullRequest ( [ ] , latestRelease , false , [ ] , {
271
+ newVersion : version ,
272
+ } )
273
+ : undefined ;
274
+
275
+ if ( basePullRequest ) {
276
+ return this . updateCandidate (
277
+ {
278
+ path : pkg . path ,
279
+ pullRequest : basePullRequest ,
280
+ config : {
281
+ releaseType : 'rust' ,
282
+ } ,
283
+ } ,
284
+ pkg ,
285
+ updatedVersions
286
+ ) ;
287
+ }
288
+
255
289
const pullRequest : ReleasePullRequest = {
256
290
title : PullRequestTitle . ofTargetBranch ( this . targetBranch ) ,
257
291
body : new PullRequestBody ( [
@@ -367,6 +401,18 @@ export class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
367
401
protected pathFromPackage ( pkg : CrateInfo ) : string {
368
402
return pkg . path ;
369
403
}
404
+
405
+ async preconfigure (
406
+ strategiesByPath : Record < string , Strategy > ,
407
+ _commitsByPath : Record < string , Commit [ ] > ,
408
+ _releasesByPath : Record < string , Release >
409
+ ) : Promise < Record < string , Strategy > > {
410
+ // Using preconfigure to siphon releases and strategies.
411
+ this . strategiesByPath = strategiesByPath ;
412
+ this . releasesByPath = _releasesByPath ;
413
+
414
+ return strategiesByPath ;
415
+ }
370
416
}
371
417
372
418
function getChangelogDepsNotes (
0 commit comments