Skip to content

Commit c07f1ad

Browse files
committed
Close #13 by deprecating com_chest_02_v_weapon01 and generating Morrowind-metadata.toml
1 parent 35bd4a2 commit c07f1ad

File tree

6 files changed

+45
-3
lines changed

6 files changed

+45
-3
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: cargo build --release
3838

3939
- name: compress
40-
run: 7z a -tzip ${{ matrix.archive }} ./target/release/${{ matrix.binary }}
40+
run: 7z a -tzip ${{ matrix.archive }} ./target/release/${{ matrix.binary }} ./Morrowind-metadata.toml
4141

4242
- name: upload
4343
uses: softprops/action-gh-release@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vscode/
22
target/
3+
Morrowind-metadata.toml

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "StandardsValidator"
3-
version = "2.20.0"
3+
version = "2.21.0"
44
edition = "2021"
55

66
[dependencies]
@@ -20,3 +20,7 @@ features = ["esp"]
2020

2121
[dependencies.codegen]
2222
path = "./crates/codegen"
23+
24+
[build-dependencies]
25+
toml = "0.8.13"
26+
serde_json = "^1.0"

build.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use std::{collections::HashMap, env, error::Error, fs::File, io::Write, path::Path};
2+
use toml::{map::Map, Table, Value};
3+
4+
fn main() -> Result<(), Box<dyn Error>> {
5+
println!("cargo::rerun-if-changed=crates/codegen/data/deprecated.toml");
6+
println!("cargo::rerun-if-changed=build.rs");
7+
let mut metadata: Table =
8+
toml::from_str(include_str!("./crates/codegen/data/deprecated.toml"))?;
9+
// Add version number
10+
let pkg_table = metadata.get_mut("package").unwrap().as_table_mut().unwrap();
11+
let version = env!("CARGO_PKG_VERSION");
12+
pkg_table.insert("version".into(), Value::String(version.into()));
13+
// Add deprecated objects
14+
let mut unique_ids: Vec<Value> = include_str!("./crates/codegen/data/uniques.txt")
15+
.split('\n')
16+
.filter(|id| !id.is_empty())
17+
.map(|id| Value::String(id.into()))
18+
.collect();
19+
let broken: HashMap<String, String> =
20+
serde_json::from_str(include_str!("./crates/codegen/data/broken.json"))?;
21+
for (key, _) in broken {
22+
if !key.starts_with("T_") {
23+
unique_ids.push(Value::String(key));
24+
}
25+
}
26+
let mut tools = Map::new();
27+
let mut csse = Map::new();
28+
csse.insert("deprecated".into(), Value::Array(unique_ids));
29+
tools.insert("csse".into(), Value::Table(csse));
30+
metadata.insert("tools".into(), Value::Table(tools));
31+
// Write metadata
32+
let mut file = File::create(Path::new("./Morrowind-metadata.toml"))?;
33+
file.write_all(metadata.to_string().as_bytes())?;
34+
Ok(())
35+
}

crates/codegen/data/uniques.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ com_chest_02_v_indalen
527527
com_chest_02_v_saetring
528528
com_chest_02_v_shadbak
529529
com_chest_02_v_sosia
530+
com_chest_02_v_weapon01
530531
com_chest_02_valius
531532
com_chest_02_vendu
532533
com_chest_11_aldsotha

0 commit comments

Comments
 (0)