Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Make git-testament optional and disable it by default #448

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ proptest-derive = "0.1"
[features]
default = ["cc", "codegen", "color-backtrace"]
# The `swcc` binary
cc = ["ansi_term", "git-testament", "tempfile", "pico-args", "codegen", "atty"]
cc = ["ansi_term", "tempfile", "pico-args", "codegen", "atty"]
codegen = ["cranelift", "cranelift-module", "cranelift-object"]
jit = ["codegen", "cranelift-simplejit"]
salty = ["rand", "rodio"]
Expand Down
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};

use ansi_term::{ANSIString, Colour};
use git_testament::git_testament_macros;
use pico_args::Arguments;
use saltwater::{
assemble, compile,
Expand All @@ -21,8 +20,6 @@ use tempfile::NamedTempFile;
static ERRORS: AtomicUsize = AtomicUsize::new(0);
static WARNINGS: AtomicUsize = AtomicUsize::new(0);

git_testament_macros!(version);

const HELP: &str = concat!(
env!("CARGO_PKG_NAME"), " ", env!("CARGO_PKG_VERSION"), "\n",
"Joshua Nelson <jyn514@gmail.com>\n",
Expand Down Expand Up @@ -286,6 +283,10 @@ macro_rules! type_sizes {
$(println!("{}: {}", stringify!($type), std::mem::size_of::<$type>());)*
};
}

#[cfg(feature = "git-testament")]
git_testament::git_testament_macros!(version);

fn parse_args() -> Result<(BinOpt, PathBuf), pico_args::Error> {
use std::collections::HashMap;

Expand All @@ -298,7 +299,10 @@ fn parse_args() -> Result<(BinOpt, PathBuf), pico_args::Error> {
std::process::exit(1);
}
if input.contains(["-V", "--version"]) {
#[cfg(feature = "git-testament")]
println!("{} {}", env!("CARGO_PKG_NAME"), version_testament!());
#[cfg(not(feature = "git-testament"))]
println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
if input.contains("--print-type-sizes") {
Expand Down