Skip to content

Commit

Permalink
Update dependencies, simplify bindings generation (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
riverar authored Jan 20, 2024
1 parent 4b30940 commit 253f811
Show file tree
Hide file tree
Showing 13 changed files with 46,787 additions and 54,583 deletions.
4 changes: 2 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Start by adding `windows` and `microsoft-dia` dependencies to Cargo.toml:

```toml
[dependencies.windows]
version = "0.48.0"
version = "0.52.0"
features = [
"Win32_System_Com"
]

[dependencies.microsoft-dia]
version = "0.8.0"
version = "0.9.0"
```

Make use of any DIA SDK APIs as needed.
Expand Down
68 changes: 64 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,49 @@ env:
RUSTFLAGS: -Dwarnings

jobs:
metadata:
name: Build metadata
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.x
- name: Setup Visual Studio
run: |
Start-Process -Wait "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList {`
modify `
--quiet `
--installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" `
--add `
Microsoft.NetCore.Component.Runtime.8.0 `
Microsoft.NetCore.Component.SDK `
Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
Microsoft.VisualStudio.Component.Windows11SDK.22000 `
}
- name: Build metadata
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
dotnet build .metadata
- name: Upload metadata
uses: actions/upload-artifact@v4
with:
name: metadata
path: .windows/winmd/Microsoft.Dia.winmd

test:
name: Test
runs-on: ${{ matrix.os }}
needs: metadata
strategy:
matrix:
include:
Expand All @@ -25,7 +65,13 @@ jobs:
platform: x86
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download metadata
uses: actions/download-artifact@v4
with:
name: metadata
path: .windows/winmd

- name: Update toolchain
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
Expand All @@ -41,27 +87,41 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run cargo fmt
run: cargo fmt --all -- --check

cargo_clippy:
name: Check cargo clippy
runs-on: windows-latest
needs: metadata
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download metadata
uses: actions/download-artifact@v4
with:
name: metadata
path: .windows/winmd

- name: Run cargo clippy
run: cargo clippy --all -- -D warnings

cargo_doc:
name: Check cargo docs
runs-on: windows-latest
needs: metadata
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download metadata
uses: actions/download-artifact@v4
with:
name: metadata
path: .windows/winmd

- name: Run cargo doc
run: cargo doc --no-deps --workspace
3 changes: 2 additions & 1 deletion .metadata/dia.manual.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Windows.Win32.Foundation;
using Windows.Win32.Interop;
using Windows.Win32.Foundation.Metadata;

namespace Microsoft.Dia
{
Expand Down Expand Up @@ -141,6 +141,7 @@ public enum SymTag
SymTagHeapAllocationSite,
SymTagCoffGroup,
SymTagInlinee,
SymTagTaggedUnionCase
SymTagMax
}
}
10 changes: 9 additions & 1 deletion .metadata/generate.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.Windows.WinmdGenerator/0.40.14-preview">
<Project Sdk="Microsoft.Windows.WinmdGenerator/0.57.42-preview">
<PropertyGroup Label="Globals">
<OutputWinmd>../.windows/winmd/Microsoft.Dia.winmd</OutputWinmd>
<WinmdVersion>255.255.255.255</WinmdVersion>
Expand All @@ -8,6 +8,7 @@
<DiaIncRoot>$(DiaSdkRoot)\include</DiaIncRoot>
<AdditionalIncludes>$(CompiledHeadersDir);$(DiaIncRoot)</AdditionalIncludes>
</PropertyGroup>

<ItemGroup>
<Idls Include="$(DiaIdlRoot)\dia2.idl" />
<Headers Include="$(CompiledHeadersDir)\dia2.h;$(DiaIncRoot)\cvconst.h" />
Expand All @@ -17,4 +18,11 @@
<ExcludeFromCrossarch>true</ExcludeFromCrossarch>
</Partition>
</ItemGroup>

<Target Name="CopyWin32Metadata" AfterTargets="Build">
<ItemGroup>
<SourceFiles Include="$(PkgMicrosoft_Windows_SDK_Win32Metadata)\Windows.Win32.winmd"></SourceFiles>
</ItemGroup>
<Copy SourceFiles="@(SourceFiles)" DestinationFolder="../.windows/winmd" />
</Target>
</Project>
Binary file removed .windows/winmd/Microsoft.Dia.winmd
Binary file not shown.
18 changes: 14 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "microsoft-dia"
version = "0.8.0"
version = "0.9.0"
authors = ["Microsoft"]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Rust for Debug Interface Access (DIA) SDK"
repository = "https://github.com/microsoft/dia-rs"
Expand All @@ -11,16 +11,26 @@ exclude = [".github", ".windows", ".metadata", "docs", "tests"]

[workspace]
members = [
"crates/tools/*",
"crates/samples/*",
]

[dependencies.windows]
version = "0.48.0"
version = "0.52"
features = [
"implement",
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_Variant",
"Win32_System_LibraryLoader",
"Win32_System_Com_StructuredStorage",
"Win32_System_Ole"
]

[dependencies.windows-core]
version = "0.52"
features = [
"implement"
]

[build-dependencies.windows-bindgen]
version = "0.52"
14 changes: 14 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn main() {
println!("cargo:rerun-if-changed=.windows/winmd/Microsoft.Dia.winmd");
println!("cargo:rerun-if-changed=build.rs");

windows_bindgen::bindgen([
"--in",
".windows/winmd/Microsoft.Dia.winmd",
"--out",
"src/bindings.rs",
"--filter",
"Microsoft.Dia",
])
.unwrap();
}
10 changes: 9 additions & 1 deletion crates/samples/functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ edition = "2021"
publish = false

[dependencies.windows]
version = "0.48.0"
version = "0.52"
features = [
"implement",
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_LibraryLoader",
"Win32_System_Com_StructuredStorage",
"Win32_System_Ole"
]

[dependencies.microsoft-dia]
path = "../../../"
2 changes: 1 addition & 1 deletion crates/samples/functions/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use windows::{
Win32::System::Com::{CoInitializeEx, COINIT_MULTITHREADED},
};

fn main() -> windows::core::Result<()> {
fn main() -> Result<()> {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED)?;
let source: IDiaDataSource = microsoft_dia::helpers::NoRegCoCreate(
Expand Down
9 changes: 0 additions & 9 deletions crates/tools/api/Cargo.toml

This file was deleted.

23 changes: 0 additions & 23 deletions crates/tools/api/src/main.rs

This file was deleted.

Loading

0 comments on commit 253f811

Please sign in to comment.