@@ -61,8 +61,8 @@ func (r *ReleaseGoplsTasks) NewPrereleaseDefinition() *wf.Definition {
61
61
prereleaseVerified := wf .Action1 (wd , "verify installing latest gopls using release branch pre-release version" , r .verifyGoplsInstallation , prereleaseVersion )
62
62
wf .Action4 (wd , "mail announcement" , r .mailAnnouncement , release , prereleaseVersion , dependencyCommit , issue , wf .After (prereleaseVerified ))
63
63
64
- vscodeGoChange := wf .Task4 (wd , "update gopls version in vscode-go project " , r .updateGoplsVersionInVSCodeGo , reviewers , issue , prereleaseVersion , wf . Const ( "master" ) , wf .After (prereleaseVerified ))
65
- _ = wf .Task1 (wd , "await gopls version update CL submission in vscode-go project " , clAwaiter {r .Gerrit }.awaitSubmission , vscodeGoChange )
64
+ vscodeGoChanges := wf .Task4 (wd , "update gopls version in vscode-go" , r .updateVSCodeGoGoplsVersion , reviewers , issue , release , prerelease , wf .After (prereleaseVerified ))
65
+ _ = wf .Task1 (wd , "await gopls version update CLs submission in vscode-go" , clAwaiter {r .Gerrit }.awaitSubmissions , vscodeGoChanges )
66
66
67
67
wf .Output (wd , "version" , prereleaseVersion )
68
68
@@ -501,40 +501,6 @@ func (r *ReleaseGoplsTasks) mailAnnouncement(ctx *wf.TaskContext, semv semversio
501
501
return r .SendMail (r .AnnounceMailHeader , content )
502
502
}
503
503
504
- func (r * ReleaseGoplsTasks ) updateGoplsVersionInVSCodeGo (ctx * wf.TaskContext , reviewers []string , issue int64 , version , branch string ) (string , error ) {
505
- clTitle := fmt .Sprintf (`extension/src/goToolsInformation: update gopls version %s` , version )
506
- if branch != "master" {
507
- clTitle = "[" + branch + "] " + clTitle
508
- }
509
- openCL , err := openCL (ctx , r .Gerrit , "vscode-go" , branch , clTitle )
510
- if err != nil {
511
- return "" , fmt .Errorf ("failed to find the open CL of title %q in branch %q: %w" , clTitle , branch , err )
512
- }
513
- if openCL != "" {
514
- ctx .Printf ("not creating CL: found existing CL %s" , openCL )
515
- return openCL , nil
516
- }
517
- const script = `go run -C extension tools/generate.go -tools`
518
- changedFiles , err := executeAndMonitorChange (ctx , r .CloudBuild , "vscode-go" , branch , script , []string {"extension/src/goToolsInformation.ts" })
519
- if err != nil {
520
- return "" , err
521
- }
522
-
523
- // Skip CL creation as nothing changed.
524
- if len (changedFiles ) == 0 {
525
- return "" , nil
526
- }
527
-
528
- changeInput := gerrit.ChangeInput {
529
- Project : "vscode-go" ,
530
- Branch : branch ,
531
- Subject : fmt .Sprintf ("%s\n \n This is an automated CL which updates the gopls version.\n \n For golang/go#%v" , clTitle , issue ),
532
- }
533
-
534
- ctx .Printf ("creating auto-submit change under branch %q in vscode-go repo." , branch )
535
- return r .Gerrit .CreateAutoSubmitChange (ctx , changeInput , reviewers , changedFiles )
536
- }
537
-
538
504
func (r * ReleaseGoplsTasks ) isValidReleaseVersion (ctx * wf.TaskContext , ver string ) error {
539
505
if ! semver .IsValid (ver ) {
540
506
return fmt .Errorf ("the input %q version does not follow semantic version schema" , ver )
@@ -680,6 +646,9 @@ func (r *ReleaseGoplsTasks) NewReleaseDefinition() *wf.Definition {
680
646
changeID := wf .Task3 (wd , "updating x/tools dependency in master branch in gopls sub dir" , r .updateDependencyIfMinor , reviewers , release , issue , wf .After (tagged ))
681
647
_ = wf .Task1 (wd , "await x/tools gopls dependency CL submission in gopls sub dir" , clAwaiter {r .Gerrit }.awaitSubmission , changeID )
682
648
649
+ vscodeGoChanges := wf .Task4 (wd , "update gopls version in vscode-go" , r .updateVSCodeGoGoplsVersion , reviewers , issue , release , wf .Const ("" ), wf .After (tagged ))
650
+ _ = wf .Task1 (wd , "await gopls version update CLs submission in vscode-go" , clAwaiter {r .Gerrit }.awaitSubmissions , vscodeGoChanges )
651
+
683
652
return wd
684
653
}
685
654
@@ -704,6 +673,67 @@ func (r *ReleaseGoplsTasks) latestPrerelease(ctx *wf.TaskContext, semv semversio
704
673
return rc .Pre , nil
705
674
}
706
675
676
+ // updateVSCodeGoGoplsVersion updates the gopls version in the vscode-go project.
677
+ // For releases (input param prerelease is empty), it updates both the master
678
+ // and release branches.
679
+ // For pre-releases (input param prerelease is not empty), it updates only the
680
+ // master branch.
681
+ func (r * ReleaseGoplsTasks ) updateVSCodeGoGoplsVersion (ctx * wf.TaskContext , reviewers []string , issue int64 , release semversion , prerelease string ) ([]string , error ) {
682
+ version := fmt .Sprintf ("v%v.%v.%v" , release .Major , release .Minor , release .Patch )
683
+ if prerelease != "" {
684
+ version = version + "-" + prerelease
685
+ }
686
+ branches := []string {"master" }
687
+ if prerelease == "" {
688
+ releaseBranch , err := vsCodeGoActiveReleaseBranch (ctx , r .Gerrit )
689
+ if err != nil {
690
+ return nil , err
691
+ }
692
+ branches = append (branches , releaseBranch )
693
+ }
694
+
695
+ var cls []string
696
+ for _ , branch := range branches {
697
+ clTitle := fmt .Sprintf (`extension/src/goToolsInformation: update gopls version %s` , version )
698
+ if branch != "master" {
699
+ clTitle = "[" + branch + "] " + clTitle
700
+ }
701
+ openCL , err := openCL (ctx , r .Gerrit , "vscode-go" , branch , clTitle )
702
+ if err != nil {
703
+ return nil , fmt .Errorf ("failed to find the open CL of title %q in branch %q: %w" , clTitle , branch , err )
704
+ }
705
+ if openCL != "" {
706
+ ctx .Printf ("not creating CL: found existing CL %s" , openCL )
707
+ cls = append (cls , openCL )
708
+ continue
709
+ }
710
+ const script = `go run -C extension tools/generate.go -tools`
711
+ changedFiles , err := executeAndMonitorChange (ctx , r .CloudBuild , "vscode-go" , branch , script , []string {"extension/src/goToolsInformation.ts" })
712
+ if err != nil {
713
+ return nil , err
714
+ }
715
+
716
+ // Skip CL creation as nothing changed.
717
+ if len (changedFiles ) == 0 {
718
+ continue
719
+ }
720
+
721
+ changeInput := gerrit.ChangeInput {
722
+ Project : "vscode-go" ,
723
+ Branch : branch ,
724
+ Subject : fmt .Sprintf ("%s\n \n This is an automated CL which updates the gopls version.\n \n For golang/go#%v" , clTitle , issue ),
725
+ }
726
+
727
+ cl , err := r .Gerrit .CreateAutoSubmitChange (ctx , changeInput , reviewers , changedFiles )
728
+ if err != nil {
729
+ return nil , err
730
+ }
731
+ ctx .Printf ("created auto-submit change %s under branch %q in vscode-go." , cl , branch )
732
+ cls = append (cls , cl )
733
+ }
734
+ return cls , nil
735
+ }
736
+
707
737
// tagRelease locates the commit associated with the pre-release version and
708
738
// applies the official release tag in form of "gopls/vX.Y.Z" to the same commit.
709
739
func (r * ReleaseGoplsTasks ) tagRelease (ctx * wf.TaskContext , semv semversion , prerelease string ) error {
0 commit comments