Skip to content
Closed

C++ SDK #1421

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5710cb7
feat(cpp): implement C++ SDK generator class and type mapping
bhardwajparth51 Apr 23, 2026
ca3bf4e
feat(cpp): implement core SDK templates (models, services, async tran…
bhardwajparth51 Apr 23, 2026
d13bcec
test(cpp): implement gtest and integration test templates
bhardwajparth51 Apr 23, 2026
05078d0
chore(cpp): generate production SDK output (examples/cpp)
bhardwajparth51 Apr 23, 2026
ca4e930
ci(cpp): implement Docker CI environment and build validation workflows
bhardwajparth51 Apr 23, 2026
6b7d1f0
test(cpp): implement Cpp20Test harness and mock-server orchestration
bhardwajparth51 Apr 23, 2026
1a446c4
fix(cpp): replace coroutine spin-loop with promise/shared_future sync…
bhardwajparth51 Apr 23, 2026
7fc6965
fix(cpp): replace coroutine spin-loop with single resume safety
bhardwajparth51 Apr 23, 2026
fc18d0f
fix(cpp): restore Result::Err(std::exception_ptr) for async error pro…
bhardwajparth51 Apr 23, 2026
55b8dd2
chore: remove development scratch files and rebase logs
bhardwajparth51 Apr 23, 2026
6ffccb7
chore: add scratch/ and rebase_todo.txt to .gitignore
bhardwajparth51 Apr 23, 2026
5923b5a
docs(cpp): clarify ThreadPool concurrency model in README
bhardwajparth51 Apr 23, 2026
f3f1b7b
fix(cpp): resolve Task UB and idempotent get() in base.hpp
bhardwajparth51 Apr 23, 2026
ed6d08c
fix(cpp): correct distanceEqual 6-arg nesting depth (values array, no…
bhardwajparth51 Apr 23, 2026
d90fee9
fix(cpp): correct distanceEqual two-point nesting to match Appwrite b…
bhardwajparth51 Apr 23, 2026
c846744
fix(cpp): add CMAKE_PREFIX_PATH, parallel build, and dynamic containe…
bhardwajparth51 Apr 23, 2026
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
19 changes: 18 additions & 1 deletion .github/workflows/sdk-build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ jobs:
- sdk: rust
platform: server

- sdk: cpp
platform: server

# Console SDKs
- sdk: cli
platform: console

- sdk: web
platform: console

Expand Down Expand Up @@ -161,6 +164,15 @@ jobs:
if: matrix.sdk == 'rust'
uses: dtolnay/rust-toolchain@1.83.0

- name: Setup C++
if: matrix.sdk == 'cpp'
run: |
Comment thread
greptile-apps[bot] marked this conversation as resolved.
sudo apt-get update
sudo apt-get install -y build-essential cmake libcurl4-openssl-dev nlohmann-json3-dev libgtest-dev
git clone --depth 1 --branch 1.10.5 https://github.com/libcpr/cpr.git /tmp/cpr
Comment on lines 164 to +172
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 cmake configure step missing -DCMAKE_PREFIX_PATH — cpr may not be found

cpr is installed to /usr/local via cmake --target install, but the subsequent build step runs cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON without -DCMAKE_PREFIX_PATH=/usr/local. On Ubuntu runners CMAKE_PREFIX_PATH defaults to /usr only, so find_package(cpr QUIET) will fail and FetchContent_MakeAvailable(cpr) will attempt a network clone — adding a GitHub dependency and ~5 min of cpr+libcurl compilation to every CI run. Add the prefix:

cpp)
  cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON -DCMAKE_PREFIX_PATH=/usr/local
  cmake --build build -j$(nproc)
  ctest --test-dir build --output-on-failure
  ;;

cmake -S /tmp/cpr -B /tmp/cpr/build -DCPR_BUILD_TESTS=OFF -DCPR_USE_SYSTEM_CURL=ON -DCMAKE_INSTALL_PREFIX=/usr/local
sudo cmake --build /tmp/cpr/build --target install -j$(nproc)

- name: Build SDK
working-directory: examples/${{ matrix.sdk }}
run: |
Expand Down Expand Up @@ -237,6 +249,11 @@ jobs:
cargo build --release
cargo test --lib
;;
cpp)
cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON -DCMAKE_PREFIX_PATH=/usr/local
cmake --build build -j$(nproc)
ctest --test-dir build --output-on-failure
;;
*)
echo "Unknown SDK: ${{ matrix.sdk }}"
exit 1
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests/tmp

# exception to the rule
!examples/.gitkeep
!examples/cpp/

**/.DS_Store
templates/swift/example/.build
Expand All @@ -28,3 +29,11 @@ go.sum
# exclude raw lock files in templates (use .twig versions instead)
templates/cli/package-lock.json
templates/cli/bun.lock

# exclude demo folder
demo/
integration_output.log
temp_master_workflow.yml
examples/*/build/
scratch/
rebase_todo.txt
36 changes: 36 additions & 0 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Appwrite\SDK\Language\AgentSkills;
use Appwrite\SDK\Language\CursorPlugin;
use Appwrite\SDK\Language\Rust;
use Appwrite\SDK\Language\Cpp;

try {

Expand Down Expand Up @@ -345,6 +346,41 @@ function configureSDK($sdk, $overrides = []) {
configureSDK($sdk);
$sdk->generate(__DIR__ . '/examples/rust');
}

// C++
if (!$requestedSdk || $requestedSdk === 'cpp') {
$sdk = new SDK(new Cpp(), new Swagger2($spec));
configureSDK($sdk, [
'name' => 'cpp',
'version' => '0.0.1',
'platform' => $platform,
'namespace' => 'appwrite',
'exclude' => [
'services' => [
['name' => 'avatars'],
['name' => 'health'],
['name' => 'locale'],
['name' => 'messaging'],
['name' => 'migrations'],
['name' => 'graphql'],
['name' => 'vcs'],
['name' => 'assistant'],
['name' => 'activities'],
['name' => 'backups'],
['name' => 'console'],
['name' => 'domains'],
['name' => 'organizations'],
['name' => 'project'],
['name' => 'projects'],
['name' => 'proxy'],
['name' => 'sites'],
['name' => 'tables_db'],
['name' => 'tokens'],
]
]
]);
$sdk->generate(__DIR__ . '/examples/cpp');
}
}
catch (Exception $exception) {
echo 'Error: ' . $exception->getMessage() . ' on ' . $exception->getFile() . ':' . $exception->getLine() . "\n";
Expand Down
12 changes: 12 additions & 0 deletions examples/cpp/.github/workflows/autoclose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto-close External Pull Requests

on:
pull_request_target:
types: [opened, reopened]

jobs:
auto_close:
if: github.head_ref != 'dev'
uses: appwrite/.github/.github/workflows/autoclose.yml@main
secrets:
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
35 changes: 35 additions & 0 deletions examples/cpp/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
name: Tag and publish release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup C++ build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libcurl4-openssl-dev

- name: Build and validate SDK
run: |
cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failure

- name: Create GitHub Release archive
run: |
git archive --format=tar.gz --prefix=reponame/ HEAD \
> reponame-${{ github.ref_name }}.tar.gz

- name: Upload release artifact
uses: softprops/action-gh-release@v2
with:
files: reponame-${{ github.ref_name }}.tar.gz
9 changes: 9 additions & 0 deletions examples/cpp/.github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Mark stale issues

on:
schedule:
- cron: "0 0 * * *" # Midnight Runtime

jobs:
stale:
uses: appwrite/.github/.github/workflows/stale.yml@main
Loading