mirror of
https://github.com/lune-org/lune.git
synced 2025-04-04 10:30:54 +01:00
refactor: remove support for --base
flag
This commit is contained in:
parent
8d09f4d0ec
commit
971eccf12b
1 changed files with 3 additions and 26 deletions
|
@ -44,12 +44,6 @@ pub struct BuildCommand {
|
|||
/// The target to compile for - defaults to the host triple
|
||||
#[clap(short, long)]
|
||||
pub target: Option<String>,
|
||||
|
||||
/// The path to the base executable to use - defaults to
|
||||
/// the currently running executable, used for cross-compilation
|
||||
/// for targets not directly supported
|
||||
#[clap(short, long)]
|
||||
pub base: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl BuildCommand {
|
||||
|
@ -67,7 +61,7 @@ impl BuildCommand {
|
|||
|
||||
// Dynamically derive the base executable path based on the CLI arguments provided
|
||||
let (to_cross_compile, base_exe_path, output_path) =
|
||||
get_base_exe_path(self.base, self.target, output_path).await?;
|
||||
get_base_exe_path(self.target, output_path).await?;
|
||||
|
||||
// Read the contents of the lune interpreter as our starting point
|
||||
println!(
|
||||
|
@ -136,20 +130,10 @@ pub enum BasePathDiscoveryError {
|
|||
|
||||
/// Discovers the path to the base executable to use for cross-compilation
|
||||
async fn get_base_exe_path(
|
||||
base: Option<PathBuf>,
|
||||
target: Option<String>,
|
||||
output_path: PathBuf,
|
||||
) -> Result<(bool, PathBuf, PathBuf), BasePathDiscoveryError> {
|
||||
if let Some(base) = base {
|
||||
Ok((
|
||||
true,
|
||||
base.clone(),
|
||||
output_path.with_extension(
|
||||
base.extension()
|
||||
.expect("failed to get extension of base binary"),
|
||||
),
|
||||
))
|
||||
} else if let Some(target_inner) = target {
|
||||
if let Some(target_inner) = target {
|
||||
let target_exe_extension = match target_inner.as_str() {
|
||||
"windows-x86_64" => "exe",
|
||||
_ => "bin",
|
||||
|
@ -181,7 +165,7 @@ async fn get_base_exe_path(
|
|||
}),
|
||||
))
|
||||
} else {
|
||||
Ok((false, PathBuf::new(), PathBuf::new()))
|
||||
Ok((false, PathBuf::new(), output_path))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,13 +211,6 @@ async fn cache_target(
|
|||
target
|
||||
);
|
||||
|
||||
println!(
|
||||
"{}: {}",
|
||||
style("HINT").yellow(),
|
||||
style("Perhaps try providing a path to self-compiled target with the `--base` flag")
|
||||
.italic()
|
||||
);
|
||||
|
||||
return Err(BasePathDiscoveryError::TargetNotFound { target });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue