aboutsummaryrefslogtreecommitdiffstats
path: root/tools/rorescompiler
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 /tools/rorescompiler
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'tools/rorescompiler')
-rw-r--r--tools/rorescompiler/bin/ya.make19
-rw-r--r--tools/rorescompiler/main.cpp39
-rw-r--r--tools/rorescompiler/ya.make13
3 files changed, 71 insertions, 0 deletions
diff --git a/tools/rorescompiler/bin/ya.make b/tools/rorescompiler/bin/ya.make
new file mode 100644
index 0000000000..f9d20f4696
--- /dev/null
+++ b/tools/rorescompiler/bin/ya.make
@@ -0,0 +1,19 @@
+OWNER(heretic g:ymake)
+
+PROGRAM(rorescompiler)
+
+PEERDIR(
+ library/cpp/resource
+)
+
+SRCDIR(
+ tools/rorescompiler
+)
+
+SRCS(
+ main.cpp
+)
+
+INCLUDE(${ARCADIA_ROOT}/build/prebuilt/tools/rorescompiler/ya.make.induced_deps)
+
+END()
diff --git a/tools/rorescompiler/main.cpp b/tools/rorescompiler/main.cpp
new file mode 100644
index 0000000000..7ca5346e4c
--- /dev/null
+++ b/tools/rorescompiler/main.cpp
@@ -0,0 +1,39 @@
+#include <library/cpp/resource/registry.h>
+
+#include <util/digest/city.h>
+#include <util/stream/output.h>
+#include <util/stream/file.h>
+#include <util/string/escape.h>
+#include <util/string/vector.h>
+#include <util/string/split.h>
+
+using namespace NResource;
+
+void GenOne(const TString& raw, const TString& key, IOutputStream& out) {
+ TString size = raw + "Size";
+ TString name = ToString(CityHash64(key.data(), key.size()));
+ out << "extern \"C\" const char " << raw << "[];\n"
+ << "extern \"C\" const unsigned int " << size << ";\n"
+ << "static const NResource::TRegHelper REG_name" << name
+ << "(\"" << EscapeC(key) << "\", TStringBuf(" << raw << ", " << size << "));\n"
+ << "\n";
+};
+
+int main(int argc, char** argv) {
+ if (argc < 3) {
+ Cerr << "usage: " << argv[0] << " outfile [key=value]+" << Endl;
+
+ return 1;
+ }
+
+ TFixedBufferFileOutput out(argv[1]);
+
+ argv = argv + 2;
+ out << "#include <library/cpp/resource/registry.h>\n\n";
+
+ while (*argv) {
+ TVector<TString> items = StringSplitter(TString(*(argv))).Split('=').Limit(2).ToList<TString>();
+ GenOne(items[0], items[1], out);
+ argv++;
+ }
+}
diff --git a/tools/rorescompiler/ya.make b/tools/rorescompiler/ya.make
new file mode 100644
index 0000000000..7e372666f9
--- /dev/null
+++ b/tools/rorescompiler/ya.make
@@ -0,0 +1,13 @@
+OWNER(heretic g:ymake)
+
+IF (USE_PREBUILT_TOOLS)
+ INCLUDE(${ARCADIA_ROOT}/build/prebuilt/tools/rorescompiler/ya.make.prebuilt)
+ENDIF()
+
+IF (NOT PREBUILT)
+ INCLUDE(${ARCADIA_ROOT}/tools/rorescompiler/bin/ya.make)
+ENDIF()
+
+RECURSE(
+ bin
+)