Skip to content

Commit

Permalink
Go back to api_gen depending on windows-bindgen, riddle remains…
Browse files Browse the repository at this point in the history
… unpublished
  • Loading branch information
MarijnS95 committed Aug 17, 2023
1 parent 655a151 commit 67c2720
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ jobs:
with:
name: metadata
path: .windows/winmd
- name: Install riddle
run: cargo install --git https://github.com/microsoft/windows-rs --rev f18811c riddle
- name: Generate
run: riddle --etc bindings.txt
run: cargo r -p api_gen
- name: Upload crate source
uses: actions/upload-artifact@v3
with:
name: crate-source
path: src/
- name: Diff generated Rust code
run: test -z "$(git status --porcelain -- '!.windows')" || (echo "::error::Generated files are different, please regenerate with riddle --etc bindings.txt!"; git diff; false)
run: test -z "$(git status --porcelain -- '!.windows')" || (echo "::error::Generated files are different, please regenerate with cargo run -p api_gen!"; git diff; false)
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ dotnet build .metadata
From the root of the repository:

```sh
cargo install --git https://github.com/microsoft/windows-rs --rev f18811c riddle
riddle --etc bindings.txt
cargo run -p api_gen
```
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ features = [
"Win32_Graphics_Direct3D12",
"Win32_Graphics_Dxgi_Common",
]

[workspace]
members = ["api_gen"]
10 changes: 10 additions & 0 deletions api_gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "api_gen"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
anyhow = "1"
windows-bindgen = "0.51"
windows-metadata = "0.51"
7 changes: 7 additions & 0 deletions api_gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use windows_bindgen::{bindgen, Result};

fn main() -> Result<()> {
let log = bindgen(["--etc", "bindings.txt"])?;
println!("{}", log);
Ok(())
}
7 changes: 7 additions & 0 deletions release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ pre-release-replacements = [
{ file = "README.md", search = "amd-ext-d3d = .*", replace = "{{crate_name}} = \"{{version}}\"" },
]

# cargo-release only allows using {{version}} in the commit title when creating one
# commit across all released packages in this workspace (we only release one package
# though), or by using the same version for all packages.
# https://github.com/crate-ci/cargo-release/issues/540#issuecomment-1328769105
# https://github.com/crate-ci/cargo-release/commit/3af94caa4b9bbee010a5cf3f196cc4afffbaf192
consolidate-commits = false
shared-version = true

0 comments on commit 67c2720

Please sign in to comment.