Skip to content

Commit 789dd3f

Browse files
authored
Release v0.1.0 beta.4+2.4.4 (#27)
* Use xtask to download nuget package in order to avoid downloading on build task (#23) This allow to publish doc on docs.rs * Add EOF in main README.md * Use cfg_attr instead of build.rs for FieldNamesAsSlice * Bump bindgen to 0.72 * Bump to beta 4 and WSLPluginAPI 2.4.4
1 parent 0b26f13 commit 789dd3f

32 files changed

+1475
-234
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
xtask = "run --package xtask --"

.github/workflows/ci.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,20 @@ jobs:
5656

5757
- name: Lint with Clippy (Stable Only)
5858
if: matrix.toolchain == 'stable'
59-
run: cargo clippy --all-targets --features="runtime-features"
59+
run: cargo clippy --all-targets --all-features
6060

6161
- name: Check Code Formatting (Stable Only)
6262
if: matrix.toolchain == 'stable'
6363
run: cargo fmt -- --check
6464

65-
- name: Build the Project with nuget
66-
run: cargo build --features="runtime-features" --verbose
67-
68-
- name: Build the Project without nuget
65+
- name: Build the Project
6966
run: cargo build --all-features --verbose
7067

7168
- name: Run Tests
72-
run: cargo test --features="runtime-features" --verbose
69+
run: cargo test --all-features --verbose
7370

7471
- name: Generate Documentation (${{ matrix.DOCTYPE }}, ${{ matrix.toolchain }})
75-
run: cargo doc --no-deps --features="runtime-features"
72+
run: cargo doc --no-deps --all-features
7673

7774
- name: Install and Run Security Audit (Nightly Only)
7875
if: matrix.toolchain == 'nightly'
@@ -120,7 +117,7 @@ jobs:
120117
echo "CARGO_TARGET_${var_name}_AR=${{ matrix.target.ar }}" >> $GITHUB_ENV
121118
122119
- name: Build Project for target ${{ matrix.target.triple }}
123-
run: cargo build --target=${{ matrix.target.triple }} --features=no-nuget --release
120+
run: cargo build --target=${{ matrix.target.triple }} --all-features --release
124121

125122
- name: Run doc
126123
run: cargo doc --target=${{ matrix.target.triple }} --no-deps --all-features

.github/workflows/release-and-deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
continue-on-error: false
149149

150150
- name: Run Cargo Publish in Dry-Run Mode
151-
run: cargo publish --dry-run
151+
run: cargo publish -p wslpluginapi-sys --dry-run
152152

153153
- name: Create GitHub Release
154154
id: release
@@ -162,7 +162,7 @@ jobs:
162162
- This version provides bindings for **WSLPluginAPI v${{ env.nuget_version }}**, available on [NuGet](https://www.nuget.org/packages/Microsoft.WSL.PluginApi/${{ env.nuget_version }}).
163163
prerelease: ${{ env.prerelease == 'true' }}
164164

165-
- name: Cargo Publish on crates.io
166-
run: cargo publish
165+
- name: Cargo publish on crates.io
166+
run: cargo publish -p wslpluginapi-sys
167167
env:
168168
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/release-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
exit 1
7676
}
7777
cargo generate-lockfile
78-
$pkgid = cargo pkgid --quiet
78+
$pkgid = cargo pkgid -p wslpluginapi-sys --quiet
7979
if ($pkgid -match "#(.+)$") {
8080
$currentVersion = $matches[1]
8181
} else {
@@ -125,11 +125,11 @@ jobs:
125125
- name: Run Tests
126126
shell: pwsh
127127
run: |
128-
cargo test --all-targets
128+
cargo test -p wslpluginapi-sys --all-targets
129129
130130
- name: Publish Dry-Run
131131
env:
132132
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
133133
shell: pwsh
134134
run: |
135-
cargo publish --dry-run
135+
cargo publish -p wslpluginapi-sys --dry-run

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/target
2-
/nuget_packages/*
3-
Cargo.lock
2+
/nuget_packages/
3+
Cargo.lock

Cargo.toml

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,15 @@
1-
[package]
1+
[workspace]
2+
resolver = "3"
3+
members = ["wslpluginapi-sys", "xtask"]
4+
default-members = ["wslpluginapi-sys"]
5+
6+
7+
[workspace.package]
28
name = "wslpluginapi-sys"
3-
version = "0.1.0-beta.3+2.1.3"
9+
version = "0.1.0-beta.4+2.4.4"
410
edition = "2021"
511
readme = "README.md"
612
authors = ["Mickaël Véril <mika.veril@wanadoo.fr>"]
713
description = "Rust bindings for the WSL Plugin API"
814
license = "MIT"
915
repository = "https://github.com/mveril/wslpluginapi-sys"
10-
keywords = ["wsl", "plugin", "windows", "linux", "ffi"]
11-
categories = ["os::windows-apis", "external-ffi-bindings", "virtualization"]
12-
build = "build/main.rs"
13-
14-
[features]
15-
# Enables all features that modify the library's behavior at runtime.
16-
# Unlike build-related features, this impacts the API's functionalities.
17-
runtime-features = ["hooks-field-names"]
18-
hooks-field-names = ["dep:struct-field-names-as-array"]
19-
# build features
20-
no-nuget = ["dep:zip", "dep:reqwest", "dep:tempfile"]
21-
22-
[build-dependencies]
23-
zip = { version = "2.2", optional = true }
24-
tempfile = { version = "3.16", optional = true }
25-
reqwest = { version = "0.12", optional = true, features = ["blocking"] }
26-
semver = { version = "1.0" }
27-
bindgen = "0.71"
28-
cfg-if = "1.0"
29-
constcat = "0.6.0"
30-
31-
32-
[dependencies]
33-
libc = "0.2"
34-
struct-field-names-as-array = { version = "0.3", features = [
35-
"derive",
36-
], optional = true }
37-
38-
[dependencies.windows]
39-
version = ">0.32"
40-
features = [
41-
"Win32_Foundation",
42-
"Win32_Security",
43-
"Win32_System_Diagnostics_Debug",
44-
"Win32_Networking_WinSock",
45-
]
46-
47-
[package.metadata.docs.rs]
48-
all-features = true
49-
targets = [
50-
"x86_64-pc-windows-msvc",
51-
"x86_64-pc-windows-gnu",
52-
"x86_64-pc-windows-gnullvm",
53-
"aarch64-pc-windows-msvc",
54-
"aarch64-pc-windows-gnullvm",
55-
]

README.MD

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
11
# wslpluginapi-sys
22

3-
[![Crates.io](https://img.shields.io/crates/v/wslpluginapi-sys?logo=rust)](https://crates.io/crates/wslpluginapi-sys)
4-
[![Docs.rs](https://img.shields.io/badge/docs.rs-wslpluginapi--sys-blue?logo=docs.rs)](https://docs.rs/wslpluginapi-sys)
5-
[![Build Status](https://github.com/mveril/wslpluginapi-sys/actions/workflows/ci.yml/badge.svg?logo=github)](https://github.com/mveril/wslpluginapi-sys/actions)
6-
[![License](https://img.shields.io/badge/license-MIT-blue.svg?logo=license)](LICENSE)
7-
[![Native API version](https://img.shields.io/badge/Microsoft.WSL.PluginApi-2.1.3-blue?logo=nuget)](https://www.nuget.org/packages/Microsoft.WSL.PluginApi/2.1.3)
3+
[![Crates.io](https://img.shields.io/crates/v/wslpluginapi-sys?logo=rust)](https://crates.io/crates/wslpluginapi-sys)
4+
[![Docs.rs](https://img.shields.io/badge/docs.rs-wslpluginapi--sys-blue?logo=docs.rs)](https://docs.rs/wslpluginapi-sys)
5+
[![Build Status](https://github.com/mveril/wslpluginapi-sys/actions/workflows/ci.yml/badge.svg?logo=github)](https://github.com/mveril/wslpluginapi-sys/actions)
6+
[![License](https://img.shields.io/badge/license-MIT-blue.svg?logo=license)](LICENSE)
7+
[![Native API version](https://img.shields.io/badge/Microsoft.WSL.PluginApi-2.4.4-blue?logo=nuget)](https://www.nuget.org/packages/Microsoft.WSL.PluginApi/2.4.4)
88
[![Platform](https://img.shields.io/badge/platform-Windows-blue?logo=windows&logoColor=white)](#)
99

1010
`wslpluginapi-sys` is a Rust crate that provides low-level bindings to the Windows Subsystem for Linux (WSL) Plugin API. It offers a direct interface to the functions and structures defined in the WSL Plugin API, facilitating the development of WSL plugins in Rust.
1111

1212
## Features
1313

14-
- **Comprehensive Bindings**: Provides complete bindings to the WSL Plugin API, including structures like `GUID` and other essential components.
14+
- **Comprehensive Bindings**: Provides complete bindings to the WSL Plugin API, including structures like `WSLPluginAPIV1` or `WSLPluginHooksV1` and other essential components.
1515
- **Unsafe Abstractions**: Direct, unsafe bindings closely mirroring the original C API for maximum control and flexibility.
1616

1717
## Prerequisites
1818

1919
Before using `wslpluginapi-sys`, ensure you have the following installed:
2020

2121
- **Rust**: Latest stable version.
22-
- **Nuget**: require nuget cli in the Path or use the `no-nuget` feature to manage the nuget packages via reqwest and zip (useful if nuget is not installed or on non windows environement).
22+
23+
### Optional
24+
25+
- **NuGet**: Use the NuGet CLI in the xtask nuget process to download NuGet (if not present, we use reqwest to do this process).
2326

2427
## Installation
2528

2629
Add `wslpluginapi-sys` to your `Cargo.toml`:
2730

2831
```toml
2932
[dependencies]
30-
wslpluginapi-sys = "0.1.0-beta.3+2.1.3"
33+
wslpluginapi-sys = "0.1.0-beta.4+2.4.4"
3134
```
3235

33-
Safety
36+
## Safety
37+
3438
This crate provides unsafe bindings that closely follow the original C API. Users must ensure they uphold the necessary safety invariants when interacting with these bindings. Proper handling of pointers, memory management, and adherence to the API's expected usage patterns are crucial.
3539

36-
License
40+
## NuGet package dependency
41+
42+
This project depends on a third-party dependency called [Microsoft.WSL.PluginApi](https://www.nuget.org/packages/Microsoft.WSL.PluginApi) from Microsoft, available on NuGet and providing bindings for it. To upgrade it, change the version build metadata of the project and run `cargo xtask nuget` (don't forget to commit changes generated from the xtask). This xtask extracts all the needed content from the NuGet package. For more info see `THIRD-PARTY-NOTICES.md`
43+
44+
## License
45+
3746
This project is licensed under the MIT License. See the LICENSE file for details.
3847

39-
Note: This crate is part of the [WSLPlugin-rs](https://github.com/mveril/wslpluginapi-sys) project, which aims to create an idiomatic Rust framework for developing WSL plugins.
48+
Note: This crate is part of the [WSLPlugins-rs](https://github.com/mveril/wslplugins-rs) project, which aims to create an idiomatic Rust framework for developing WSL plugins.

THIRD-PARTY-NOTICES.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Third Party Notices
2+
3+
## wslpluginapi-sys
4+
5+
### Microsoft.WSL.PluginApi
6+
7+
**Version :** **2.4.4**
8+
9+
**License :** MIT
10+
11+
**Source:**
12+
[Microsoft.WSL.PluginApi](https://www.nuget.org/packages/Microsoft.WSL.PluginApi/2.4.4)
13+
14+
#### Included files from the package.
15+
16+
- `wslpluginapi-sys/third_party/Microsoft.WSL.PluginApi/include/WslPluginApi.h` unmodified
17+
- `wslpluginapi-sys/third_party/Microsoft.WSL.PluginApi/README.MD` unmodified
18+
- `wslpluginapi-sys/third_party/Microsoft.WSL.PluginApi/LICENSE` generated from package metadata
19+
20+
**copyright:**
21+
22+
> © Microsoft Corporation. All rights reserved.

build/main.rs

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

build/nuget.rs

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

0 commit comments

Comments
 (0)