Skip to content

Commit ddb3a29

Browse files
authored
fix(devtools/cmd/migrate-sidekick): add SkipGenerate if no modules found for veener (#3323)
Adds SkipGenerate true to migrated config if there is no modules found for veener. The migration script assumes a veener library for all Cargo.toml files within the `src` directory and not under `src/generated` paths, then determines rust.modules by looks for .sidekick.toml files within the directory of the Cargo.toml. For modules with no .sidekick.toml files, e.g. google-cloud-auth, these are handwritten modules with no generated code. They should be skipped in generate command, setting SkipGenerate to indicate it. [librarian.yaml](https://paste.googleplex.com/4849268869431296) produced after this change. Fix #3318 For #3313
1 parent b95e2d6 commit ddb3a29

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

devtools/cmd/migrate-sidekick/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,12 @@ func buildVeneer(files []string) (map[string]*config.Library, error) {
529529
Version: cargo.Package.Version,
530530
CopyrightYear: "2025",
531531
}
532-
if rustModules != nil {
532+
if len(rustModules) > 0 {
533533
veneers[name].Rust = &config.RustCrate{
534534
Modules: rustModules,
535535
}
536+
} else {
537+
veneers[name].SkipGenerate = true
536538
}
537539
}
538540

devtools/cmd/migrate-sidekick/main_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,23 @@ func TestBuildVeneer(t *testing.T) {
455455
Output: "testdata/build-veneer/success/lib-2",
456456
Version: "0.0.0",
457457
CopyrightYear: "2025",
458+
SkipGenerate: true,
459+
},
460+
},
461+
},
462+
{
463+
name: "no_rust_modules",
464+
files: []string{
465+
"testdata/build-veneer/success/lib-2/Cargo.toml",
466+
},
467+
want: map[string]*config.Library{
468+
"google-cloud-spanner": {
469+
Name: "google-cloud-spanner",
470+
Veneer: true,
471+
Output: "testdata/build-veneer/success/lib-2",
472+
Version: "0.0.0",
473+
CopyrightYear: "2025",
474+
SkipGenerate: true,
458475
},
459476
},
460477
},

0 commit comments

Comments
 (0)