build.rs 914 B

1234567891011121314151617181920212223242526272829303132
  1. #[cfg(not(feature = "dev-server"))]
  2. pub fn main() {
  3. match std::env::var_os("TAURI_DIST_DIR") {
  4. Some(dist_path) => {
  5. let dist_path_string = dist_path.into_string().unwrap();
  6. println!("cargo:rerun-if-changed={}", dist_path_string);
  7. let inlined_assets = match std::env::var_os("TAURI_INLINED_ASSETS") {
  8. Some(assets) => assets
  9. .into_string()
  10. .unwrap()
  11. .split('|')
  12. .map(|s| s.to_string())
  13. .collect(),
  14. None => Vec::new(),
  15. };
  16. // include assets
  17. tauri_includedir_codegen::start("ASSETS")
  18. .dir(
  19. dist_path_string,
  20. tauri_includedir_codegen::Compression::None,
  21. )
  22. .build("data.rs", inlined_assets)
  23. .expect("failed to build data.rs")
  24. }
  25. None => println!("Build error: Couldn't find ENV: TAURI_DIST_DIR"),
  26. }
  27. }
  28. #[cfg(feature = "dev-server")]
  29. pub fn main() {}