use std::path::PathBuf;
use color_eyre::eyre;
use target_lexicon::Triple;
use crate::{
build::BuildOptions,
device::{Artifact, Device},
project::Project,
toolchain::Toolchain,
};
#[derive(Debug, Clone)]
pub struct PackageOptions {
distribution: bool,
debug: bool,
}
impl PackageOptions {
#[must_use]
pub const fn new(distribution: bool, debug: bool) -> Self {
Self {
distribution,
debug,
}
}
#[must_use]
pub const fn is_distribution(&self) -> bool {
self.distribution
}
#[must_use]
pub const fn is_debug(&self) -> bool {
self.debug
}
}
pub trait Platform: Send + Sync {
type Toolchain: Toolchain;
type Device: Device;
fn clean(&self, project: &Project) -> impl Future<Output = eyre::Result<()>> + Send;
fn package(
&self,
project: &Project,
options: PackageOptions,
) -> impl Future<Output = eyre::Result<Artifact>> + Send;
fn toolchain(&self) -> Self::Toolchain;
fn scan(&self) -> impl Future<Output = eyre::Result<Vec<Self::Device>>> + Send;
fn triple(&self) -> Triple;
fn build(
&self,
project: &Project,
options: BuildOptions,
) -> impl Future<Output = eyre::Result<PathBuf>> + Send;
}