Rename folder tools to cli to keep it consistent with crate naming

This commit is contained in:
Wei Tang
2018-05-15 20:44:18 +08:00
parent c79681aa5b
commit 245ac89f2d
9 changed files with 1 additions and 1 deletions

62
cli/build/source.rs Normal file
View File

@ -0,0 +1,62 @@
//! Configuration of source binaries
pub const UNKNOWN_TRIPLET: &str = "wasm32-unknown-unknown";
pub const EMSCRIPTEN_TRIPLET: &str = "wasm32-unknown-emscripten";
/// Target configiration of previous build step
#[derive(Debug, Clone, Copy)]
pub enum SourceTarget {
Emscripten,
Unknown,
}
/// Configuration of previous build step (cargo compilation)
#[derive(Debug)]
pub struct SourceInput<'a> {
target_dir: &'a str,
bin_name: &'a str,
final_name: &'a str,
target: SourceTarget,
}
impl<'a> SourceInput<'a> {
pub fn new<'b>(target_dir: &'b str, bin_name: &'b str) -> SourceInput<'b> {
SourceInput {
target_dir: target_dir,
bin_name: bin_name,
final_name: bin_name,
target: SourceTarget::Emscripten,
}
}
pub fn unknown(mut self) -> Self {
self.target = SourceTarget::Unknown;
self
}
pub fn emscripten(mut self) -> Self {
self.target = SourceTarget::Emscripten;
self
}
pub fn with_final(mut self, final_name: &'a str) -> Self {
self.final_name = final_name;
self
}
pub fn target_dir(&self) -> &str {
self.target_dir
}
pub fn bin_name(&self) -> &str {
self.bin_name
}
pub fn final_name(&self) -> &str {
self.final_name
}
pub fn target(&self) -> SourceTarget {
self.target
}
}