mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xMAC94x/versioning_scheme' into 'master'
switching veloren naming scheme, to either one of the following: See merge request veloren/veloren!1386
This commit is contained in:
commit
57b7d3071d
@ -36,6 +36,23 @@ fn main() {
|
|||||||
},
|
},
|
||||||
Err(e) => panic!("failed to retrieve current git commit hash: {}", e),
|
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
|
// Check if git-lfs is working
|
||||||
if std::env::var("DISABLE_GIT_LFS_CHECK").is_err() && cfg!(not(feature = "no-assets")) {
|
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"]
|
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())
|
.write_all(hash.trim().as_bytes())
|
||||||
.expect("failed to write to file!");
|
.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,24 @@ mod dir;
|
|||||||
mod option;
|
mod option;
|
||||||
|
|
||||||
pub const GIT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
|
pub const GIT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
|
||||||
|
pub const GIT_TAG: &str = include_str!(concat!(env!("OUT_DIR"), "/gittag"));
|
||||||
|
pub const VELOREN_VERSION_STAGE: &str = "Pre-Alpha";
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
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_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!("{}-{}", VELOREN_VERSION_STAGE, GIT_DATE.to_string())
|
||||||
|
} else {
|
||||||
|
format!("{}-{}", VELOREN_VERSION_STAGE, 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::*;
|
pub use color::*;
|
||||||
|
@ -28,14 +28,7 @@ lazy_static! {
|
|||||||
|
|
||||||
fn main() -> io::Result<()> {
|
fn main() -> io::Result<()> {
|
||||||
let matches = App::new("Veloren server cli")
|
let matches = App::new("Veloren server cli")
|
||||||
.version(
|
.version(common::util::DISPLAY_VERSION_LONG.as_str())
|
||||||
format!(
|
|
||||||
"{}-{}",
|
|
||||||
env!("CARGO_PKG_VERSION"),
|
|
||||||
common::util::GIT_HASH.to_string()
|
|
||||||
)
|
|
||||||
.as_str(),
|
|
||||||
)
|
|
||||||
.author("The veloren devs <https://gitlab.com/veloren/veloren>")
|
.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")
|
.about("The veloren server cli provides an easy to use interface to start a veloren server")
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -328,8 +328,11 @@ impl Server {
|
|||||||
debug!(?settings, "created veloren server with");
|
debug!(?settings, "created veloren server with");
|
||||||
|
|
||||||
let git_hash = *common::util::GIT_HASH;
|
let git_hash = *common::util::GIT_HASH;
|
||||||
let git_date = *common::util::GIT_DATE;
|
let git_date = common::util::GIT_DATE.clone();
|
||||||
info!(?git_hash, ?git_date, "Server version",);
|
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)
|
Ok(this)
|
||||||
}
|
}
|
||||||
|
@ -696,11 +696,7 @@ impl Hud {
|
|||||||
self.pulse = self.pulse + dt.as_secs_f32();
|
self.pulse = self.pulse + dt.as_secs_f32();
|
||||||
// FPS
|
// FPS
|
||||||
let fps = global_state.clock.get_tps();
|
let fps = global_state.clock.get_tps();
|
||||||
let version = format!(
|
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||||
"{}-{}",
|
|
||||||
env!("CARGO_PKG_VERSION"),
|
|
||||||
common::util::GIT_VERSION.to_string()
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.show.ingame {
|
if self.show.ingame {
|
||||||
let ecs = client.state().ecs();
|
let ecs = client.state().ecs();
|
||||||
@ -736,7 +732,7 @@ impl Hud {
|
|||||||
.set(self.ids.hurt_bg, ui_widgets);
|
.set(self.ids.hurt_bg, ui_widgets);
|
||||||
}
|
}
|
||||||
// Alpha Disclaimer
|
// Alpha Disclaimer
|
||||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
Text::new(&format!("Veloren {}", &version))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.font_size(self.fonts.cyri.scale(10))
|
.font_size(self.fonts.cyri.scale(10))
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
|
@ -442,11 +442,7 @@ impl CharSelectionUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
|
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
|
||||||
let version = format!(
|
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||||
"{}-{}",
|
|
||||||
env!("CARGO_PKG_VERSION"),
|
|
||||||
common::util::GIT_VERSION.to_string()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
let tooltip_human = Tooltip::new({
|
let tooltip_human = Tooltip::new({
|
||||||
@ -720,7 +716,10 @@ impl CharSelectionUi {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.version, ui_widgets);
|
.set(self.ids.version, ui_widgets);
|
||||||
// Alpha Disclaimer
|
// Alpha Disclaimer
|
||||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
Text::new(&format!(
|
||||||
|
"Veloren {}",
|
||||||
|
common::util::DISPLAY_VERSION.as_str()
|
||||||
|
))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.font_size(self.fonts.cyri.scale(10))
|
.font_size(self.fonts.cyri.scale(10))
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
|
@ -267,11 +267,7 @@ impl<'a> MainMenuUi {
|
|||||||
);
|
);
|
||||||
let tip_show = global_state.settings.gameplay.loading_tips;
|
let tip_show = global_state.settings.gameplay.loading_tips;
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
let version = format!(
|
let version = common::util::DISPLAY_VERSION_LONG.clone();
|
||||||
"{}-{}",
|
|
||||||
env!("CARGO_PKG_VERSION"),
|
|
||||||
common::util::GIT_VERSION.to_string()
|
|
||||||
);
|
|
||||||
let scale = 0.8;
|
let scale = 0.8;
|
||||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
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);
|
const TEXT_COLOR_2: Color = Color::Rgba(1.0, 1.0, 1.0, 0.2);
|
||||||
@ -364,7 +360,10 @@ impl<'a> MainMenuUi {
|
|||||||
.font_size(self.fonts.cyri.scale(14))
|
.font_size(self.fonts.cyri.scale(14))
|
||||||
.set(self.ids.version, ui_widgets);
|
.set(self.ids.version, ui_widgets);
|
||||||
// Alpha Disclaimer
|
// Alpha Disclaimer
|
||||||
Text::new(&format!("Veloren Pre-Alpha {}", env!("CARGO_PKG_VERSION")))
|
Text::new(&format!(
|
||||||
|
"Veloren {}",
|
||||||
|
common::util::DISPLAY_VERSION.as_str()
|
||||||
|
))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.font_size(self.fonts.cyri.scale(10))
|
.font_size(self.fonts.cyri.scale(10))
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user