Always compute UI_EXTENSION_GIT_SHA
This commit is contained in:
@@ -25,6 +25,20 @@ set(EXTENSION_SOURCES
|
|||||||
src/utils/serialization.cpp
|
src/utils/serialization.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_package(Git)
|
||||||
|
if (NOT Git_FOUND)
|
||||||
|
message(FATAL_ERROR "Git not found, unable to determine git sha")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short=10 HEAD
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE UI_EXTENSION_GIT_SHA
|
||||||
|
)
|
||||||
|
|
||||||
|
message(STATUS "UI_EXTENSION_GIT_SHA=${UI_EXTENSION_GIT_SHA}")
|
||||||
|
add_definitions(-DUI_EXTENSION_GIT_SHA="${UI_EXTENSION_GIT_SHA}")
|
||||||
|
|
||||||
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
|
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
|
||||||
build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES})
|
build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES})
|
||||||
|
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ bool HttpServer::Start(const uint16_t local_port, const std::string &remote_url,
|
|||||||
local_port_ = local_port;
|
local_port_ = local_port;
|
||||||
remote_url_ = remote_url;
|
remote_url_ = remote_url;
|
||||||
ddb_instance_ = ddb_instance;
|
ddb_instance_ = ddb_instance;
|
||||||
#ifndef EXT_VERSION_UI
|
#ifndef UI_EXTENSION_GIT_SHA
|
||||||
#error "EXT_VERSION_UI must be defined"
|
#error "UI_EXTENSION_GIT_SHA must be defined"
|
||||||
#endif
|
#endif
|
||||||
user_agent_ = StringUtil::Format("duckdb-ui/%s(%s)", EXT_VERSION_UI, DuckDB::Platform());
|
user_agent_ = StringUtil::Format("duckdb-ui/%s(%s)", UI_EXTENSION_GIT_SHA, DuckDB::Platform());
|
||||||
event_dispatcher_ = make_uniq<EventDispatcher>();
|
event_dispatcher_ = make_uniq<EventDispatcher>();
|
||||||
thread_ = make_uniq<std::thread>(&HttpServer::Run, this);
|
thread_ = make_uniq<std::thread>(&HttpServer::Run, this);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ std::string UiExtension::Name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string UiExtension::Version() const {
|
std::string UiExtension::Version() const {
|
||||||
#ifdef EXT_VERSION_UI
|
#ifdef UI_EXTENSION_GIT_SHA
|
||||||
return EXT_VERSION_UI;
|
return UI_EXTENSION_GIT_SHA;
|
||||||
#else
|
#else
|
||||||
return "";
|
return "";
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user