aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-03 09:25:09 +0100
committerMartin Ridgers <[email protected]>2021-11-03 09:25:09 +0100
commit55a0f5047c069c82e741ecc917e65827377fcda9 (patch)
tree2d0ac1e3e89ccfb70256c1d6a2a4613d2aaf7c69
parentMissing include (diff)
downloadzen-55a0f5047c069c82e741ecc917e65827377fcda9.tar.xz
zen-55a0f5047c069c82e741ecc917e65827377fcda9.zip
Wrapped /apply/ and /exec/ services in a ZEN_WITH_COMPUTE_SERVICES define
-rw-r--r--xmake.lua7
-rw-r--r--zenserver-test/zenserver-test.cpp2
-rw-r--r--zenserver/compute/apply.cpp4
-rw-r--r--zenserver/compute/apply.h8
-rw-r--r--zenserver/testing/launch.cpp4
-rw-r--r--zenserver/testing/launch.h8
-rw-r--r--zenserver/zenserver.cpp8
7 files changed, 40 insertions, 1 deletions
diff --git a/xmake.lua b/xmake.lua
index 241ec15a5..1c1e962e5 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -75,6 +75,13 @@ if is_os("windows") then
set_description("Enable http.sys server")
add_defines("ZEN_WITH_HTTPSYS")
option_end()
+
+ option("compute")
+ set_default(true)
+ set_showmenu(true)
+ set_description("Enable compute services endpoint")
+ add_defines("ZEN_WITH_COMPUTE_SERVICES")
+ option_end()
end
set_warnings("allextra", "error")
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 7aa1a8fa0..3e00760f4 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -2021,6 +2021,7 @@ private:
TEST_CASE("exec.basic")
{
+#if ZEN_WITH_COMPUTE_SERVICES
using namespace std::literals;
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
@@ -2051,6 +2052,7 @@ TEST_CASE("exec.basic")
CHECK(Result["exitcode"].AsInt32(-1) == 1);
}
+#endif // ZEN_WITH_COMPUTE_SERVICES
}
TEST_CASE("mesh.basic")
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index 6669108d2..e1ab7c984 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -2,6 +2,8 @@
#include "apply.h"
+#if ZEN_WITH_COMPUTE_SERVICES
+
#include <zencore/compactbinary.h>
#include <zencore/compactbinarybuilder.h>
#include <zencore/compactbinarypackage.h>
@@ -873,3 +875,5 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
}
} // namespace zen
+
+#endif // ZEN_WITH_COMPUTE_SERVICES
diff --git a/zenserver/compute/apply.h b/zenserver/compute/apply.h
index 86b262213..2c144adad 100644
--- a/zenserver/compute/apply.h
+++ b/zenserver/compute/apply.h
@@ -2,6 +2,12 @@
#pragma once
+#if !defined(ZEN_WITH_COMPUTE_SERVICES)
+# define ZEN_WITH_COMPUTE_SERVICES ZEN_PLATFORM_WINDOWS
+#endif
+
+#if ZEN_WITH_COMPUTE_SERVICES
+
#include <zencore/compactbinary.h>
#include <zencore/iohash.h>
#include <zencore/logging.h>
@@ -50,3 +56,5 @@ private:
};
} // namespace zen
+
+#endif // ZEN_WITH_COMPUTE_SERVICES
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index 569bf99e0..8e58b481e 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -2,6 +2,8 @@
#include "launch.h"
+#if ZEN_WITH_COMPUTE_SERVICES
+
#include <zencore/compactbinary.h>
#include <zencore/compactbinarybuilder.h>
#include <zencore/filesystem.h>
@@ -563,3 +565,5 @@ HttpLaunchService::CreateNewSandbox()
}
} // namespace zen
+
+#endif // ZEN_WITH_COMPUTE_SERVICES
diff --git a/zenserver/testing/launch.h b/zenserver/testing/launch.h
index 49f12e2ec..864d6ac5d 100644
--- a/zenserver/testing/launch.h
+++ b/zenserver/testing/launch.h
@@ -2,6 +2,12 @@
#pragma once
+#if !defined(ZEN_WITH_COMPUTE_SERVICES)
+# define ZEN_WITH_COMPUTE_SERVICES ZEN_PLATFORM_WINDOWS
+#endif
+
+#if ZEN_WITH_COMPUTE_SERVICES
+
#include <zencore/logging.h>
#include <zenhttp/httpserver.h>
@@ -36,3 +42,5 @@ private:
};
} // namespace zen
+
+#endif // ZEN_WITH_COMPUTE_SERVICES
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 37b841a3f..06f3911ec 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -222,6 +222,7 @@ public:
m_HttpProjectService.reset(new zen::HttpProjectService{*m_CidStore, m_ProjectStore});
m_LocalProjectService = zen::LocalProjectService::New(*m_CasStore, m_ProjectStore);
+#if ZEN_WITH_COMPUTE_SERVICES
ZEN_INFO("instantiating compute services");
std::filesystem::path SandboxDir = m_DataRoot / "exec" / "sandbox";
@@ -231,6 +232,7 @@ public:
std::filesystem::path ApplySandboxDir = m_DataRoot / "exec" / "apply";
zen::CreateDirectories(ApplySandboxDir);
m_HttpFunctionService = std::make_unique<zen::HttpFunctionService>(*m_CasStore, *m_CidStore, ApplySandboxDir);
+#endif // ZEN_WITH_COMPUTE_SERVICES
if (ServiceConfig.StructuredCacheEnabled)
{
@@ -268,6 +270,7 @@ public:
m_Http->RegisterService(*m_StructuredCacheService);
}
+#if ZEN_WITH_COMPUTE_SERVICES
if (m_HttpLaunchService)
{
m_Http->RegisterService(*m_HttpLaunchService);
@@ -277,6 +280,7 @@ public:
{
m_Http->RegisterService(*m_HttpFunctionService);
}
+#endif // ZEN_WITH_COMPUTE_SERVICES
m_FrontendService = std::make_unique<HttpFrontendService>(m_ContentRoot);
@@ -506,13 +510,15 @@ private:
zen::HttpCasService m_CasService{*m_CasStore};
zen::RefPtr<zen::ProjectStore> m_ProjectStore;
zen::Ref<zen::LocalProjectService> m_LocalProjectService;
- std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService;
std::unique_ptr<zen::HttpProjectService> m_HttpProjectService;
std::unique_ptr<zen::HttpStructuredCacheService> m_StructuredCacheService;
zen::HttpAdminService m_AdminService;
zen::HttpHealthService m_HealthService;
zen::Mesh m_ZenMesh{m_IoContext};
+#if ZEN_WITH_COMPUTE_SERVICES
+ std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService;
std::unique_ptr<zen::HttpFunctionService> m_HttpFunctionService;
+#endif
std::unique_ptr<zen::HttpFrontendService> m_FrontendService;
bool m_DebugOptionForcedCrash = false;