aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/build_info
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/build_info
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/build_info')
-rw-r--r--library/cpp/build_info/build_info.cpp.in5
-rw-r--r--library/cpp/build_info/build_info.h14
-rw-r--r--library/cpp/build_info/build_info_static.cpp27
-rw-r--r--library/cpp/build_info/build_info_static.h13
-rw-r--r--library/cpp/build_info/sandbox.cpp.in27
-rw-r--r--library/cpp/build_info/sandbox.h12
-rw-r--r--library/cpp/build_info/ya.make24
7 files changed, 122 insertions, 0 deletions
diff --git a/library/cpp/build_info/build_info.cpp.in b/library/cpp/build_info/build_info.cpp.in
new file mode 100644
index 0000000000..71403af13e
--- /dev/null
+++ b/library/cpp/build_info/build_info.cpp.in
@@ -0,0 +1,5 @@
+#include <library/cpp/build_info/build_info.h>
+
+extern "C" const char* GetBuildType() {
+ return "@BUILD_TYPE@";
+}
diff --git a/library/cpp/build_info/build_info.h b/library/cpp/build_info/build_info.h
new file mode 100644
index 0000000000..a494870ba3
--- /dev/null
+++ b/library/cpp/build_info/build_info.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "sandbox.h"
+#include "build_info_static.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+const char* GetBuildType();
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/library/cpp/build_info/build_info_static.cpp b/library/cpp/build_info/build_info_static.cpp
new file mode 100644
index 0000000000..238fb1ecb0
--- /dev/null
+++ b/library/cpp/build_info/build_info_static.cpp
@@ -0,0 +1,27 @@
+#include "build_info_static.h"
+
+#include <library/cpp/build_info/buildinfo_data.h>
+
+extern "C" const char* GetCompilerVersion() {
+#if defined(BUILD_COMPILER_VERSION)
+ return BUILD_COMPILER_VERSION;
+#else
+ return "";
+#endif
+}
+
+extern "C" const char* GetCompilerFlags() {
+#if defined(BUILD_COMPILER_FLAGS)
+ return BUILD_COMPILER_FLAGS;
+#else
+ return "";
+#endif
+}
+
+extern "C" const char* GetBuildInfo() {
+#if defined(BUILD_INFO)
+ return BUILD_INFO;
+#else
+ return "";
+#endif
+}
diff --git a/library/cpp/build_info/build_info_static.h b/library/cpp/build_info/build_info_static.h
new file mode 100644
index 0000000000..9bf9939dd9
--- /dev/null
+++ b/library/cpp/build_info/build_info_static.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+const char* GetCompilerVersion();
+const char* GetCompilerFlags(); // "-std=c++14 -DNDEBUG -O2 -m64 ..."
+const char* GetBuildInfo(); // Compiler version and flags
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/library/cpp/build_info/sandbox.cpp.in b/library/cpp/build_info/sandbox.cpp.in
new file mode 100644
index 0000000000..ac3b2d9004
--- /dev/null
+++ b/library/cpp/build_info/sandbox.cpp.in
@@ -0,0 +1,27 @@
+#include <library/cpp/build_info/sandbox.h>
+#include <library/cpp/string_utils/base64/base64.h>
+#include <util/generic/string.h>
+#include <util/string/subst.h>
+
+extern "C" const char* GetSandboxTaskId() {
+ return "@SANDBOX_TASK_ID@";
+}
+
+class TKosherVersionHolder {
+public:
+ const char* Version() const {
+ if (!Version_) {
+ TString version = "@KOSHER_SVN_VERSION@";
+ SubstGlobal(version, ".", "=");
+ Version_ = Base64Decode(version);
+ }
+ return Version_.c_str();
+ }
+private:
+ mutable TString Version_;
+};
+
+// Experimental code for RMDEV-365
+extern "C" const char* GetKosherSvnVersion() {
+ return Singleton<TKosherVersionHolder>()->Version();
+}
diff --git a/library/cpp/build_info/sandbox.h b/library/cpp/build_info/sandbox.h
new file mode 100644
index 0000000000..924ff89c8c
--- /dev/null
+++ b/library/cpp/build_info/sandbox.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+const char* GetSandboxTaskId();
+const char* GetKosherSvnVersion();
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/library/cpp/build_info/ya.make b/library/cpp/build_info/ya.make
new file mode 100644
index 0000000000..99886a8893
--- /dev/null
+++ b/library/cpp/build_info/ya.make
@@ -0,0 +1,24 @@
+LIBRARY()
+
+OWNER(
+ mvel
+ snowball
+ heretic
+)
+
+DEFAULT(SANDBOX_TASK_ID 0)
+DEFAULT(KOSHER_SVN_VERSION "")
+
+CREATE_BUILDINFO_FOR(buildinfo_data.h)
+
+PEERDIR(
+ library/cpp/string_utils/base64
+)
+
+SRCS(
+ sandbox.cpp.in
+ build_info.cpp.in
+ build_info_static.cpp
+)
+
+END()