build.rs 780 B

1234567891011121314151617181920212223242526272829
  1. #[cfg(not(feature = "dev-server"))]
  2. extern crate tauri_includedir_codegen;
  3. #[cfg(not(feature = "dev-server"))]
  4. #[macro_use]
  5. extern crate serde_derive;
  6. #[cfg(not(feature = "dev-server"))]
  7. extern crate serde_json;
  8. #[cfg(not(feature = "dev-server"))]
  9. #[path = "src/config.rs"]
  10. mod config;
  11. pub fn main() {
  12. #[cfg(not(feature = "dev-server"))]
  13. {
  14. match std::env::var("TAURI_DIST_DIR") {
  15. Ok(dist_path) => {
  16. let config = config::get();
  17. // include assets
  18. tauri_includedir_codegen::start("ASSETS")
  19. .dir(dist_path, tauri_includedir_codegen::Compression::None)
  20. .build("data.rs", config.inlined_assets)
  21. .expect("failed to build data.rs")
  22. }
  23. Err(e) => panic!("Build error: Couldn't find ENV: {}", e),
  24. }
  25. }
  26. }