Skip to content

Commit

Permalink
Automation of resources compilation for native installer written in R…
Browse files Browse the repository at this point in the history
…ust.
  • Loading branch information
Luis committed Apr 25, 2021
1 parent 4fadbbf commit 9a84a40
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Khernet.Installer/installer/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ fn main()
let source_native_launcher_path=String::from(format!("{}\\{}","..\\..\\bin\\Khernet.Installer",&native_launcher));
let source_updater_path=String::from(format!("{}\\{}","..\\..\\bin\\Khernet.Installer",&updater));
let source_dotnet_installer_path=String::from(format!("{}\\{}","..\\..\\bin\\Khernet.Installer",&dotnet_installer));
let source_icon_path=String::from("..\\..\\Khernet.UI\\Khernet.UI.Presentation\\LogoIcon.ico");

// Download again files when there is a changed in some of the following paths
println!("cargo:rerun-if-changed={0}",source_dotnet_launcher_path);
println!("cargo:rerun-if-changed={0}",source_main_app_path);
println!("cargo:rerun-if-changed={0}",source_native_launcher_path);
println!("cargo:rerun-if-changed={0}",source_updater_path);
println!("cargo:rerun-if-changed={0}",source_dotnet_installer_path);
println!("cargo:rerun-if-changed={0}",source_icon_path);

// Folder for files that will be embedded into main executable
let assets_folder ="bag";
Expand All @@ -51,6 +53,15 @@ fn main()
format!("{}\\{}", &assets_folder, "media.zip").as_str());
download_and_zip_file("..\\..\\Khernet.UI\\packages\\Khernet.UI.Lib.1.0.0\\build\\firebird\\*",
format!("{}\\{}", &assets_folder, "firebird.zip").as_str());

// Compile resources file for icon of application
match Command::new(&"..\\..\\tools\\rc.exe")
.args(&["resources.rc"])
.output()
{
Ok(_)=>println!("resources.res file created successfully"),
Err(reason)=> panic!("Error creating resources file for \"{}\" : {}", source_icon_path,reason),
}
}

/// Downloads a file from a remote location to a local path.
Expand Down
2 changes: 1 addition & 1 deletion Khernet.Installer/installer/resources.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
khernet_icon ICON "D:\ProdRepo\Khernet.UI\Khernet.UI.Presentation\LogoIcon.ico"
khernet_icon ICON "..\..\Khernet.UI\Khernet.UI.Presentation\LogoIcon.ico"
Binary file added tools/rc.exe
Binary file not shown.
Binary file added tools/rcdll.dll
Binary file not shown.

0 comments on commit 9a84a40

Please sign in to comment.