Unverified Commit 02264461 authored by david-perez's avatar david-perez Committed by GitHub
Browse files

Rename Rust server codegen plugins (#2306)

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.
parent 7fdb5c96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -66,10 +66,10 @@ class RustClientCodegenPlugin : DecoratableBuildPlugin() {
    }

    companion object {
        /** SymbolProvider
        /**
         * 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
         * 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.
         */
        fun baseSymbolProvider(model: Model, serviceShape: ServiceShape, symbolVisitorConfig: SymbolVisitorConfig) =
+1 −1
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ class RustWriter private constructor(
     * Callers must take care to use [this] when writing to ensure code is written to the right place:
     * ```kotlin
     * val writer = RustWriter.forModule("model")
     * writer.withModule(RustModule.public("nested")) {
     * writer.withInlineModule(RustModule.public("nested")) {
     *   Generator(...).render(this) // GOOD
     *   Generator(...).render(writer) // WRONG!
     * }
+3 −6
Original line number Diff line number Diff line
@@ -19,11 +19,8 @@ import java.util.function.Predicate
class DirectedWalker(model: Model) {
    private val inner = Walker(model)

    fun walkShapes(shape: Shape): Set<Shape> {
        return walkShapes(shape) { _ -> true }
    }
    fun walkShapes(shape: Shape): Set<Shape> = walkShapes(shape) { true }

    fun walkShapes(shape: Shape, predicate: Predicate<Relationship>): Set<Shape> {
        return inner.walkShapes(shape) { rel -> predicate.test(rel) && rel.direction == RelationshipDirection.DIRECTED }
    }
    fun walkShapes(shape: Shape, predicate: Predicate<Relationship>): Set<Shape> =
        inner.walkShapes(shape) { rel -> predicate.test(rel) && rel.direction == RelationshipDirection.DIRECTED }
}
+1 −2
Original line number Diff line number Diff line
@@ -194,8 +194,7 @@ fun generatePluginContext(
        )
    }

    val settings = settingsBuilder.merge(additionalSettings)
        .build()
    val settings = settingsBuilder.merge(additionalSettings).build()
    val pluginContext = PluginContext.builder().model(model).fileManifest(manifest).settings(settings).build()
    return pluginContext to testPath
}
+1 −1
Original line number Diff line number Diff line
@@ -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,
Loading