Skip to content
Open
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 component-generated/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] }

[build-dependencies]
anyhow = "1.0.90"
vergen-gix = { version = "9.1.0", features = ["build", "cargo"] }
vergen-gix = { version = "10.0.0-beta.5", features = ["build", "cargo", "allow_remote"] }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea when 10.0.0 is going to be out? I'm a bit hesitant about including a beta dependency in a template

Alsol, I was under the impression that there should be a simpler fix for this. e.g. if VERGEN_GIT_DESCRIBE is not available, we use another string for the version message.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea when 10.0.0 is going to be out? I'm a bit hesitant about including a beta dependency in a template

Understandable, i'm currently unaware of a planned release timeline, so we could keep this PR here until it stablises.

Alsol, I was under the impression that there should be a simpler fix for this. e.g. if VERGEN_GIT_DESCRIBE is not available, we use another string for the version message.

The problem is that we can't use any VERGEN_GIT_* strings, we'd have to rely on the cargo version and build info for a good version string.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could maybe use option_env like this?

diff --git a/component-generated/src/cli.rs b/component-generated/src/cli.rs
index 8696a0a..336a864 100644
--- a/component-generated/src/cli.rs
+++ b/component-generated/src/cli.rs
@@ -14,14 +14,17 @@ pub struct Cli {
     pub frame_rate: f64,
 }
 
-const VERSION_MESSAGE: &str = concat!(
-    env!("CARGO_PKG_VERSION"),
-    "-",
-    env!("VERGEN_GIT_DESCRIBE"),
-    " (",
-    env!("VERGEN_BUILD_DATE"),
-    ")"
-);
+fn version_message() -> String {
+    let git_describe = option_env!("VERGEN_GIT_DESCRIBE")
+        .map(|describe| format!("-{describe}"))
+        .unwrap_or_default();
+    format!(
+        "{}{} ({})",
+        env!("CARGO_PKG_VERSION"),
+        git_describe,
+        env!("VERGEN_BUILD_DATE")
+    )
+}
 
 pub fn version() -> String {
     let author = clap::crate_authors!();
@@ -32,11 +35,12 @@ pub fn version() -> String {
 
     format!(
         "\
-{VERSION_MESSAGE}
+{}
 
 Authors: {author}
 
 Config directory: {config_dir_path}
-Data directory: {data_dir_path}"
+Data directory: {data_dir_path}",
+        version_message()
     )
 }


# Read the optimization guideline for more details: https://ratatui.rs/recipes/apps/release-your-app/#optimizations
[profile.release]
Expand Down
8 changes: 5 additions & 3 deletions component-generated/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use anyhow::Result;
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder};

fn main() -> Result<()> {
let build = BuildBuilder::all_build()?;
let gix = GixBuilder::all_git()?;
let cargo = CargoBuilder::all_cargo()?;
let build = Build::all_build();
let gix = Gix::all()

.build();
let cargo = Cargo::all_cargo();
Emitter::default()
.add_instructions(&build)?
.add_instructions(&gix)?
Expand Down
2 changes: 1 addition & 1 deletion component-generated/src/components/fps.rs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably because of just-generate

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::time::Instant;
use ratatui::{
Frame,
layout::{Constraint, Layout, Rect},
style::Style,
style::{Style, Stylize},
text::Span,
widgets::Paragraph,
};
Expand Down
2 changes: 1 addition & 1 deletion component/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] }

[build-dependencies]
anyhow = "1.0.90"
vergen-gix = { version = "9.1.0", features = ["build", "cargo"] }
vergen-gix = { version = "10.0.0-beta.5", features = ["build", "cargo", "allow_remote"] }

# Read the optimization guideline for more details: https://ratatui.rs/recipes/apps/release-your-app/#optimizations
[profile.release]
Expand Down
10 changes: 7 additions & 3 deletions component/template/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ use anyhow::Result;
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder};

fn main() -> Result<()> {
let build = BuildBuilder::all_build()?;
let gix = GixBuilder::all_git()?;
let cargo = CargoBuilder::all_cargo()?;
let build = Build::all_build();
let gix = Gix::all()
{% if repository != "" -%}
.remote_url("{{repository}}") // Enter the link to your repo for the version message to work in `cargo install`
{%- endif %}
.build();
let cargo = Cargo::all_cargo();
Emitter::default()
.add_instructions(&build)?
.add_instructions(&gix)?
Expand Down
Loading