polyhorn_cli/ios/tasks/
build_runtime_library.rs1use super::{IOSContext, IOSError};
2use crate::core::{CargoBuild, Manager, Task};
3
4pub struct BuildRuntimeLibrary {
7 pub target: &'static str,
9
10 pub profile: &'static str,
12}
13
14impl Task for BuildRuntimeLibrary {
15 type Context = IOSContext;
16 type Error = IOSError;
17
18 fn verb(&self) -> &str {
19 "Building"
20 }
21
22 fn message(&self) -> &str {
23 "runtime library"
24 }
25
26 fn detail(&self) -> &str {
27 "for iOS"
28 }
29
30 fn run(&self, mut context: IOSContext, _manager: &mut Manager) -> Result<IOSContext, IOSError> {
31 eprintln!("");
32
33 let name = CargoBuild::new(&context.config.manifest_dir.join("Cargo.toml"))
34 .crate_type("staticlib")
35 .release(self.profile == "release")
36 .target(self.target)
37 .build()?;
38
39 context.products.insert(
40 self.target.to_owned(),
41 context.config.manifest_dir.join(format!(
42 "target/{}/{}/lib{}.a",
43 self.target, self.profile, name
44 )),
45 );
46
47 Ok(context)
48 }
49}