Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
repository-cache: true
disk-cache: consumer
# The quick-start acceptance test (docs/quickstart.md): a standalone
# out-of-tree Bazel module consumes smithy_cpp via the rules in
# out-of-tree Bazel module consumes opal_cpp via the rules in
# bazel/defs.bzl — generation runs inside the consumer's build graph,
# on every OS the runtime itself supports. --config=werror gates the
# consumer's own code (hand-written and generated alike) at
Expand All @@ -187,7 +187,7 @@ jobs:
working-directory: examples/bazel-consumer
run: ./model-evolution-check.sh
# The consumer's resolved boringssl must be exactly the version
# smithy_cpp pins — MVS would silently select anything higher that a
# opal_cpp pins — MVS would silently select anything higher that a
# transitive dep requests, and every leg above stays green while
# consumers link a TLS library no job tested. Resolution is
# platform-independent, so one OS suffices.
Expand Down
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ policy in [docs/versioning.md](docs/versioning.md).

### Breaking

- **The Bazel module is `opal_cpp`, not `smithy_cpp`** (#201, ADR-0024; the
third and last surface, which closes the issue). `bazel_dep(name =
"smithy_cpp")` is now `bazel_dep(name = "opal_cpp")`, the runtime labels
are `@opal_cpp//runtime:…`, the codegen plugin's default `runtimeTarget`
is `@opal_cpp//runtime:core`, and the copts constant hand-written BUILD
files load from `//bazel:copts.bzl` is `OPAL_COPTS`. Migration: `smithy_cpp`
→ `opal_cpp` in `MODULE.bazel` (the `bazel_dep` and any
`local_path_override`/`git_override` naming it) and in every `@smithy_cpp//`
label, including a `runtimeTarget` you set in `smithy-build.json`;
`SMITHY_COPTS` → `OPAL_COPTS` if you load it. The rules keep their
names — `smithy_cpp_types_library`, `smithy_cpp_client_library`,
`smithy_cpp_server_library` take a Smithy model as input and are named for
it — so `load("@opal_cpp//bazel:defs.bzl", "smithy_cpp_server_library")`
is the spelling after this change. The repository URL is unchanged by this
entry.
- **The runtime's include root is `opal/`, not `smithy/`** (#201, ADR-0024;
the second of three surfaces). `#include "smithy/http/transport.h"` is now
`#include "opal/http/transport.h"`, for every runtime header and for the
Expand All @@ -21,8 +36,7 @@ policy in [docs/versioning.md](docs/versioning.md).
stays, so if you have one, constrain the substitution to the runtime's
directories: `smithy/{core,http,json,cbor,client,server,eventstream,compression,testing}/`.
Anything that greps a log for `smithy: ` now looks for `opal: `. The Bazel
module (`@smithy_cpp`) and `SMITHY_COPTS` are unchanged here and move in
the PR that follows.
module (`@smithy_cpp`) and `SMITHY_COPTS` moved in the entry above.
- **The runtime namespace is `opal`, not `smithy`** (#201, ADR-0024; the
first of three surfaces). Smithy is the IDL a service is described in, not
a property of its JSON codec or its HTTP transport, so `smithy::Outcome`,
Expand All @@ -43,8 +57,8 @@ policy in [docs/versioning.md](docs/versioning.md).
`smithy::protocoltests::`, and the top-level runtime types such as
`smithy::Outcome`. Smithy namespaces in `.smithy` files and the
`smithy_cpp_*_library` rules name the model and are unchanged. The
include root moved in the entry above; the Bazel module (`@smithy_cpp`)
moves in the PR that follows.
include root and the Bazel module (`@smithy_cpp`) moved in the two
entries above.

### Added

Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# version consumers actually observe is opal::Version() / the client
# User-Agent ("0.2.0"). See docs/versioning.md.
module(
name = "smithy_cpp",
name = "opal_cpp",
version = "0.0.0",
)

