Skip to content

Commit

Permalink
Rename Rust server codegen plugins
Browse files Browse the repository at this point in the history
Rename `RustCodegenServerPlugin` to `RustServerCodegenPlugin`, for
consistency with `RustClientCodegenPlugin`. This is a better name, since
the plugin is named `rust-server-codegen`.

This commit also renames `PythonCodegenServerPlugin` to
`RustServerCodegenPythonPlugin` for the same reasons.

This commit also contains other drive-by improvements made while working
on #2302.
  • Loading branch information
david-perez committed Feb 6, 2023
1 parent ff8178a commit 2d5b6bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class PythonServerCodegenVisitor(
serviceShape: ServiceShape,
symbolVisitorConfig: SymbolVisitorConfig,
publicConstrainedTypes: Boolean,
) = PythonCodegenServerPlugin.baseSymbolProvider(model, serviceShape, symbolVisitorConfig, publicConstrainedTypes)
) = RustServerCodegenPythonPlugin.baseSymbolProvider(model, serviceShape, symbolVisitorConfig, publicConstrainedTypes)

val serverSymbolProviders = ServerSymbolProviders.from(
model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import software.amazon.smithy.rust.codegen.core.rustlang.RustReservedWordSymbolP
import software.amazon.smithy.rust.codegen.core.smithy.BaseSymbolMetadataProvider
import software.amazon.smithy.rust.codegen.core.smithy.CodegenTarget
import software.amazon.smithy.rust.codegen.core.smithy.EventStreamSymbolProvider
import software.amazon.smithy.rust.codegen.core.smithy.SymbolVisitor
import software.amazon.smithy.rust.codegen.core.smithy.SymbolVisitorConfig
import software.amazon.smithy.rust.codegen.server.python.smithy.customizations.DECORATORS
import software.amazon.smithy.rust.codegen.server.smithy.ConstrainedShapeSymbolMetadataProvider
Expand All @@ -26,16 +25,20 @@ import java.util.logging.Level
import java.util.logging.Logger

/**
* Rust with Python bindings Codegen Plugin.
* Rust Server with Python bindings Codegen Plugin.
*
* This is the entrypoint for code generation, triggered by the smithy-build plugin.
* `resources/META-INF.services/software.amazon.smithy.build.SmithyBuildPlugin` refers to this class by name which
* enables the smithy-build plugin to invoke `execute` with all of the Smithy plugin context + models.
*/
class PythonCodegenServerPlugin : SmithyBuildPlugin {
class RustServerCodegenPythonPlugin : SmithyBuildPlugin {
private val logger = Logger.getLogger(javaClass.name)

override fun getName(): String = "rust-server-codegen-python"

/**
* See [software.amazon.smithy.rust.codegen.client.smithy.RustClientCodegenPlugin].
*/
override fun execute(context: PluginContext) {
// Suppress extremely noisy logs about reserved words
Logger.getLogger(ReservedWordSymbolProvider::class.java.name).level = Level.OFF
Expand All @@ -57,10 +60,7 @@ class PythonCodegenServerPlugin : SmithyBuildPlugin {

companion object {
/**
* When generating code, smithy types need to be converted into Rust types—that is the core role of the symbol provider
*
* The Symbol provider is composed of a base [SymbolVisitor] which handles the core functionality, then is layered
* with other symbol providers, documented inline, to handle the full scope of Smithy types.
* See [software.amazon.smithy.rust.codegen.client.smithy.RustClientCodegenPlugin].
*/
fun baseSymbolProvider(
model: Model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
software.amazon.smithy.rust.codegen.server.python.smithy.PythonCodegenServerPlugin
software.amazon.smithy.rust.codegen.server.python.smithy.RustServerCodegenPythonPlugin

0 comments on commit 2d5b6bf

Please sign in to comment.