From d219814e39648848dc0c12c1b908f163c6a97f86 Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Fri, 3 Nov 2023 14:50:28 +0800 Subject: [PATCH 3/5] Fix undefined version due to configure not honoring options set --- src/gn/gn_main.cc | 4 +--- src/gn/scope_per_file_provider.cc | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git src/gn/gn_main.cc src/gn/gn_main.cc index e1a05177..4f528223 100644 --- src/gn/gn_main.cc +++ src/gn/gn_main.cc @@ -16,8 +16,6 @@ #include "util/msg_loop.h" #include "util/sys_info.h" -#include "last_commit_position.h" - namespace { std::vector GetArgs(const base::CommandLine& cmdline) { @@ -49,7 +47,7 @@ int main(int argc, char** argv) { command = commands::kHelp; } else if (cmdline.HasSwitch(switches::kVersion)) { // Make "--version" print the version and exit. - OutputString(std::string(LAST_COMMIT_POSITION) + "\n"); + OutputString("@VERSION@\n"); exit(0); } else if (args.empty()) { // No command, print error and exit. diff --git src/gn/scope_per_file_provider.cc src/gn/scope_per_file_provider.cc index 9332c40e..d508d873 100644 --- src/gn/scope_per_file_provider.cc +++ src/gn/scope_per_file_provider.cc @@ -12,7 +12,7 @@ #include "gn/value.h" #include "gn/variables.h" -#include "last_commit_position.h" +#define gc_ver_num @VERSION@ ScopePerFileProvider::ScopePerFileProvider(Scope* scope, bool allow_target_vars) : ProgrammaticProvider(scope), allow_target_vars_(allow_target_vars) {} @@ -68,7 +68,7 @@ const Value* ScopePerFileProvider::GetDefaultToolchain() { const Value* ScopePerFileProvider::GetGnVersion() { if (!gn_version_) { gn_version_ = std::make_unique( - nullptr, static_cast(LAST_COMMIT_POSITION_NUM)); + nullptr, static_cast(gc_ver_num)); } return gn_version_.get(); }