Merge pull request #859 from jgmdev/commit-on-version
Add git commit on version of devel builds
This commit is contained in:
commit
0e79607895
|
@ -8,8 +8,18 @@ local function draw_text(x, y, color)
|
||||||
local th = style.big_font:get_height()
|
local th = style.big_font:get_height()
|
||||||
local dh = 2 * th + style.padding.y * 2
|
local dh = 2 * th + style.padding.y * 2
|
||||||
local x1, y1 = x, y + (dh - th) / 2
|
local x1, y1 = x, y + (dh - th) / 2
|
||||||
x = renderer.draw_text(style.big_font, "Lite XL", x1, y1, color)
|
local xv = x1
|
||||||
renderer.draw_text(style.font, "version " .. VERSION, x1, y1 + th, color)
|
local title = "Lite XL"
|
||||||
|
local version = "version " .. VERSION
|
||||||
|
local title_width = style.big_font:get_width(title)
|
||||||
|
local version_width = style.font:get_width(version)
|
||||||
|
if version_width > title_width then
|
||||||
|
version = VERSION
|
||||||
|
version_width = style.font:get_width(version)
|
||||||
|
xv = x1 - (version_width - title_width)
|
||||||
|
end
|
||||||
|
x = renderer.draw_text(style.big_font, title, x1, y1, color)
|
||||||
|
renderer.draw_text(style.font, version, xv, y1 + th, color)
|
||||||
x = x + style.padding.x
|
x = x + style.padding.x
|
||||||
renderer.draw_rect(x, y, math.ceil(1 * SCALE), dh, color)
|
renderer.draw_rect(x, y, math.ceil(1 * SCALE), dh, color)
|
||||||
local lines = {
|
local lines = {
|
||||||
|
|
21
meson.build
21
meson.build
|
@ -9,13 +9,32 @@ project('lite-xl',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Project version including git commit if possible
|
||||||
|
#===============================================================================
|
||||||
|
version = meson.project_version()
|
||||||
|
|
||||||
|
if get_option('buildtype') != 'release'
|
||||||
|
git_command = find_program('git', required : false)
|
||||||
|
|
||||||
|
if git_command.found()
|
||||||
|
git_commit = run_command(
|
||||||
|
[git_command, 'rev-parse', 'HEAD']
|
||||||
|
).stdout().strip()
|
||||||
|
|
||||||
|
if git_commit != ''
|
||||||
|
version += ' (git-' + git_commit.substring(0, 8) + ')'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configuration
|
# Configuration
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
conf_data.set('PROJECT_BUILD_DIR', meson.current_build_dir())
|
conf_data.set('PROJECT_BUILD_DIR', meson.current_build_dir())
|
||||||
conf_data.set('PROJECT_SOURCE_DIR', meson.current_source_dir())
|
conf_data.set('PROJECT_SOURCE_DIR', meson.current_source_dir())
|
||||||
conf_data.set('PROJECT_VERSION', meson.project_version())
|
conf_data.set('PROJECT_VERSION', version)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Compiler Settings
|
# Compiler Settings
|
||||||
|
|
Loading…
Reference in New Issue