mol_core/
package_manager.rs

1use std::path::Path;
2
3use async_trait::async_trait;
4
5use crate::package::Package;
6use crate::version::Versioned;
7
8#[async_trait]
9pub trait PackageManager {
10  fn default_path() -> &'static str;
11
12  async fn read_package<T: AsRef<Path> + Send + Sync, V: Versioned + Send + Sync + 'static>(
13    &self,
14    crate_path: T,
15  ) -> anyhow::Result<Vec<Package<V>>>;
16
17  async fn check_version<V: Versioned + Send + Sync + 'static>(
18    &self,
19    package: &Package<V>,
20  ) -> anyhow::Result<bool>;
21
22  async fn run_build<T: AsRef<Path> + Send + Sync>(
23    &self,
24    crate_path: T,
25    build_args: Vec<String>,
26  ) -> anyhow::Result<()>;
27
28  async fn run_publish<T: AsRef<Path> + Send + Sync>(
29    &self,
30    crate_path: T,
31    publish_args: Vec<String>,
32    dry_run: bool,
33  ) -> anyhow::Result<()>;
34
35  async fn apply_version<T: AsRef<Path> + Send + Sync>(
36    &self,
37    crate_path: T,
38    version: &str,
39  ) -> anyhow::Result<()>;
40
41  async fn apply_dependency_version<T: AsRef<Path> + Send + Sync>(
42    &self,
43    crate_path: T,
44    name: &str,
45    version: &str,
46  ) -> anyhow::Result<()>;
47}