Skip to content

Commit f05b7bb

Browse files
authored
fix(devtools/cmd/migrate-sidekick): migrate to Library.Roots instead of RustCrate.Roots (#3332)
Migrate roots info into Library.Roots instead of Library.Rust.Roots. Migration script created a different struct as expected by [toSidekickConfig](https://github.com/googleapis/librarian/blob/main/internal/librarian/internal/rust/codec.go#L25). There is confusion that both of these Roots existed in config. Removed Library.Rust.Roots as I expect this should not be Rust specific. Expected showcase config after migration: ``` - name: google-cloud-showcase-v1beta1 version: 1.0.0 channels: - path: schema/google/showcase/v1beta1 copyright_year: "2025" output: src/generated/showcase roots: - showcase - googleapis rust: detailed_tracing_attributes: true skip_publish: true ``` Local run for both `google-cloud-showcase-v1beta1` and `google-cloud-compute-v1` succeed after this change. (compute generate produced diffs, filing different issue for it.) Fix #3324, #3329
1 parent fd24725 commit f05b7bb

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

devtools/cmd/migrate-sidekick/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ func buildGAPIC(files []string, repoPath string) (map[string]*config.Library, er
383383
}
384384

385385
titleOverride, _ := sidekick.Source["title-override"].(string)
386-
roots, _ := sidekick.Source["roots"].(string)
386+
if roots, ok := sidekick.Source["roots"].(string); ok {
387+
lib.Roots = strToSlice(roots, false)
388+
}
387389
includeList, _ := sidekick.Source["include-list"].(string)
388390
includeIds, _ := sidekick.Source["include-ids"].(string)
389391
skippedIds, _ := sidekick.Source["skipped-ids"].(string)
@@ -441,7 +443,6 @@ func buildGAPIC(files []string, repoPath string) (map[string]*config.Library, er
441443
TitleOverride: titleOverride,
442444
PackageNameOverride: packageNameOverride,
443445
RootName: rootName,
444-
Roots: strToSlice(roots, false),
445446
DefaultFeatures: strToSlice(defaultFeatures, false),
446447
IncludeList: strToSlice(includeList, false),
447448
IncludedIds: strToSlice(includeIds, false),

devtools/cmd/migrate-sidekick/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func TestBuildGAPIC(t *testing.T) {
186186
DescriptionOverride: "Description override",
187187
SpecificationFormat: "discovery",
188188
Output: "testdata/read-sidekick-files/success-read/nested",
189+
Roots: []string{"discovery", "googleapis"},
189190
Rust: &config.RustCrate{
190191
RustDefault: config.RustDefault{
191192
DisabledRustdocWarnings: []string{"bare_urls", "broken_intra_doc_links", "redundant_explicit_links"},
@@ -197,7 +198,6 @@ func TestBuildGAPIC(t *testing.T) {
197198
TitleOverride: "Google Apps Script Types",
198199
PackageNameOverride: "google-cloud-security-publicca-v1",
199200
RootName: "conformance-root",
200-
Roots: []string{"discovery", "googleapis"},
201201
DefaultFeatures: []string{"instances", "projects"},
202202
IncludeList: []string{"api.proto", "source_context.proto", "type.proto", "descriptor.proto"},
203203
IncludedIds: []string{".google.iam.v2.Resource"},

internal/config/language.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ type RustCrate struct {
133133
// RootName is the root name for the crate.
134134
RootName string `yaml:"root_name,omitempty"`
135135

136-
// Roots is a list of root names.
137-
Roots []string `yaml:"roots,omitempty"`
138-
139136
// DefaultFeatures is a list of default features to enable.
140137
DefaultFeatures []string `yaml:"default_features,omitempty"`
141138

0 commit comments

Comments
 (0)