Skip to content

Commit

Permalink
Merge pull request #78 from jubako/fix_git_version
Browse files Browse the repository at this point in the history
Fix compilation when we are not from a git repository
  • Loading branch information
mgautierfr authored Nov 22, 2024
2 parents 5f19dcb + e8f2ffc commit 8f9a5e2
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-tags: 0

- name: Fetch tags (see action/checkout#1467)
run: |
git fetch --tags
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true

- name: Publish
env:
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ clap_complete = "4.5.0"
human-panic = "2.0.1"
indicatif = "0.17.7"
anyhow = "1.0.75"
git-version = "0.3.9"
const_format = "0.2.33"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

5 changes: 3 additions & 2 deletions arx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ clap_complete.workspace = true
indicatif.workspace = true
human-panic.workspace = true
anyhow.workspace = true
git-version.workspace = true
const_format.workspace = true
env_logger = "0.10.0"
log = "0.4.20"
tempfile = "3.10.1"
libc = "0.2.158"
color-print = "0.3.7"
git-version = "0.3.9"
const_format = "0.2.33"


[target.'cfg(unix)'.dependencies]
daemonize = "0.5.0"
Expand Down
9 changes: 7 additions & 2 deletions arx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ use log::error;
use std::process::ExitCode;

const VERSION: &str = const_format::formatcp!(
"{} (git:{})",
"{}{}",
clap::crate_version!(),
git_version::git_version!(args = ["--dirty=*", "--tags", "--always"])
git_version::git_version!(
args = ["--dirty=*", "--tags", "--always"],
fallback = "",
prefix = " (git:",
suffix = ")"
)
);

#[derive(Parser, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions tar2arx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ clap_mangen.workspace = true
clap_complete.workspace = true
human-panic.workspace = true
anyhow.workspace = true
git-version.workspace = true
const_format.workspace = true
tar = "0.4.39"
niffler = "2.5.0"
ureq = { version = "2.9.6", optional = true }
Expand Down
13 changes: 12 additions & 1 deletion tar2arx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@ use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::sync::Arc;

const VERSION: &str = const_format::formatcp!(
"{}{}",
clap::crate_version!(),
git_version::git_version!(
args = ["--dirty=*", "--tags", "--always"],
fallback = "",
prefix = " (git:",
suffix = ")"
)
);

/// Convert a tar archive into an Arx archive.
///
/// The tar content (uncompressed) must be passed to stdin.
#[derive(Parser)]
#[command(name = "tar2arx", author, version, about, long_about=None)]
#[command(name = "tar2arx", author, version, long_version=VERSION, about, long_about=None)]
struct Cli {
/// Tar file to convert
#[arg(value_parser, value_hint=ValueHint::FilePath)]
Expand Down
2 changes: 2 additions & 0 deletions zip2arx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ indicatif.workspace = true
clap_mangen.workspace = true
clap_complete.workspace = true
human-panic.workspace = true
git-version.workspace = true
const_format.workspace = true
zip = "2.2.0"
flate2 = "1.0.26"
time = "0.3.36"
Expand Down
13 changes: 12 additions & 1 deletion zip2arx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::sync::Arc;

const VERSION: &str = const_format::formatcp!(
"{}{}",
clap::crate_version!(),
git_version::git_version!(
args = ["--dirty=*", "--tags", "--always"],
fallback = "",
prefix = " (git:",
suffix = ")"
)
);

/// Convert a zip archive into an Arx archive.
#[derive(Parser)]
#[command(name = "tar2arx", author, version, about, long_about=None)]
#[command(name = "tar2arx", author, version, long_version=VERSION, about, long_about=None)]
struct Cli {
/// Zip file to convert
#[arg(
Expand Down

0 comments on commit 8f9a5e2

Please sign in to comment.