Expand Down
4 changes: 2 additions & 2 deletions bazel/copts.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Warning flags for every first-party C++ target (issue #65).

Hand-written BUILD files load SMITHY_COPTS; the generated modules' BUILD
Hand-written BUILD files load OPAL_COPTS; the generated modules' BUILD
files (BuildFileGenerator / TestsBuildFileGenerator) and the consumer macros
in defs.bzl carry the same flags as literals, so generated code compiles at
the same warning level in-tree and in consumers.
Expand All @@ -10,7 +10,7 @@ only via --config=werror (see .bazelrc), so a new compiler version's new
warnings never break consumers building from source.
"""

SMITHY_COPTS = [
OPAL_COPTS = [
"-Wall",
"-Wextra",
]
4 changes: 2 additions & 2 deletions bazel/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Consumer-facing rules: generate Smithy C++ clients/servers inside the build graph.

Usage (from any Bazel 8/9 module that depends on smithy_cpp):
Usage (from any Bazel 8/9 module that depends on opal_cpp):

load("@smithy_cpp//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library")
load("@opal_cpp//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library")

smithy_cpp_client_library(
name = "weather_client",
Expand Down
4 changes: 2 additions & 2 deletions bazel/tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//bazel:copts.bzl", "SMITHY_COPTS")
load("//bazel:copts.bzl", "OPAL_COPTS")
load("//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library", "smithy_cpp_types_library")
load(":defs_test.bzl", "defs_test_suite")

Expand Down Expand Up @@ -73,7 +73,7 @@ cc_test(
name = "greeter_roundtrip_test",
size = "small",
srcs = ["greeter_roundtrip_test.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
":greeter_client",
":greeter_server",
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//bazel:copts.bzl", "SMITHY_COPTS")
load("//bazel:copts.bzl", "OPAL_COPTS")

# Performance benchmarks (PLAN Phase 7): run with -c opt; CI runs them as an
# informational job (no pass/fail threshold yet — publish numbers first).
Expand All @@ -8,7 +8,7 @@ cc_binary(
name = "serde_benchmark",
testonly = True,
srcs = ["serde_benchmark.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
"//examples/roundtrip/rest/generated:serde",
"//examples/roundtrip/rest/generated:types",
Expand All @@ -23,7 +23,7 @@ cc_binary(
name = "beast_benchmark",
testonly = True,
srcs = ["beast_benchmark.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
"//examples/roundtrip/rest/generated:client",
"//examples/roundtrip/rest/generated:server",
Expand All @@ -39,7 +39,7 @@ cc_binary(
name = "request_benchmark",
testonly = True,
srcs = ["request_benchmark.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
"//examples/roundtrip/jsonrpc/generated:client",
"//examples/roundtrip/jsonrpc/generated:server",
Expand Down
6 changes: 3 additions & 3 deletions codegen/compile-tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//bazel:copts.bzl", "SMITHY_COPTS")
load("//bazel:copts.bzl", "OPAL_COPTS")
load("//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library")

# The compile-the-output harness (issue #48): run the real generator on the
Expand Down Expand Up @@ -113,7 +113,7 @@ cc_test(
name = "gauntlet_compile_test",
size = "small",
srcs = ["gauntlet_compile_test.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
":gauntlet_cbor_client",
":gauntlet_cbor_server",
Expand Down Expand Up @@ -142,7 +142,7 @@ cc_test(
name = "streaming_compile_test",
size = "small",
srcs = ["streaming_compile_test.cc"],
copts = SMITHY_COPTS,
copts = OPAL_COPTS,
deps = [
":streaming_cbor_client",
":streaming_cbor_server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void run(String[] args) {
List<String> modelPaths = new ArrayList<>();
String service = null;
String namespace = null;
String runtimeTarget = "@smithy_cpp//runtime:core";
String runtimeTarget = "@opal_cpp//runtime:core";
String output = null;
String testsPackage = null;
boolean malformedTests = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* "cpp-codegen": {
* "service": "example.weather#Weather",
* "namespace": "example::weather",
* "runtimeTarget": "@smithy_cpp//runtime:core"
* "runtimeTarget": "@opal_cpp//runtime:core"
* }
* }</pre>
*/
Expand Down Expand Up @@ -49,7 +49,7 @@ public static CppSettings fromNode(ObjectNode node) {
ShapeId service = ShapeId.from(node.expectStringMember("service").getValue());
String namespace = node.expectStringMember("namespace").getValue();
String runtimeTarget =
node.getStringMemberOrDefault("runtimeTarget", "@smithy_cpp//runtime:core");
node.getStringMemberOrDefault("runtimeTarget", "@opal_cpp//runtime:core");
String testsPackage = node.getStringMemberOrDefault("testsPackage", null);
boolean malformedTests = node.getBooleanMemberOrDefault("malformedTests", false);
boolean integrationTests = node.getBooleanMemberOrDefault("integrationTests", false);
Expand Down Expand Up @@ -110,7 +110,7 @@ public String serverHeaderFile() {
return "include/" + includePrefix() + "/server.h";
}

/** Bazel package of the runtime, e.g. {@code //runtime} or {@code @smithy_cpp//runtime}. */
/** Bazel package of the runtime, e.g. {@code //runtime} or {@code @opal_cpp//runtime}. */
public String runtimePackage() {
int colon = runtimeTarget.lastIndexOf(':');
return colon < 0 ? runtimeTarget : runtimeTarget.substring(0, colon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void runtimeDepsPointAtTheConfiguredTarget() {
String external =
PluginTestHarness.generate(MODEL, "test.build#Svc", "test::build")
.expectFileString("/BUILD.bazel");
assertTrue(external.contains("\"@smithy_cpp//runtime:core\""), external);
assertTrue(external.contains("\"@opal_cpp//runtime:core\""), external);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void defaultsApplyWhenOnlyServiceAndNamespaceAreGiven() {
CppSettings settings = CppSettings.fromNode(minimal());
assertEquals("example.weather#Weather", settings.service().toString());
assertEquals("example::weather", settings.namespace());
assertEquals("@smithy_cpp//runtime:core", settings.runtimeTarget());
assertEquals("@opal_cpp//runtime:core", settings.runtimeTarget());
}

@Test
Expand Down
6 changes: 3 additions & 3 deletions docs/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,13 @@ without reading generator internals or touching Gradle.
- The generator runs as a Bazel **toolchain/action** with a hermetic JVM via `rules_java` —
generation happens inside the build graph (correct caching, remote-execution compatible),
never as a "run this script first" step.
- bzlmod module `smithy_cpp` published to the **Bazel Central Registry**; runtime targets
(`@smithy_cpp//runtime:core`, `:client`, `:server`, …) consumable directly.
- bzlmod module `opal_cpp` published to the **Bazel Central Registry**; runtime targets
(`@opal_cpp//runtime:core`, `:client`, `:server`, …) consumable directly.
**Deferred**: BCR (and Maven Central) publishing waits until the project is validated in
production; until then consumers use `git_override`/`local_path_override` (see
docs/quickstart.md).
- Out-of-tree consumer example (`examples/bazel-consumer/`) exercised in CI: a standalone
Bazel 9 module that depends on the released `smithy_cpp` module, defines a model, builds
Bazel 9 module that depends on the released `opal_cpp` module, defines a model, builds
client + server, and runs the Phase-5-style integration test — this is the quick-start
acceptance test.
- **CLI wrapper**: `smithy-cpp generate --model … --mode client|server|both --out …` (thin wrapper
Expand Down
2 changes: 1 addition & 1 deletion docs/adr/0004-bazel-only.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parity is a permanent maintenance tax, and the target audience builds with Bazel

- **Bazel 9 (bzlmod-only)** is the sole supported build system, for this repository and for
consumers. `.bazelversion` tracks `9.x`.
- Consumers use the `smithy_cpp` bzlmod module (published to the Bazel Central Registry from
- Consumers use the `opal_cpp` bzlmod module (published to the Bazel Central Registry from
Phase 6) and the `smithy_cpp_*_library` rules, which run the generator hermetically inside the
build graph.
- No CMake files are provided or accepted. The `smithy-cpp` CLI (Phase 6) can emit plain C++
Expand Down
2 changes: 1 addition & 1 deletion docs/design/codegen-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ smithy-rs's `codegen-core` structure (PLAN §3.2a).
| Class | Role |
|---|---|
| `CppCodegenPlugin` | `SmithyBuildPlugin` entry point; validates settings, rejects (for now) recursive shapes with a clear error, drives `CodegenDirector` |
| `CppSettings` | Plugin settings: `service`, C++ `namespace`, `runtimeTarget` (Bazel label of `//runtime:core` / `@smithy_cpp//runtime:core`) |
| `CppSettings` | Plugin settings: `service`, C++ `namespace`, `runtimeTarget` (Bazel label of `//runtime:core` / `@opal_cpp//runtime:core`) |
| `CppSymbolProvider` | Shape → C++ type mapping (docs/generated-types.md). A `Symbol`'s name is the full C++ type text; required `#include`s ride along in a symbol property |
| `CppWriter` | `SymbolWriter` per generated file: collects includes while the body is written, renders header comment + `#pragma once` + sorted includes + namespace wrapper. Byte deterministic |
| `DirectedCppCodegen` | Implements `DirectedCodegen`; handles structure/error/union/enum/intEnum directives, then (service directive) resolves the protocol and drives serde → client → BUILD generation |
Expand Down
4 changes: 2 additions & 2 deletions docs/model-evolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ are checked in as goldens — so the workflow below is exercised on every commit
Out of tree, the same generator runs as a CLI:

```sh
bazel run @smithy_cpp//codegen:generator -- \
bazel run @opal_cpp//codegen:generator -- \
--model $PWD/model/todo.smithy --service acme.todo#Todo \
--namespace acme::todo --mode both --output $PWD/generated
```
Expand Down Expand Up @@ -93,7 +93,7 @@ A consumer vendoring CLI output wants the same job, substituting the CLI invocat
- name: check generated code is current
run: |
rm -rf generated
bazel run @smithy_cpp//codegen:generator -- \
bazel run @opal_cpp//codegen:generator -- \
--model $PWD/model/todo.smithy --service acme.todo#Todo \
--namespace acme::todo --mode both --output $PWD/generated
git diff --exit-code -- generated
Expand Down
16 changes: 8 additions & 8 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ or a real socket) → `TodoServer` → your `MyHandler` → back out as a typed
```starlark
module(name = "my_service", version = "0.0.0")

bazel_dep(name = "smithy_cpp", version = "0.0.0")
bazel_dep(name = "opal_cpp", version = "0.0.0")

# Until smithy_cpp is published to the Bazel Central Registry (deferred until
# Until opal_cpp is published to the Bazel Central Registry (deferred until
# the project is production-validated), consume it by git override, pinning a
# release tag. The `version` above is ignored while an override is in effect.
git_override(
module_name = "smithy_cpp",
module_name = "opal_cpp",
remote = "https://github.com/muchq/smithy-cpp.git",
tag = "v0.2.0",
)
Expand Down Expand Up @@ -90,10 +90,10 @@ common --experimental_repository_downloader_retries=5
# Warnings are errors for this module's own code (smithy-cpp issue #65): the
# ^// label filter covers the hand-written mains/tests and the generated
# acme/* libraries (already compiled at -Wall -Wextra by the smithy_cpp_*
# macros), while @smithy_cpp and every other external module keep their own
# macros), while @opal_cpp and every other external module keep their own
# warning posture. CI runs with --config=werror; optional for your builds.
# external_include_paths compiles external headers as system headers, so a
# diagnostic inside a googletest or @smithy_cpp header cannot fail the
# diagnostic inside a googletest or @opal_cpp header cannot fail the
# including first-party TU on a newer compiler.
build:werror --per_file_copt=^//@-Werror
build:werror --features=external_include_paths
Expand Down Expand Up @@ -231,7 +231,7 @@ example binds all three side by side.)
`BUILD.bazel` — pass the base model plus the overlay that picks the protocol:

```starlark
load("@smithy_cpp//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library")
load("@opal_cpp//bazel:defs.bzl", "smithy_cpp_client_library", "smithy_cpp_server_library")

smithy_cpp_client_library(
name = "todo_client",
Expand Down Expand Up @@ -335,7 +335,7 @@ bazel test //...
```

For production serving, plug `server.Handler()` into `opal::http::BeastServerTransport`
(`@smithy_cpp//runtime:http_beast`, ADR-0006) — the
(`@opal_cpp//runtime:http_beast`, ADR-0006) — the
[Serving lifecycle](production-guide.md#serving-lifecycle) walkthrough and its compiled example
([`examples/simplerestjson/serve_main.cc`](../examples/simplerestjson/serve_main.cc)) wire
SIGTERM → drain → clean exit.
Expand Down Expand Up @@ -435,7 +435,7 @@ don't parse as C++ at all. If you hit one of these:
The generator is also a plain CLI for inspecting output or vendoring generated sources:

```sh
bazel run @smithy_cpp//codegen:generator -- \
bazel run @opal_cpp//codegen:generator -- \
--model $PWD/model/todo.smithy --service acme.todo#Todo \
--namespace acme::todo --mode both --output /tmp/generated
```
Expand Down
8 changes: 4 additions & 4 deletions docs/superpowers/plans/2026-07-08-server-middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ TEST(TodoMiddlewareTest, GuardObserveAndHealthComposeAroundTheServer) {
}
```

In `examples/bazel-consumer/BUILD.bazel`, add `"@smithy_cpp//runtime:server",` to the `todo_integration_test` deps (keep the list sorted):
In `examples/bazel-consumer/BUILD.bazel`, add `"@opal_cpp//runtime:server",` to the `todo_integration_test` deps (keep the list sorted):

```starlark
deps = [
Expand All @@ -591,9 +591,9 @@ In `examples/bazel-consumer/BUILD.bazel`, add `"@smithy_cpp//runtime:server",` t
":todo_jsonrpc_server",
":todo_server",
"@googletest//:gtest_main",
"@smithy_cpp//runtime:client",
"@smithy_cpp//runtime:http",
"@smithy_cpp//runtime:server",
"@opal_cpp//runtime:client",
"@opal_cpp//runtime:http",
"@opal_cpp//runtime:server",
],
```

Expand Down
4 changes: 2 additions & 2 deletions examples/bazel-consumer/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ common --experimental_repository_downloader_retries=5
# Warnings are errors for this module's own code (smithy-cpp issue #65): the
# ^// label filter covers the hand-written mains/tests and the generated
# acme/* libraries (already compiled at -Wall -Wextra by the smithy_cpp_*
# macros), while @smithy_cpp and every other external module keep their own
# macros), while @opal_cpp and every other external module keep their own
# warning posture. CI runs with --config=werror; optional for your builds.
# external_include_paths compiles external headers as system headers, so a
# diagnostic inside a googletest or @smithy_cpp header cannot fail the
# diagnostic inside a googletest or @opal_cpp header cannot fail the
# including first-party TU on a newer compiler.
build:werror --per_file_copt=^//@-Werror
build:werror --features=external_include_paths
Expand Down
Loading
Loading