Skip to content

Commit d9ae523

Browse files
authored
chore(lambda-rs): create dedicated crates for demos
2 parents 9031bcf + d248e50 commit d9ae523

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+660
-477
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ body:
4343
description: Provide minimal steps to reproduce the issue.
4444
placeholder: |
4545
1. Clone repository
46-
2. Run `cargo run --example <name>`
46+
2. Run `cargo run -p lambda-demos-render --bin <name>` (or the relevant
47+
`lambda-demos-*` crate)
4748
3. Observe error/unexpected behavior
4849
validations:
4950
required: true

.github/workflows/compile_lambda_rs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ jobs:
9090
9191
- name: Build workspace
9292
if: ${{ contains(matrix.features, 'lambda-rs/audio-output-device') }}
93-
run: cargo build --workspace --features ${{ matrix.features }}
93+
run: cargo build --workspace --bins --features ${{ matrix.features }}
9494

9595
- name: Build workspace (exclude audio tools)
9696
if: ${{ !contains(matrix.features, 'lambda-rs/audio-output-device') }}
9797
run: |
9898
cargo build --workspace \
9999
--exclude lambda-audio-tool \
100+
--exclude lambda-demos-audio \
101+
--bins \
100102
--features ${{ matrix.features }}
101103
102104
- name: Build examples (lambda-rs)
@@ -111,6 +113,7 @@ jobs:
111113
run: |
112114
cargo test --workspace \
113115
--exclude lambda-audio-tool \
116+
--exclude lambda-demos-audio \
114117
--features ${{ matrix.features }}
115118
116119
- uses: actions/setup-ruby@v1

.github/workflows/coverage.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,19 @@ jobs:
6767
- name: Generate full coverage JSON
6868
run: |
6969
cargo llvm-cov --workspace \
70+
--exclude lambda-demos-audio \
71+
--exclude lambda-demos-minimal \
72+
--exclude lambda-demos-render \
7073
--features lambda-rs/with-vulkan,lambda-rs/audio-output-device \
7174
--json \
7275
--output-path coverage.json
7376
7477
- name: Generate HTML coverage report
7578
run: |
7679
cargo llvm-cov --workspace \
80+
--exclude lambda-demos-audio \
81+
--exclude lambda-demos-minimal \
82+
--exclude lambda-demos-render \
7783
--features lambda-rs/with-vulkan,lambda-rs/audio-output-device \
7884
--html \
7985
--output-dir coverage-html \
@@ -86,7 +92,10 @@ jobs:
8692
# Use GitHub's provided base/head SHAs for accurate diff
8793
base_sha="${{ github.event.pull_request.base.sha }}"
8894
head_sha="${{ github.event.pull_request.head.sha }}"
89-
changed_files=$(git diff --name-only "$base_sha" "$head_sha" -- '*.rs' | tr '\n' ' ')
95+
changed_files=$(git diff --name-only "$base_sha" "$head_sha" -- \
96+
'*.rs' \
97+
':(exclude)demos/**' \
98+
| tr '\n' ' ')
9099
echo "files=$changed_files" >> "$GITHUB_OUTPUT"
91100
92101
- name: Generate coverage report data

.github/workflows/release.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ jobs:
6767
# binaries. Audio/tool validation runs in the CI build matrix when
6868
# audio features are enabled.
6969
--exclude lambda-audio-tool \
70+
# Demo crates are validated in the CI build matrix (compile & test
71+
# workflow). Exclude them here to keep the release workflow focused
72+
# on release artifacts.
73+
--exclude lambda-demos-audio \
74+
--exclude lambda-demos-minimal \
75+
--exclude lambda-demos-render \
7076
--all-targets \
7177
-- -D warnings
7278
@@ -75,6 +81,9 @@ jobs:
7581
cargo test --workspace \
7682
# See note above in the Clippy step.
7783
--exclude lambda-audio-tool \
84+
--exclude lambda-demos-audio \
85+
--exclude lambda-demos-minimal \
86+
--exclude lambda-demos-render \
7887
-- --nocapture
7988
8089
prepare_version:
@@ -236,7 +245,13 @@ jobs:
236245
# See note in the validate job: `lambda-audio-tool` is excluded here
237246
# to avoid Linux ALSA build dependencies that are unnecessary for
238247
# release artifacts.
239-
cargo build --workspace --exclude lambda-audio-tool --release --bins
248+
cargo build --workspace \
249+
--exclude lambda-audio-tool \
250+
--exclude lambda-demos-audio \
251+
--exclude lambda-demos-minimal \
252+
--exclude lambda-demos-render \
253+
--release \
254+
--bins
240255
241256
- name: Stage files
242257
id: stage

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ Temporary Items
138138

