Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/code-gen/files/init-scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
#include "compiler/code-gen/files/init-scripts.h"

#include <chrono>
#include <cstdint>
#include <string>

#include "common/algorithms/string-algorithms.h"
Comment thread
apolyakov marked this conversation as resolved.

#include "compiler/code-gen/common.h"
#include "compiler/code-gen/const-globals-batched-mem.h"
#include "compiler/code-gen/declarations.h"
Expand Down Expand Up @@ -297,6 +300,7 @@ void CppMainFile::compile(CodeGenerator &W) const {

void ComponentInfoFile::compile(CodeGenerator &W) const {
kphp_assert(G->is_output_mode_k2());
kphp_assert(G->settings().php_code_commit_hash.get().size() == 40);
Comment thread
apolyakov marked this conversation as resolved.
Outdated
W << OpenFile("image_info.cpp");
W << ExternInclude(G->settings().runtime_headers.get());
W << "__attribute__((visibility(\"default\"))) const ImageInfo *k2_describe() " << BEGIN
Expand All @@ -308,7 +312,7 @@ void ComponentInfoFile::compile(CodeGenerator &W) const {
std::chrono::duration_cast<std::chrono::seconds>(G->settings().build_tp.time_since_epoch()).count()
) << ","
<< "K2_PLATFORM_HEADER_H_VERSION, "
<< "{}," // todo:k2 add commit hash
<< "{" << vk::join(G->settings().php_code_commit_hash.get(), ", ", [](auto c) { return std::to_string(static_cast<uint8_t>(c)); }) << "},"
<< "\"" << G->settings().php_code_version.get() << "\","
<< "extraInfo.size()" << ","
<< "extraInfo.data()"
Expand Down
1 change: 1 addition & 0 deletions compiler/compiler-settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class CompilerSettings : vk::not_copyable {
KphpOption<std::string> compilation_metrics_file;
KphpOption<std::string> override_kphp_version;
KphpOption<std::string> php_code_version;
KphpOption<std::string> php_code_commit_hash;

KphpOption<std::string> k2_component_name;

Expand Down
2 changes: 2 additions & 0 deletions compiler/kphp2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ int main(int argc, char *argv[]) {
"kphp-version-override", "KPHP_VERSION_OVERRIDE");
parser.add("Specify the compiled php code version", settings->php_code_version,
"php-code-version", "KPHP_PHP_CODE_VERSION", "unknown");
parser.add("Specify the compiled php code commit hash", settings->php_code_commit_hash,
"php-code-commit-hash", "KPHP_PHP_CODE_COMMIT_HASH", "0000000000000000000000000000000000000000");
parser.add("C++ compiler for building the output binary", settings->cxx,
"cxx", "KPHP_CXX", get_default_cxx());
parser.add("Directory for c++ compiler toolchain. Will be passed to cxx via -B option", settings->cxx_toolchain_dir,
Expand Down
Loading