aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-06 09:21:55 +0200
committerStefan Boberg <[email protected]>2021-09-06 09:21:55 +0200
commit39c0d92a05a3d75e4538750c06e51368b687e454 (patch)
tree01fb8e24270ae878ae2c7d42ac7a829044a0e398
parentChanged so function service commits compressed buffers (diff)
parentAdded zenserver-test xmake file (diff)
downloadzen-39c0d92a05a3d75e4538750c06e51368b687e454.tar.xz
zen-39c0d92a05a3d75e4538750c06e51368b687e454.zip
Merge branch 'main' of https://github.com/EpicGames/zen
-rw-r--r--.editorconfig12
-rw-r--r--.gitignore1
-rw-r--r--scripts/deploybuild.py36
-rw-r--r--xmake.lua35
-rw-r--r--zen/xmake.lua16
-rw-r--r--zencore-test/xmake.lua7
-rw-r--r--zencore/compactbinarypackage.cpp4
-rw-r--r--zencore/include/zencore/iohash.h2
-rw-r--r--zencore/xmake.lua6
-rw-r--r--zenserver-test/projectclient.cpp2
-rw-r--r--zenserver-test/xmake.lua4
-rw-r--r--zenserver-test/zenserver-test.cpp5
-rw-r--r--zenserver/compute/apply.cpp2
-rw-r--r--zenserver/xmake.lua18
-rw-r--r--zenstore/filecas.cpp1
-rw-r--r--zenstore/xmake.lua5
-rw-r--r--zenutil/xmake.lua5
-rw-r--r--zenutil/zenserverprocess.cpp2
18 files changed, 138 insertions, 25 deletions
diff --git a/.editorconfig b/.editorconfig
index b75247496..e81597314 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,11 +1,16 @@
# Visual Studio generated .editorconfig file with C++ settings.
root = true
-[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
+indent_style = tab
+indent_size = 4
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{cpp,h,inl}]
# Visual C++ Code Style settings
-cpp_generate_documentation_comments = xml
+cpp_generate_documentation_comments = doxygen_slash_star
# Visual C++ Formatting settings
@@ -67,6 +72,3 @@ cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_wrap_preserve_blocks = one_liners
-
-indent_style = tab
-indent_size = 4
diff --git a/.gitignore b/.gitignore
index ec48d2e39..27ff65485 100644
--- a/.gitignore
+++ b/.gitignore
@@ -217,6 +217,7 @@ __pycache__/
.data/
.minio_data/
.test/
+.xmake/
# Tags
TAGS
diff --git a/scripts/deploybuild.py b/scripts/deploybuild.py
index c2fba672d..1bb052ef7 100644
--- a/scripts/deploybuild.py
+++ b/scripts/deploybuild.py
@@ -59,13 +59,19 @@ except:
jazz_print("Uploading symbols", "to Sentry")
subprocess.run(["scripts\sentry-cli.exe", "upload-dif", "--org", "to", "--project", "zen-server", "x64\\Release\\zenserver.exe", "x64\\Release\\zenserver.pdb"])
-# scripts\sentry-cli.exe upload-dif --org to --project zen-server x64\Release\zenserver.exe x64\Release\zenserver.pdb
# Change into root directory to pick up Perforce environment
+jazz_print(f"Determining P4 environment", f"for directory '{engineroot}'")
+
os.chdir(engineroot)
+
p4info = P4.info().run()
+if p4info is None:
+ jazz_fail("Unable to query P4 info", "do you have source control connectivity?")
+ exit(1)
+
if not os.path.samefile(p4info.clientRoot, engineroot):
print(f"{Fore.RED}Could not find P4 client for UE5 engine root directory '{engineroot}'")
print(Style.RESET_ALL)
@@ -78,31 +84,33 @@ jazz_print("Reverting", "any previous unsubmitted deploy")
try:
P4.revert("Engine/Binaries/Win64/zenserver.*").run()
P4.revert("Engine/Binaries/Win64/crashpad_handler.exe").run()
-except:
+except Exception as e:
+ # it's not super important to report failure here, it's likely
+ # due to the user not actually having the file checked out (yet)
pass
-jazz_print("Checking out", "zenserver executables")
+jazz_print("Checking out", "(at head) zenserver executables")
try:
P4.edit("Engine/Binaries/Win64/zenserver.*").run()
P4.edit("Engine/Binaries/Win64/crashpad_handler.exe").run()
-except:
- pass
+except Exception as e:
+ jazz_fail("edit failed", str(e))
+ exit(1)
-bin_dir = os.path.join(engineroot, "Engine\\Binaries\\Win64")
+target_bin_dir = os.path.join(engineroot, "Engine\\Binaries\\Win64")
-jazz_print("Placing zenserver", f"executables into tree at '{bin_dir}'")
+jazz_print("Placing zenserver", f"executables into tree at '{target_bin_dir}'")
-crashpadtarget = os.path.join(engineroot, "Engine/Binaries/Win64/crashpad_handler.exe")
+crashpadtarget = os.path.join(target_bin_dir, "crashpad_handler.exe")
try:
- shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.exe"), os.path.join(bin_dir, "zenserver.exe"))
- shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.pdb"), os.path.join(bin_dir, "zenserver.pdb"))
+ shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.exe"), os.path.join(target_bin_dir, "zenserver.exe"))
+ shutil.copy(os.path.join(zenroot, "x64\Release\zenserver.pdb"), os.path.join(target_bin_dir, "zenserver.pdb"))
shutil.copy(os.path.join(zenroot, r'vcpkg_installed\x64-windows-static\tools\sentry-native\crashpad_handler.exe'), crashpadtarget)
P4.add(crashpadtarget).run()
- jazz_print("All done and good!")
except Exception as e:
- print(f"Noooooo: {e.args}")
- pass
+ print(f"Caught exception while copying: {e.args}")
+ exit(1)
-# scripts\sentry-cli.exe upload-dif --org to --project zen-server x64\release\zenserver.exe x64\release\zenserver.pdb
+jazz_print("SUCCESS", "binaries ready for check-in")
diff --git a/xmake.lua b/xmake.lua
new file mode 100644
index 000000000..6ca5eb044
--- /dev/null
+++ b/xmake.lua
@@ -0,0 +1,35 @@
+add_requires("vcpkg::doctest", "vcpkg::spdlog", "vcpkg::gsl-lite", "vcpkg::asio", "vcpkg::cpr", "vcpkg::xxhash", "vcpkg::robin-map", "vcpkg::lz4", "vcpkg::fmt")
+add_requires("vcpkg::cxxopts", "vcpkg::mimalloc", "vcpkg::sol2", "vcpkg::sentry-native", "vcpkg::json11")
+add_requires("vcpkg::lua", "vcpkg::curl", "vcpkg::zlib", "vcpkg::zstd", "vcpkg::http-parser")
+
+add_rules("mode.debug", "mode.release")
+if is_mode("release") then
+ set_optimize("smallest")
+ if is_plat("windows") then
+ add_ldflags("/LTCG")
+ end
+end
+
+if is_mode("debug") then
+ add_defines("DEBUG")
+end
+
+add_defines("UNICODE")
+add_linkdirs("$(projectdir)/3rdparty/BLAKE3/lib/Win64", "$(projectdir)/3rdparty/Oodle/lib/Win64")
+
+set_warnings("allextra", "error")
+set_languages("cxx20")
+
+set_symbols("debug")
+
+add_packages("vcpkg::doctest", "vcpkg::spdlog", "vcpkg::gsl-lite", "vcpkg::asio", "vcpkg::cpr", "vcpkg::xxhash", "vcpkg::robin-map", "vcpkg::lz4", "vcpkg::fmt")
+add_packages("vcpkg::cxxopts", "vcpkg::mimalloc", "vcpkg::sol2", "vcpkg::sentry-native", "vcpkg::json11")
+add_packages("vcpkg::lua", "vcpkg::curl", "vcpkg::zlib", "vcpkg::zstd", "vcpkg::http-parser")
+
+includes("zencore/xmake.lua")
+includes("zenstore/xmake.lua")
+includes("zenutil/xmake.lua")
+includes("zencore-test/xmake.lua")
+includes("zenserver/xmake.lua")
+includes("zenserver-test/xmake.lua")
+includes("zen/xmake.lua")
diff --git a/zen/xmake.lua b/zen/xmake.lua
new file mode 100644
index 000000000..4dc1307d0
--- /dev/null
+++ b/zen/xmake.lua
@@ -0,0 +1,16 @@
+target("zen")
+ set_kind("binary")
+ add_files("**.cpp")
+ add_deps("zencore", "zenstore", "zenutil")
+ add_includedirs(".")
+ set_symbols("debug")
+
+ if is_mode("release") then
+ set_optimize("fastest")
+ end
+
+ if is_plat("windows") then
+ add_ldflags("/subsystem:console,5.02")
+ add_ldflags("/LTCG")
+ end
+ \ No newline at end of file
diff --git a/zencore-test/xmake.lua b/zencore-test/xmake.lua
new file mode 100644
index 000000000..e335cad37
--- /dev/null
+++ b/zencore-test/xmake.lua
@@ -0,0 +1,7 @@
+target("zencore-test")
+ set_kind("binary")
+ add_files("*.cpp")
+ add_includedirs("..\\3rdparty\\utfcpp\\source")
+ add_deps("zencore")
+ add_links("BLAKE3")
+ set_symbols("debug")
diff --git a/zencore/compactbinarypackage.cpp b/zencore/compactbinarypackage.cpp
index 92ec3789d..7880164f9 100644
--- a/zencore/compactbinarypackage.cpp
+++ b/zencore/compactbinarypackage.cpp
@@ -567,7 +567,7 @@ TEST_CASE("usonpackage")
CHECK_FALSE(bool(Attachment.AsObject()));
CHECK_FALSE(Attachment.IsBinary());
CHECK_FALSE(Attachment.IsObject());
- CHECK(Attachment.GetHash() == IoHash::Zero);
+ CHECK(Attachment.GetHash() == IoHash::HashBuffer({}));
TestSaveLoadValidate("Null", Attachment);
}
@@ -824,7 +824,7 @@ TEST_CASE("usonpackage.serialization")
CHECK(bool(Package));
CHECK(Package.GetAttachments().size() == 2);
CHECK(Package.GetObject().Equals(CbObject()));
- CHECK(Package.GetObjectHash() == IoHash());
+ CHECK(Package.GetObjectHash() == IoHash::Zero);
TestSaveLoadValidate("Attachments", Package);
const CbAttachment* const Object1Attachment = Package.FindAttachment(Object1.GetHash());
diff --git a/zencore/include/zencore/iohash.h b/zencore/include/zencore/iohash.h
index 4a8fcd03f..aaa638684 100644
--- a/zencore/include/zencore/iohash.h
+++ b/zencore/include/zencore/iohash.h
@@ -25,7 +25,7 @@ class CompositeBuffer;
*/
struct IoHash
{
- alignas(uint32_t) uint8_t Hash[20];
+ alignas(uint32_t) uint8_t Hash[20] = {};
static IoHash MakeFrom(const void* data /* 20 bytes */)
{
diff --git a/zencore/xmake.lua b/zencore/xmake.lua
new file mode 100644
index 000000000..39eb4590e
--- /dev/null
+++ b/zencore/xmake.lua
@@ -0,0 +1,6 @@
+target('zencore')
+ set_kind("static")
+ add_files("**.cpp")
+ add_includedirs("include", {public=true})
+ add_includedirs("..\\3rdparty\\utfcpp\\source")
+
diff --git a/zenserver-test/projectclient.cpp b/zenserver-test/projectclient.cpp
index 8af1a3b73..14d7140ec 100644
--- a/zenserver-test/projectclient.cpp
+++ b/zenserver-test/projectclient.cpp
@@ -23,6 +23,8 @@ struct ProjectClientConnection
void Connect(int BasePort)
{
+ ZEN_UNUSED(BasePort);
+
WideStringBuilder<64> PipeName;
PipeName << "\\\\.\\pipe\\zenprj"; // TODO: this should use an instance-specific identifier!
diff --git a/zenserver-test/xmake.lua b/zenserver-test/xmake.lua
new file mode 100644
index 000000000..aa83c3e38
--- /dev/null
+++ b/zenserver-test/xmake.lua
@@ -0,0 +1,4 @@
+target("zenserver-test")
+ set_kind("binary")
+ add_files("*.cpp")
+ add_deps("zencore", "zenutil")
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 8850e729e..008cae27e 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -88,6 +88,8 @@ public:
void Get(const std::string_view Server, int Port, const std::string_view Path)
{
+ ZEN_UNUSED(Port);
+
http_parser_init(&m_HttpParser, HTTP_RESPONSE);
m_HttpParser.data = this;
@@ -150,7 +152,7 @@ private:
return 0;
}
int OnMessageBegin() { return 0; }
- int OnBody(const char* Data, size_t Bytes) { return 0; }
+ int OnBody(const char* Data, size_t Bytes) { ZEN_UNUSED(Data, Bytes); return 0; }
void OnConnected()
{
@@ -158,6 +160,7 @@ private:
asio::async_write(m_Socket,
asio::const_buffer(m_RequestBody.data(), m_RequestBody.size()),
[this](const std::error_code& Error, size_t Bytes) {
+ ZEN_UNUSED(Bytes);
if (Error)
{
return OnError(Error);
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index 9e6beffe3..939ac3362 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -445,7 +445,7 @@ HttpFunctionService::HttpFunctionService(CasStore& Store, CidStore& InCidStore,
}
}
- spdlog::debug("worker {}: {}B in {} attachments. {}B new ({} attachments)",
+ spdlog::debug("worker {}: {} in {} attachments, {} in {} new attachments",
WorkerId,
zen::NiceBytes(TotalAttachmentBytes),
AttachmentCount,
diff --git a/zenserver/xmake.lua b/zenserver/xmake.lua
new file mode 100644
index 000000000..5c994a3a7
--- /dev/null
+++ b/zenserver/xmake.lua
@@ -0,0 +1,18 @@
+target("zenserver")
+ set_kind("binary")
+ add_files("**.cpp")
+ add_deps("zencore", "zenstore", "zenutil")
+ add_includedirs(".")
+ set_symbols("debug")
+
+ if is_mode("release") then
+ set_optimize("fastest")
+ end
+
+ if is_plat("windows") then
+ add_ldflags("/subsystem:console,5.02")
+ add_ldflags("/MANIFEST:EMBED")
+ add_ldflags("/MANIFESTUAC:level='requireAdministrator'")
+ add_ldflags("/LTCG")
+ end
+ \ No newline at end of file
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index 2ae2676d3..56d25e729 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -355,6 +355,7 @@ FileCasStrategy::Flush()
void
FileCasStrategy::GarbageCollect(GcContext& GcCtx)
{
+ ZEN_UNUSED(GcCtx);
}
} // namespace zen
diff --git a/zenstore/xmake.lua b/zenstore/xmake.lua
new file mode 100644
index 000000000..bd76f3b2b
--- /dev/null
+++ b/zenstore/xmake.lua
@@ -0,0 +1,5 @@
+target('zenstore')
+ set_kind("static")
+ add_files("**.cpp")
+ add_includedirs("include", {public=true})
+ add_deps("zencore")
diff --git a/zenutil/xmake.lua b/zenutil/xmake.lua
new file mode 100644
index 000000000..f4bbcd6f0
--- /dev/null
+++ b/zenutil/xmake.lua
@@ -0,0 +1,5 @@
+target('zenutil')
+ set_kind("static")
+ add_files("**.cpp")
+ add_includedirs("include", {public=true})
+ add_deps("zencore")
diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp
index 112c10dff..4e45ddfae 100644
--- a/zenutil/zenserverprocess.cpp
+++ b/zenutil/zenserverprocess.cpp
@@ -190,7 +190,7 @@ ZenServerState::Register(int ListenPort)
if (Entry.ListenPort.load(std::memory_order::memory_order_relaxed) == 0)
{
uint16_t Expected = 0;
- if (Entry.ListenPort.compare_exchange_strong(Expected, ListenPort))
+ if (Entry.ListenPort.compare_exchange_strong(Expected, uint16_t(ListenPort)))
{
// Successfully allocated entry