139139
#!! ERROR: opengl is undefined. Use list command to see defined gitignore types !!#
140140

141-
# Remove bin
142-
bin
141+
# Remove root-level bin
142+
/bin/
143143

144144
# Remove clangd
145145
.clangd/

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ members = [
99
"crates/lambda-rs-platform",
1010
"tools/obj_loader",
1111
"tools/lambda_audio",
12+
# Demo crates (not built by default; see `default-members`).
13+
"demos/audio",
14+
"demos/render",
15+
"demos/minimal",
1216
]
1317

1418
default-members = [

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,27 @@ Start with the tutorials to build features step by step:
134134

135135
## Examples <a name="examples"></a>
136136

137-
Browse example sources:
137+
Browse runnable demos and example sources:
138138

139-
* Core API examples: [crates/lambda-rs/examples/](./crates/lambda-rs/examples/)
139+
* Demo crates (recommended): [demos/](./demos/)
140+
* Minimal rustdoc examples: [crates/lambda-rs/examples/](./crates/lambda-rs/examples/)
140141
* Logging examples: [crates/lambda-rs-logging/examples/](./crates/lambda-rs-logging/examples/)
141142
* Argument parsing examples: [crates/lambda-rs-args/examples/](./crates/lambda-rs-args/examples/)
142143

143144
### Minimal
144145

145-
A minimal example of an application with a working window using lambda.
146+
A minimal demo of an application with a working window using lambda.
146147

147-
```rust
148-
cargo run --example minimal
148+
```bash
149+
cargo run -p lambda-demos-minimal --bin minimal
149150
```
150151

151152
### Immediates
152153

153154
An example of using shaders with immediates (per-draw data) to render a 3D image.
154155

155-
```rust
156-
cargo run --example immediates
156+
```bash
157+
cargo run -p lambda-demos-render --bin immediates
157158
```
158159

159160
#### Notes
@@ -166,16 +167,16 @@ in either dx11 or dx12.
166167

167168
An example using shaders to render a single triangle.
168169

169-
```rust
170-
cargo run --example triangle
170+
```bash
171+
cargo run -p lambda-demos-render --bin triangle
171172
```
172173

173174
### Triangles
174175

175176
An example using shaders to render multiple triangles and keyboard input to move one of the triangles on screen.
176177

177-
```rust
178-
cargo run --example triangles
178+
```bash
179+
cargo run -p lambda-demos-render --bin triangles
179180
```
180181

181182
## Plans <a name="plans"></a>

crates/lambda-rs/examples/sound_buffer_load.rs

Lines changed: 0 additions & 129 deletions
This file was deleted.

crates/lambda-rs/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
//! event/render loop.
99
//! - `math`: minimal vector/matrix utilities used by examples and helpers.
1010
//!
11-
//! See runnable examples in `crates/lambda-rs/examples/` and integration tests
12-
//! under `crates/lambda-rs/tests/` for typical usage patterns.
11+
//! See runnable demos under `demos/` and the minimal rustdoc reference example
12+
//! under `crates/lambda-rs/examples/` for typical usage patterns. Integration
13+
//! tests live under `crates/lambda-rs/tests/`.
1314
1415
pub mod component;
1516
pub mod events;

0 commit comments

Comments
 (0)