build.rs 585 B

1234567891011121314151617181920212223
  1. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. use std::{
  5. env::current_dir,
  6. error::Error,
  7. fs::File,
  8. io::{BufWriter, Write},
  9. };
  10. pub fn main() -> Result<(), Box<dyn Error>> {
  11. let schema = schemars::schema_for!(tauri_utils::config::Config);
  12. let schema_file_path = current_dir()?.join("schema.json");
  13. let mut schema_file = BufWriter::new(File::create(&schema_file_path)?);
  14. write!(
  15. schema_file,
  16. "{}",
  17. serde_json::to_string_pretty(&schema).unwrap()
  18. )?;
  19. Ok(())
  20. }