@@ -31,7 +31,7 @@ import (
3131// Generate generates a Python client library.
3232func Generate (ctx context.Context , library * config.Library , googleapisDir string ) error {
3333 if len (library .APIs ) == 0 {
34- return fmt .Errorf ("no channels configured for library %q" , library .Name )
34+ return fmt .Errorf ("no apis configured for library %q" , library .Name )
3535 }
3636
3737 // Convert library.Output to absolute path since protoc runs from a
@@ -50,11 +50,9 @@ func Generate(ctx context.Context, library *config.Library, googleapisDir string
5050 // Some aspects of generation currently require the repo root. Compute it once here
5151 // and pass it down.
5252 repoRoot := filepath .Dir (filepath .Dir (outdir ))
53-
54- // Generate each channel separately.
55- for _ , channel := range library .APIs {
56- if err := generateAPI (ctx , channel , library , googleapisDir , repoRoot ); err != nil {
57- return fmt .Errorf ("failed to generate channel %q: %w" , channel .Path , err )
53+ for _ , api := range library .APIs {
54+ if err := generateAPI (ctx , api , library , googleapisDir , repoRoot ); err != nil {
55+ return fmt .Errorf ("failed to generate api %q: %w" , api .Path , err )
5856 }
5957 }
6058
@@ -64,19 +62,19 @@ func Generate(ctx context.Context, library *config.Library, googleapisDir string
6462
6563 // TODO(https://github.com/googleapis/librarian/issues/3146):
6664 // Remove the default version fudget here, as Generate should
67- // compute it. For now, use the last component of the first channel path as
65+ // compute it. For now, use the last component of the first api path as
6866 // the default version.
6967 defaultVersion := filepath .Base (library .APIs [0 ].Path )
7068
7169 // Generate .repo-metadata.json from the service config in the first
72- // channel .
70+ // api .
7371 // TODO(https://github.com/googleapis/librarian/issues/3159): stop
7472 // hardcoding the language and repo name, instead getting it passed in.
75- channel , err := serviceconfig .Find (googleapisDir , library .APIs [0 ].Path )
73+ api , err := serviceconfig .Find (googleapisDir , library .APIs [0 ].Path )
7674 if err != nil {
7775 return fmt .Errorf ("failed to find service config: %w" , err )
7876 }
79- absoluteServiceConfig := filepath .Join (googleapisDir , channel .ServiceConfig )
77+ absoluteServiceConfig := filepath .Join (googleapisDir , api .ServiceConfig )
8078 if err := repometadata .Generate (library , "python" , "googleapis/google-cloud-python" , absoluteServiceConfig , defaultVersion , outdir ); err != nil {
8179 return fmt .Errorf ("failed to generate .repo-metadata.json: %w" , err )
8280 }
@@ -100,32 +98,32 @@ func Generate(ctx context.Context, library *config.Library, googleapisDir string
10098 return nil
10199}
102100
103- // generateAPI generates part of a library for a single channel .
104- func generateAPI (ctx context.Context , channel * config.API , library * config.Library , googleapisDir , repoRoot string ) error {
101+ // generateAPI generates part of a library for a single api .
102+ func generateAPI (ctx context.Context , api * config.API , library * config.Library , googleapisDir , repoRoot string ) error {
105103 // Note: the Python Librarian container generates to a temporary directory,
106104 // then the results into owl-bot-staging. We generate straight into
107105 // owl-bot-staging instead. The post-processor then moves the files into
108106 // the correct final position in the repository.
109107 // TODO(https://github.com/googleapis/librarian/issues/3210): generate
110108 // directly in place.
111109
112- stagingChildDirectory := getStagingChildDirectory (channel .Path )
110+ stagingChildDirectory := getStagingChildDirectory (api .Path )
113111 stagingDir := filepath .Join (repoRoot , "owl-bot-staging" , library .Name , stagingChildDirectory )
114112 if err := os .MkdirAll (stagingDir , 0755 ); err != nil {
115113 return err
116114 }
117- protocOptions , err := createProtocOptions (channel , library , googleapisDir , stagingDir )
115+ protocOptions , err := createProtocOptions (api , library , googleapisDir , stagingDir )
118116 if err != nil {
119117 return err
120118 }
121119
122- apiDir := filepath .Join (googleapisDir , channel .Path )
120+ apiDir := filepath .Join (googleapisDir , api .Path )
123121 protos , err := filepath .Glob (apiDir + "/*.proto" )
124122 if err != nil {
125123 return fmt .Errorf ("failed to find protos: %w" , err )
126124 }
127125 if len (protos ) == 0 {
128- return fmt .Errorf ("no protos found in channel %q" , channel .Path )
126+ return fmt .Errorf ("no protos found in api %q" , api .Path )
129127 }
130128
131129 // We want the proto filenames to be relative to googleapisDir
@@ -167,11 +165,11 @@ func createProtocOptions(ch *config.API, library *config.Library, googleapisDir,
167165 opts = append (opts , "metadata" )
168166
169167 // Add Python-specific options
170- // First common options that apply to all channels
168+ // First common options that apply to all apis
171169 if library .Python != nil && len (library .Python .OptArgs ) > 0 {
172170 opts = append (opts , library .Python .OptArgs ... )
173171 }
174- // Then options that apply to this specific channel
172+ // Then options that apply to this specific api
175173 if library .Python != nil && len (library .Python .OptArgsByAPI ) > 0 {
176174 apiOptArgs , ok := library .Python .OptArgsByAPI [ch .Path ]
177175 if ok {
@@ -202,12 +200,12 @@ func createProtocOptions(ch *config.API, library *config.Library, googleapisDir,
202200 if grpcConfigPath != "" {
203201 opts = append (opts , fmt .Sprintf ("retry-config=%s" , grpcConfigPath ))
204202 }
205- channel , err := serviceconfig .Find (googleapisDir , ch .Path )
203+ api , err := serviceconfig .Find (googleapisDir , ch .Path )
206204 if err != nil {
207205 return nil , err
208206 }
209- if channel != nil && channel .ServiceConfig != "" {
210- opts = append (opts , fmt .Sprintf ("service-yaml=%s" , channel .ServiceConfig ))
207+ if api != nil && api .ServiceConfig != "" {
208+ opts = append (opts , fmt .Sprintf ("service-yaml=%s" , api .ServiceConfig ))
211209 }
212210
213211 return []string {
0 commit comments