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