File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ use args::{OKAction, OKArgs};
1212use commit:: Commit ;
1313use objdiff_core:: bindings:: report:: { Changes , Report } ;
1414
15- use crate :: { pr:: generate_pr_report, website:: AsmInfo } ;
15+ use crate :: {
16+ pr:: generate_pr_report,
17+ website:: { AsmInfo , generate_website_data} ,
18+ } ;
1619
1720fn main ( ) {
1821 let args: OKArgs = argp:: parse_args_or_exit ( argp:: DEFAULT ) ;
@@ -38,7 +41,11 @@ fn main() {
3841 let report = load_report_json ( & args. report ) ;
3942 let asm_info = load_asm_json ( & args. asm_json ) ;
4043 let first = asm_info. iter ( ) . nth ( 0 ) . unwrap ( ) ;
41- println ! ( "{:?}" , first) ;
44+ let game = generate_website_data ( & report, & asm_info) ;
45+ let mut file = File :: create ( "website.json" ) . unwrap ( ) ;
46+ file. write_all ( serde_json:: to_string_pretty ( & game) . unwrap ( ) . as_bytes ( ) )
47+ . unwrap ( ) ;
48+ println ! ( "{:?}" , game) ;
4249 }
4350 }
4451 }
Original file line number Diff line number Diff line change 22// before we build the website.
33// We mostly use the objdiff report types, but with some added fields.
44
5+ use argp:: TopLevelCommand ;
56use objdiff_core:: bindings:: report:: Report ;
67use serde:: { Deserialize , Serialize } ;
7- // use ts_rs::TS;
8+
9+ pub fn generate_website_data ( report : & Report , asm_info : & Vec < AsmInfo > ) -> Report {
10+ let mut game_report = report. clone ( ) ;
11+ game_report. categories = report
12+ . categories
13+ . iter ( )
14+ . filter ( |c| c. id == "game" )
15+ . map ( |c| c. clone ( ) )
16+ . collect ( ) ;
17+
18+ game_report. calculate_progress_categories ( ) ;
19+
20+ game_report
21+ }
22+
23+ pub struct WebsiteData {
24+ //
25+ }
826
927#[ derive( Debug , Deserialize ) ]
10- // #[ts(export)]
1128pub struct AsmInfo {
1229 name : String ,
1330 opcodes : Vec < String > ,
You can’t perform that action at this time.
0 commit comments