@@ -38,6 +38,9 @@ import {BranchName} from '../util/branch-name';
3838import { PatchVersionUpdate } from '../versioning-strategy' ;
3939import { CargoLock } from '../updaters/rust/cargo-lock' ;
4040import { ConfigurationError } from '../errors' ;
41+ import { Strategy } from '../strategy' ;
42+ import { Commit } from '../commit' ;
43+ import { Release } from '../release' ;
4144
4245interface CrateInfo {
4346 /**
@@ -79,6 +82,9 @@ interface CrateInfo {
7982 * into a single rust package.
8083 */
8184export class CargoWorkspace extends WorkspacePlugin < CrateInfo > {
85+ private strategiesByPath : Record < string , Strategy > = { } ;
86+ private releasesByPath : Record < string , Release > = { } ;
87+
8288 protected async buildAllPackages (
8389 candidates : CandidateReleasePullRequest [ ]
8490 ) : Promise < {
@@ -252,6 +258,34 @@ export class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
252258 originalManifest ,
253259 updatedManifest
254260 ) ;
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+
255289 const pullRequest : ReleasePullRequest = {
256290 title : PullRequestTitle . ofTargetBranch ( this . targetBranch ) ,
257291 body : new PullRequestBody ( [
@@ -367,6 +401,18 @@ export class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
367401 protected pathFromPackage ( pkg : CrateInfo ) : string {
368402 return pkg . path ;
369403 }
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+ }
370416}
371417
372418function getChangelogDepsNotes (
0 commit comments