restore: import verified wave3 baseline
This commit is contained in:
@@ -8,7 +8,8 @@ use nana_domain::{
|
||||
CharacterStyle, CheckDifficulty, CheckRecord, CheckResult, ClockState, DemoPackSummary,
|
||||
HistoryNodeView, ItemAcquisition, ItemInstance, ItemMechanics, ItemPlacement, ItemSpec,
|
||||
KnowledgeCertainty, KnowledgeRecord, Persona, PlayerItemView, PlayerKnowledgeView,
|
||||
PlayerPromiseView, PlayerView, PlotEvent, PlotModule, PlotOutcome, PlotPressure, Promise,
|
||||
PlayerPromiseView, PlayerView, PlotEvent, PlotModule, PlotOutcome, PlotPressure,
|
||||
PresentationBeat, PresentationCharacter, PresentationScene, PresentationSnapshot, Promise,
|
||||
PromiseStatus, PromiseWeight, RelationshipAdjustment, RelationshipAxes, RelationshipBand,
|
||||
RelationshipDimension, RelationshipState, RelationshipView, ResourceBundle, ResourceHeader,
|
||||
ResourceId, ResourceKind, ResourceRef, RuntimeState, SkillValue, StateDelta, StateOp, Story,
|
||||
@@ -20,6 +21,9 @@ use serde::Serialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
use ts_rs::TS;
|
||||
|
||||
type GeneratedOutput = (PathBuf, Vec<u8>);
|
||||
type GeneratedOutputs = Vec<GeneratedOutput>;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let check = env::args().any(|argument| argument == "--check");
|
||||
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
|
||||
@@ -50,9 +54,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn generated_outputs(
|
||||
root: &Path,
|
||||
) -> Result<Vec<(PathBuf, Vec<u8>)>, Box<dyn std::error::Error>> {
|
||||
fn generated_outputs(root: &Path) -> Result<GeneratedOutputs, Box<dyn std::error::Error>> {
|
||||
let mut outputs = Vec::new();
|
||||
let schema_dir = root.join("contracts/schema");
|
||||
|
||||
@@ -63,6 +65,7 @@ fn generated_outputs(
|
||||
add_schema::<PlotModule>(&mut outputs, &schema_dir, "plot-module")?;
|
||||
add_schema::<ItemSpec>(&mut outputs, &schema_dir, "item-spec")?;
|
||||
add_schema::<ResourceBundle>(&mut outputs, &schema_dir, "resource-bundle")?;
|
||||
add_schema::<PresentationSnapshot>(&mut outputs, &schema_dir, "presentation-snapshot")?;
|
||||
add_schema::<StoryNode>(&mut outputs, &schema_dir, "story-node")?;
|
||||
add_schema::<RuntimeState>(&mut outputs, &schema_dir, "runtime-state")?;
|
||||
add_schema::<PlayerView>(&mut outputs, &schema_dir, "player-view")?;
|
||||
@@ -120,6 +123,9 @@ fn generated_outputs(
|
||||
VisualDirective::decl(),
|
||||
PresentationBeat::decl(),
|
||||
ActionSuggestion::decl(),
|
||||
PresentationScene::decl(),
|
||||
PresentationCharacter::decl(),
|
||||
PresentationSnapshot::decl(),
|
||||
PlayerItemView::decl(),
|
||||
PlayerKnowledgeView::decl(),
|
||||
PlayerPromiseView::decl(),
|
||||
@@ -136,14 +142,12 @@ fn generated_outputs(
|
||||
ValidationIssue::decl(),
|
||||
ValidationReport::decl(),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|declaration| format!("export {declaration}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n\n");
|
||||
let ts = format!(
|
||||
"// @generated by crates/nana-contracts; do not edit.\n\n{declarations}\n"
|
||||
);
|
||||
outputs.push((
|
||||
root.join("contracts/ts/index.ts"),
|
||||
ts.into_bytes(),
|
||||
));
|
||||
let ts = format!("// @generated by crates/nana-contracts; do not edit.\n\n{declarations}\n");
|
||||
outputs.push((root.join("contracts/ts/index.ts"), ts.into_bytes()));
|
||||
|
||||
let domain_source = fs::read(root.join("crates/nana-domain/src/lib.rs"))?;
|
||||
let source_hash = format!("{:x}\n", Sha256::digest(domain_source));
|
||||
@@ -156,7 +160,7 @@ fn generated_outputs(
|
||||
}
|
||||
|
||||
fn add_schema<T: JsonSchema + Serialize>(
|
||||
outputs: &mut Vec<(PathBuf, Vec<u8>)>,
|
||||
outputs: &mut GeneratedOutputs,
|
||||
schema_dir: &Path,
|
||||
name: &str,
|
||||
) -> Result<(), serde_json::Error> {
|
||||
|
||||
Reference in New Issue
Block a user