build.rs 779 B

123456789101112131415161718192021222324
  1. #[cfg(not(feature = "dev-server"))]
  2. pub fn main() {
  3. println!(
  4. "cargo:rerun-if-changed={}",
  5. std::env::var("TAURI_DIST_DIR").expect("Unable to read dist directory")
  6. );
  7. match std::env::var("TAURI_DIST_DIR") {
  8. Ok(dist_path) => {
  9. let inlined_assets = match std::env::var("TAURI_INLINED_ASSETS") {
  10. Ok(assets) => assets.split('|').map(|s| s.to_string()).collect(),
  11. Err(_) => Vec::new(),
  12. };
  13. // include assets
  14. tauri_includedir_codegen::start("ASSETS")
  15. .dir(dist_path, tauri_includedir_codegen::Compression::None)
  16. .build("data.rs", inlined_assets)
  17. .expect("failed to build data.rs")
  18. }
  19. Err(e) => panic!("Build error: Couldn't find ENV: {}", e),
  20. }
  21. }
  22. #[cfg(feature = "dev-server")]
  23. pub fn main() {}