Skip to content

Commit

Permalink
Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Oct 25, 2023
1 parent 78bb04a commit 3ae3830
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
args: --features metadata
tests:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -30,6 +30,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
run: cargo build --verbose --features metadata
- name: Run tests
run: cargo test --verbose
run: cargo test --verbose --features metadata
14 changes: 10 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ mod doc_gen {
include!("src/dir.rs");
}

#[derive(Serialize, Deserialize, Debug, Clone)]
struct Metadata {
pub functions: Option<Vec<DocFunc>>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[allow(non_snake_case)]
struct DocFunc {
Expand Down Expand Up @@ -120,15 +125,16 @@ mod doc_gen {
pub fn generate_doc(writer: &mut impl Write) {
let mut engine = Engine::new();
let mut fs_module = Module::new();
combine_with_exported_module!(&mut fs_module, "rhai_fs_path", pkg::path_functions);
//combine_with_exported_module!(&mut fs_module, "rhai_fs_path", pkg::path_functions);
combine_with_exported_module!(&mut fs_module, "rhai_file_path", pkg::file_functions);
combine_with_exported_module!(&mut fs_module, "rhai_dir_path", pkg::dir_functions);
//combine_with_exported_module!(&mut fs_module, "rhai_dir_path", pkg::dir_functions);
engine.register_global_module(fs_module.into());

// Extract metadata
let json_fns = engine.gen_fn_metadata_to_json(false).unwrap();
let v: HashMap<String, Vec<DocFunc>> = serde_json::from_str(&json_fns).unwrap();
let function_list = v["functions"].clone();
println!("{json_fns}");
let v: Metadata = serde_json::from_str(&json_fns).unwrap();
let function_list = v.functions.as_ref().map_or(&[][..], Vec::as_slice);

// Write functions
let mut indented = false;
Expand Down

0 comments on commit 3ae3830

Please sign in to comment.