mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
switching veloren naming scheme, to either one of the following:
`stable-0.7.0 (<hash>-<datetime>)` for release versions. And `nightly-<date> (<hash>)` for nightly and master versions Reason is, many players only give information that they are running `0.x.0` but are not giving us the information which day, or commit they are running. So we should make master builds less confusing.
This commit is contained in:
parent
0a64eecffb
commit
8eec46424f
@ -36,6 +36,23 @@ fn main() {
|
||||
},
|
||||
Err(e) => panic!("failed to retrieve current git commit hash: {}", e),
|
||||
}
|
||||
|
||||
// Get the current githash
|
||||
// Note: It will compare commits. As long as the commits do not diverge from the
|
||||
// server no version change will be detected.
|
||||
match Command::new("git")
|
||||
.args(&["describe", "--exact-match", "--tags", "HEAD"])
|
||||
.output()
|
||||
{
|
||||
Ok(output) => match String::from_utf8(output.stdout) {
|
||||
Ok(tag) => {
|
||||
create_tag_file(&tag);
|
||||
},
|
||||
Err(e) => panic!("failed to convert git output to UTF-8: {}", e),
|
||||
},
|
||||
Err(e) => panic!("failed to retrieve current git commit hash: {}", e),
|
||||
}
|
||||
|
||||
// Check if git-lfs is working
|
||||
if std::env::var("DISABLE_GIT_LFS_CHECK").is_err() && cfg!(not(feature = "no-assets")) {
|
||||
let asset_path: PathBuf = ["..", "assets", "voxygen", "background", "bg_main.png"]
|
||||
@ -79,3 +96,14 @@ fn create_hash_file(hash: &str) {
|
||||
.write_all(hash.trim().as_bytes())
|
||||
.expect("failed to write to file!");
|
||||
}
|
||||
|
||||
fn create_tag_file(tag: &str) {
|
||||
let mut target = File::create(
|
||||
Path::new(&env::var("OUT_DIR").expect("failed to query OUT_DIR environment variable"))
|
||||
.join("gittag"),
|
||||
)
|
||||
.expect("failed to create git tag file!");
|
||||
target
|
||||
.write_all(tag.trim().as_bytes())
|
||||
.expect("failed to write to file!");
|
||||
}
|
||||
|
@ -3,10 +3,23 @@ mod dir;
|
||||
mod option;
|
||||
|
||||
pub const GIT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
|
||||
pub const GIT_TAG: &str = include_str!(concat!(env!("OUT_DIR"), "/gittag"));
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref GIT_HASH: &'static str = GIT_VERSION.split('/').next().expect("failed to retrieve git_hash!");
|
||||
pub static ref GIT_DATE: &'static str = GIT_VERSION.split('/').nth(1).expect("failed to retrieve git_date!");
|
||||
static ref GIT_DATETIME: &'static str = GIT_VERSION.split('/').nth(1).expect("failed to retrieve git_datetime!");
|
||||
pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::<Vec<&str>>().join("-");
|
||||
pub static ref GIT_TIME: &'static str = GIT_DATETIME.split('-').nth(3).expect("failed to retrieve git_time!");
|
||||
pub static ref DISPLAY_VERSION: String = if GIT_TAG == "" {
|
||||
format!("nightly-{}", GIT_DATE.to_string())
|
||||
} else {
|
||||
format!("stable-{}", GIT_TAG.to_string())
|
||||
};
|
||||
pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG == "" {
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_HASH.to_string())
|
||||
} else {
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION.to_string())
|
||||
};
|
||||
}
|
||||
|
||||
pub use color::*;
|
||||
|
@ -28,14 +28,7 @@ lazy_static! {
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let matches = App::new("Veloren server cli")
|
||||
.version(
|
||||
format!(
|
||||
"{}-{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
common::util::GIT_HASH.to_string()
|
||||
)
|
||||
.as_str(),
|
||||
)
|
||||
.version(common::util::DISPLAY_VERSION_LONG.as_str())
|
||||
.author("The veloren devs <https://gitlab.com/veloren/veloren>")
|
||||
.about("The veloren server cli provides an easy to use interface to start a veloren server")
|
||||
.arg(
|
||||
|
@ -328,8 +328,11 @@ impl Server {
|
||||
debug!(?settings, "created veloren server with");
|
||||
|
||||
let git_hash = *common::util::GIT_HASH;
|
||||
let git_date = *common::util::GIT_DATE;
|
||||
info!(?git_hash, ?git_date, "Server version",);
|
||||
let git_date = common::util::GIT_DATE.clone();
|
||||
let git_time = *common::util::GIT_TIME;
|
||||
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||
info!(?version, "Server version");
|
||||
debug!(?git_hash, ?git_date, ?git_time, "detailed Server version");
|
||||
|
||||
Ok(this)
|
||||
}
|
||||
|
@ -696,11 +696,7 @@ impl Hud {
|
||||
self.pulse = self.pulse + dt.as_secs_f32();
|
||||
// FPS
|
||||
let fps = global_state.clock.get_tps();
|
||||
let version = format!(
|
||||
"{}-{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
common::util::GIT_VERSION.to_string()
|
||||
);
|
||||
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||
|
||||
if self.show.ingame {
|
||||
let ecs = client.state().ecs();
|
||||
@ -736,7 +732,7 @@ impl Hud {
|
||||
.set(self.ids.hurt_bg, ui_widgets);
|
||||
}
|
||||
// Alpha Disclaimer
|
||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
||||
Text::new(&format!("Veloren Pre-Alpha {}", &version))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(10))
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -442,11 +442,7 @@ impl CharSelectionUi {
|
||||
}
|
||||
}
|
||||
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
|
||||
let version = format!(
|
||||
"{}-{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
common::util::GIT_VERSION.to_string()
|
||||
);
|
||||
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||
|
||||
// Tooltip
|
||||
let tooltip_human = Tooltip::new({
|
||||
@ -720,12 +716,15 @@ impl CharSelectionUi {
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.version, ui_widgets);
|
||||
// Alpha Disclaimer
|
||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(10))
|
||||
.color(TEXT_COLOR)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 2.0)
|
||||
.set(self.ids.alpha_text, ui_widgets);
|
||||
Text::new(&format!(
|
||||
"Veloren Pre-Alpha {}",
|
||||
common::util::DISPLAY_VERSION.as_str()
|
||||
))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(10))
|
||||
.color(TEXT_COLOR)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 2.0)
|
||||
.set(self.ids.alpha_text, ui_widgets);
|
||||
|
||||
// Resize character selection widgets
|
||||
self.ids
|
||||
|
@ -267,11 +267,7 @@ impl<'a> MainMenuUi {
|
||||
);
|
||||
let tip_show = global_state.settings.gameplay.loading_tips;
|
||||
let mut rng = thread_rng();
|
||||
let version = format!(
|
||||
"{}-{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
common::util::GIT_VERSION.to_string()
|
||||
);
|
||||
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||
let scale = 0.8;
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
const TEXT_COLOR_2: Color = Color::Rgba(1.0, 1.0, 1.0, 0.2);
|
||||
@ -364,12 +360,15 @@ impl<'a> MainMenuUi {
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.set(self.ids.version, ui_widgets);
|
||||
// Alpha Disclaimer
|
||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(10))
|
||||
.color(TEXT_COLOR)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 2.0)
|
||||
.set(self.ids.alpha_text, ui_widgets);
|
||||
Text::new(&format!(
|
||||
"Veloren Pre-Alpha {}",
|
||||
common::util::DISPLAY_VERSION.as_str()
|
||||
))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(10))
|
||||
.color(TEXT_COLOR)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 2.0)
|
||||
.set(self.ids.alpha_text, ui_widgets);
|
||||
// Popup (Error/Info/AuthTrustPrompt)
|
||||
let mut change_popup = None;
|
||||
if let Some(PopupData { msg, popup_type }) = &self.popup {
|
||||
|
Loading…
Reference in New Issue
Block a user