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
38 changes: 38 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Platform-specific configs (build:linux / build:macos / build:windows) apply automatically.
common --enable_platform_specific_config

# Bazel 9 removed the native C++ rules; autoload them from rules_cc for third-party
# BUILD files (e.g. googletest) that don't load() them yet. Our own BUILD files
# always load from @rules_cc explicitly.
common --incompatible_autoload_externally=+cc_library,+cc_binary,+cc_test,+cc_import

# C++20 everywhere (ADR-0003 baseline; see docs/PLAN.md §2).
build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
build:windows --cxxopt=/std:c++20 --host_cxxopt=/std:c++20

test --test_output=errors

# AddressSanitizer: bazel test //... --config=asan
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-fno-omit-frame-pointer
build:asan --copt=-g
build:asan --linkopt=-fsanitize=address

# UndefinedBehaviorSanitizer: bazel test //... --config=ubsan
# Assumes clang (CC=clang CXX=clang++): Bazel links through the C driver, which
# omits the UBSan C++ runtime (vptr checks) unless asked for it explicitly.
build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-fno-sanitize-recover=all
build:ubsan --copt=-g
build:ubsan --linkopt=-fsanitize=undefined
build:ubsan --linkopt=-fno-sanitize-recover=all
build:ubsan --linkopt=-fsanitize-link-c++-runtime

# CI settings.
build:ci --announce_rc --verbose_failures

# Personal overrides stay out of version control.
try-import %workspace%/.bazelrc.user
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.x
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BasedOnStyle: Google
ColumnLimit: 100
DerivePointerAlignment: false
PointerAlignment: Left
IncludeBlocks: Regroup
12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Checks: >
bugprone-*,
performance-*,
modernize-*,
readability-*,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-readability-magic-numbers
WarningsAsErrors: "*"
HeaderFilterRegex: "runtime/include/.*"
FormatStyle: file
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space

[*.{h,cc}]
indent_size = 2
max_line_length = 100

[*.java]
indent_size = 2
max_line_length = 100

[*.{kts,smithy}]
indent_size = 4

[*.{yml,yaml,json}]
indent_size = 2

[{BUILD,*.BUILD,*.bazel,*.bzl}]
indent_size = 4
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Bug report
about: Something is broken
labels: bug
---

## Description

<!-- What happened, and what did you expect instead? -->

## Reproduction

<!-- Smallest Smithy model / code / command sequence that reproduces the problem. -->

## Environment

- smithy-cpp version/commit:
- Bazel version (`bazel version`):
- OS and compiler:
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an improvement or new capability
labels: enhancement
---

## Problem

<!-- What are you trying to do that smithy-cpp doesn't support today? -->

## Proposal

<!-- How should it work? Include a Smithy model snippet or desired C++ API if helpful. -->

## Alternatives considered

<!-- Workarounds or other designs you've thought about. -->
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## What

<!-- What does this PR change, and why? Link issues where relevant. -->

## Testing

<!-- How was this verified? bazel test //..., gradle build, new tests added, etc. -->

## Checklist

- [ ] Tests added/updated for the change
- [ ] `bazel test //...` and `(cd codegen && gradle build spotlessCheck)` pass locally
- [ ] Formatting clean (clang-format, buildifier, spotless)
- [ ] Architectural decisions recorded as an ADR (if applicable)
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
bazel:
name: bazel (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: linux-gcc
os: ubuntu-24.04
cc: gcc
cxx: g++
- name: linux-clang
os: ubuntu-24.04
cc: clang
cxx: clang++
- name: macos-clang
os: macos-14
- name: windows-msvc
os: windows-2022
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: bazel test
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: bazelisk test //... --config=ci

sanitizers:
name: bazel (asan + ubsan)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: bazel test with sanitizers
env:
CC: clang
CXX: clang++
run: bazelisk test //... --config=ci --config=asan --config=ubsan

codegen:
name: codegen (gradle)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: "8.14.3"
- name: gradle build
run: gradle build spotlessCheck
working-directory: codegen

lint:
name: lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: clang-format
run: |
find runtime -name '*.h' -o -name '*.cc' | xargs clang-format --dry-run --Werror
- name: clang-tidy
run: |
clang-tidy runtime/src/core/version.cc -- -Iruntime/include -std=c++20
- name: buildifier
run: npx -y @bazel/buildifier@8.2.1 --lint=warn --mode=check -r .
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Bazel
bazel-*
/.bazelrc.user

# Gradle / JVM
.gradle/
build/
out/

# IDEs & editors
.idea/
.vscode/
*.iml
compile_commands.json

# OS noise
.DS_Store
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contributing to smithy-cpp

Thanks for your interest! This project is in early development — see
[`docs/PLAN.md`](docs/PLAN.md) for the roadmap and [`docs/adr/`](docs/adr/) for the decisions
that shape it. [`docs/development.md`](docs/development.md) covers building and testing.

## Ground rules

- **Build system:** Bazel 9 only (ADR-0004). Install [bazelisk](https://github.com/bazelbuild/bazelisk);
it picks up `.bazelversion` automatically. The `codegen/` JVM subproject builds with Gradle.
- **C++:** C++20, Google style via `.clang-format` (100-column limit), `.clang-tidy` clean.
`Outcome`-based error handling — no exceptions across public API boundaries (ADR-0003).
- **Java:** 17+, formatted with google-java-format (enforced by Spotless: `gradle spotlessApply`).
- **Starlark:** formatted with `buildifier`; always `load()` C++ rules from `@rules_cc`.
- **Tests:** every change lands with tests. Run `bazel test //...` and
`(cd codegen && gradle build)` before sending a PR.
- **Vendor neutrality:** no AWS-specific traits, auth, or SDK behaviors (PLAN §2).

## Pull requests

1. Fork/branch from `main`; keep PRs focused on one concern.
2. Make CI green: Bazel matrix (Linux gcc/clang, macOS, Windows), sanitizers, Gradle, lint.
3. Architectural changes need an ADR in `docs/adr/` (next sequential number).

## License

By contributing you agree that your contributions are licensed under the
[Apache License 2.0](LICENSE).
Loading
Loading