From f8528dd038d17f33d5803cee1fc746c16ace412e Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 24 Sep 2023 10:25:47 -0400 Subject: [PATCH] allow deployment without timestamp (#720) --- CMakeLists.txt | 5 +++++ src/rime/config/build_info_plugin.cc | 2 ++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ec4398fd..e37430b2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(ENABLE_ASAN "Enable Address Sanitizer (Unix Only)" OFF) option(INSTALL_PRIVATE_HEADERS "Install private headers (usually needed for externally built Rime plugins)" OFF) option(ENABLE_EXTERNAL_PLUGINS "Enable loading of externally built Rime plugins (from directory set by RIME_PLUGINS_DIR variable)" OFF) option(ENABLE_THREADING "Enable threading for deployer" ON) +option(ENABLE_TIMESTAMP "Embed timestamp to schema artifacts" ON) set(RIME_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/rime-data" CACHE STRING "Target directory for Rime data") set(RIME_PLUGINS_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/rime-plugins" CACHE STRING "Target directory for externally built Rime plugins") @@ -97,6 +98,10 @@ if(NOT ENABLE_THREADING) add_definitions(-DRIME_NO_THREADING) endif() +if(NOT ENABLE_TIMESTAMP) + add_definitions(-DRIME_NO_TIMESTAMP) +endif() + if(BUILD_TEST) find_package(GTest REQUIRED) if(GTEST_FOUND) diff --git a/src/rime/config/build_info_plugin.cc b/src/rime/config/build_info_plugin.cc index a60b6b56a..12589732f 100644 --- a/src/rime/config/build_info_plugin.cc +++ b/src/rime/config/build_info_plugin.cc @@ -19,6 +19,7 @@ bool BuildInfoPlugin::ReviewLinkOutput(ConfigCompiler* compiler, an resource) { auto build_info = (*resource)["__build_info"]; build_info["rime_version"] = RIME_VERSION; +#ifndef RIME_NO_TIMESTAMP auto timestamps = build_info["timestamps"]; compiler->EnumerateResources([&](an resource) { if (!resource->loaded) { @@ -37,6 +38,7 @@ bool BuildInfoPlugin::ReviewLinkOutput(ConfigCompiler* compiler, timestamps[resource->resource_id] = (int)boost::filesystem::last_write_time(file_name); }); +#endif return true; }