Change-Id: I6c6847fac56f0a9a1a2209792e00a3aec5e672b9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10809 Autosubmit: aspen <root@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
31 lines
624 B
Rust
31 lines
624 B
Rust
use std::path::PathBuf;
|
|
|
|
use clap::Clap;
|
|
|
|
use crate::common::Result;
|
|
use crate::compiler::{self, CompilerOptions};
|
|
|
|
/// Compile a source file
|
|
#[derive(Clap)]
|
|
pub struct Compile {
|
|
/// File to compile
|
|
file: PathBuf,
|
|
|
|
/// Output file
|
|
#[clap(short = 'o')]
|
|
out_file: PathBuf,
|
|
|
|
#[clap(flatten)]
|
|
options: CompilerOptions,
|
|
}
|
|
|
|
impl Compile {
|
|
pub fn run(self) -> Result<()> {
|
|
eprintln!(
|
|
">>> {} -> {}",
|
|
&self.file.to_string_lossy(),
|
|
self.out_file.to_string_lossy()
|
|
);
|
|
compiler::compile_file(&self.file, &self.out_file, &self.options)
|
|
}
|
|
}
|