Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
Make git-testament optional and disable it by default
Browse files Browse the repository at this point in the history
This allows compiling rcc on alpine, which doesn't support proc-macros.
git-testament is mostly useful for debug builds anyways.
  • Loading branch information
jyn514 committed Jul 24, 2020
1 parent ca7a8a0 commit 7713746
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

0 comments on commit 7713746

Please sign in to comment.