Skip to content

Commit 14de329

Browse files
committed
Add xtask_version information to the json
1 parent 31a886e commit 14de329

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

wslpluginapi-sys/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use serde::Deserialize;
1414

1515
#[derive(Deserialize, Debug)]
1616
pub struct Metadata {
17-
pub version: String,
17+
pub header_version: String,
1818
pub output_file_path: String,
1919
}
2020

@@ -78,10 +78,10 @@ fn main() -> anyhow::Result<()> {
7878
let json: Metadata = serde_json::from_reader(file).unwrap();
7979
json
8080
};
81-
if json_metadata.version != expected_nuget_version {
81+
if json_metadata.header_version != expected_nuget_version {
8282
panic!(
8383
"Version mismatch: metadata.json version '{}' does not match package metadata '{}'",
84-
&json_metadata.version, expected_nuget_version
84+
&json_metadata.header_version, expected_nuget_version
8585
);
8686
}
8787
let output_full_path = build.join(json_metadata.output_file_path);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
c87c896e76f7467ba7ada0849096a07782aa791dca622c8068b16d257297acf9 metadata.json
1+
896ecb0b3b7e6467e6f4cda3b00201473ed7b7face1a31081671bc32b9e679d3 metadata.json
22
b8f7209005250c821184da6a11eefc40a84bfc9d44a34cb9bbd1fc302d62e4b4 WslPluginApi.rs

wslpluginapi-sys/build/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "Microsoft.WSL.PluginApi",
3-
"version": "2.4.4",
3+
"xtask_version": "0.1.0-rc.1+2.4.4",
4+
"header_version": "2.4.4",
45
"header_file_path": "build\\native\\include\\WslPluginApi.h",
56
"output_file_path": "WslPluginApi.rs",
67
"bindgen": {

xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2+
version.workspace = true
23
name = "xtask"
3-
version = "0.1.0"
44
edition = "2024"
55
publish = false
66

xtask/src/metadata.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,33 @@ use std::io::Write;
44
#[derive(Serialize, Debug)]
55
pub struct Metadata {
66
pub id: String,
7-
pub version: String,
7+
pub xtask_version: String,
8+
pub header_version: String,
89
pub header_file_path: String,
910
pub output_file_path: String,
1011
pub bindgen: BindgenMetadata,
1112
}
1213

1314
impl Metadata {
14-
pub fn new<Id, Ver, Header, Output, Target>(
15+
pub fn new<Id, HVer, Header, Output, Target>(
1516
id: Id,
16-
version: Ver,
17+
header_version: HVer,
1718
header_file_path: Header,
1819
output_file_path: Output,
1920
custom_llvm_target: Option<Target>,
2021
) -> Self
2122
where
2223
Id: Into<String>,
23-
Ver: Into<String>,
24+
HVer: Into<String>,
2425
Header: Into<String>,
2526
Output: Into<String>,
2627
Target: Into<String>,
2728
{
2829
let custom_llvm_target = custom_llvm_target.map(|t| t.into());
2930
Self {
3031
id: id.into(),
31-
version: version.into(),
32+
xtask_version: env!("CARGO_PKG_VERSION").into(),
33+
header_version: header_version.into(),
3234
header_file_path: header_file_path.into(),
3335
output_file_path: output_file_path.into(),
3436
bindgen: BindgenMetadata::new(custom_llvm_target),

0 commit comments

Comments
 (0)