generated from nativeshell/app_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
31 lines (26 loc) · 920 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use nativeshell_build::{AppBundleOptions, BuildResult, Flutter, FlutterOptions, MacOSBundle};
fn build_flutter() -> BuildResult<()> {
println!("cargo:rerun-if-changed=./lib/");
println!("cargo:rerun-if-changed=pubspec.yaml");
Flutter::build(FlutterOptions {
..Default::default()
})?;
if cfg!(target_os = "macos") {
let options = AppBundleOptions {
bundle_name: "AppTemplate.app".into(),
bundle_display_name: "App Template".into(),
icon_file: "icons/AppIcon.icns".into(),
..Default::default()
};
let resources = MacOSBundle::build(options)?;
resources.mkdir("icons")?;
resources.link("resources/mac_icon.icns", "icons/AppIcon.icns")?;
}
Ok(())
}
fn main() {
if let Err(error) = build_flutter() {
println!("\n** Build failed with error **\n\n{}", error);
panic!();
}
}