@samitouri / QOSAMI-WSL / commits / 7117e320

Enable unity build repo-wide via WSL_UNITY_BATCH_SIZE (#41441)

Enable unity build repo-wide via WSL_UNITY_BATCH_SIZE Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

ggarzia-MSFT committed Sep 2, 2026 at 11:56 UTC 7117e320a7aff187073c9959ed791893240dd429
30 files changed +107 -110
CMakeLists.txt
+11
@@ -199,6 +199,17 @@ endif ()
199 if (NOT WSL_UNITY_BATCH_SIZE MATCHES "^[0-9]+$")
200 message(FATAL_ERROR "WSL_UNITY_BATCH_SIZE must be a non-negative integer: got '${WSL_UNITY_BATCH_SIZE}'")
201 endif ()
202 +
203 +# Applies to every target created below. Targets that can't be unified opt out
204 +# individually with UNITY_BUILD OFF.
205 +# N.B. This is set after the FetchContent dependencies are made available so that
206 +# third party targets keep building file by file.
207 +if (WSL_UNITY_BATCH_SIZE GREATER 0)
208 + set(CMAKE_UNITY_BUILD ON)
209 + set(CMAKE_UNITY_BUILD_MODE BATCH)
210 + set(CMAKE_UNITY_BUILD_BATCH_SIZE ${WSL_UNITY_BATCH_SIZE})
211 + message(STATUS "Unity build enabled with a batch size of ${WSL_UNITY_BATCH_SIZE}")
212 +endif ()
213 find_commit_hash(COMMIT_HASH)
214
215 if (NOT PACKAGE_VERSION)
src/windows/WslcSDK/winrt/CMakeLists.txt
+4 -1
@@ -57,10 +57,13 @@ add_dependencies(wslcsdkwinrt wslcsdkwinrtidl)
57
58 set(MODULE_G_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}/module.g.cpp)
59 target_sources(wslcsdkwinrt PRIVATE ${MODULE_G_CPP})
60 +# The generated module mixes classic COM and C++/WinRT headers, so sharing a
61 +# translation unit with a projection source makes IUnknown ambiguous.
62 set_source_files_properties(
63 ${MODULE_G_CPP}
64 PROPERTIES
63 - GENERATED TRUE)
65 + GENERATED TRUE
66 + SKIP_UNITY_BUILD_INCLUSION ON)
67
68 target_precompile_headers(wslcsdkwinrt PRIVATE precomp.h)
69 target_include_directories(wslcsdkwinrt PRIVATE
src/windows/WslcSDK/winrt/WslcService.cpp
+2 -2
@@ -24,7 +24,7 @@ using namespace winrt::Windows::Foundation::Collections;
24 namespace winrt::Microsoft::WSL::Containers::implementation {
25
26 namespace {
27 - WslcComponentFlags GetComponentsForInstall(const InstallOptions& options)
27 + WslcComponentFlags GetComponentsForInstall(const winrt::Microsoft::WSL::Containers::InstallOptions& options)
28 {
29 WslcComponentFlags result = WslcComponentFlags::WSLC_COMPONENT_FLAG_NONE;
30 bool shouldCheckMissingComponents = true;
@@ -63,7 +63,7 @@ namespace {
63 return result;
64 }
65
66 - WslcInstallOptions GetOptionsForInstall(const InstallOptions& options)
66 + WslcInstallOptions GetOptionsForInstall(const winrt::Microsoft::WSL::Containers::InstallOptions& options)
67 {
68 WslcInstallOptions result = WslcInstallOptions::WSLC_INSTALL_OPTION_NONE;
69
src/windows/common/CMakeLists.txt
+9 -1
@@ -158,7 +158,15 @@ target_precompile_headers(common PRIVATE precomp.h)
158 set_target_properties(common PROPERTIES FOLDER windows)
159 target_include_directories(common PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../service/mc/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE})
160
161 +# common calls into HCS, HNS, the IP helper API, the VHD APIs, MSI, WinTrust and
162 +# the config file parser, so anything linking common needs those libraries too.
163 +# PUBLIC propagates them instead of making each consumer restate them.
164 +target_link_libraries(common PUBLIC ${HCS_LINK_LIBRARIES} ${MSI_LINK_LIBRARIES} VirtDisk.lib configfile)
165 +
166 # WSLCUserSettings.cpp uses yaml-cpp headers.
167 +# The per-source include path and definition below only apply when the file is
168 +# compiled on its own, so keep it out of the unity sources.
169 set_source_files_properties(WSLCUserSettings.cpp PROPERTIES
170 INCLUDE_DIRECTORIES "${yaml-cpp_SOURCE_DIR}/include"
164 - COMPILE_DEFINITIONS "YAML_CPP_STATIC_DEFINE")
171 + COMPILE_DEFINITIONS "YAML_CPP_STATIC_DEFINE"
172 + SKIP_UNITY_BUILD_INCLUSION ON)
src/windows/common/HandleIO.cpp
+1 -11
@@ -10,6 +10,7 @@ using wsl::windows::common::io::DockerIORelayHandle;
10 using wsl::windows::common::io::EventHandle;
11 using wsl::windows::common::io::HandleWrapper;
12 using wsl::windows::common::io::HTTPChunkBasedReadHandle;
13 +using wsl::windows::common::io::InitializeFileOffset;
14 using wsl::windows::common::io::IOHandleStatus;
15 using wsl::windows::common::io::LineBasedReadHandle;
16 using wsl::windows::common::io::MultiHandleWait;
@@ -22,17 +23,6 @@ using wsl::windows::common::io::WriteNamedPipe;
23
24 namespace {
25
25 -LARGE_INTEGER InitializeFileOffset(HANDLE File)
26 -{
27 - LARGE_INTEGER Offset{};
28 - if (GetFileType(File) == FILE_TYPE_DISK)
29 - {
30 - LOG_IF_WIN32_BOOL_FALSE(SetFilePointerEx(File, {}, &Offset, FILE_CURRENT));
31 - }
32 -
33 - return Offset;
34 -}
35 -
26 DWORD CancelPendingIo(auto Handle, OVERLAPPED& Overlapped)
27 {
28 DWORD bytesTransferred{};
src/windows/common/HandleIO.h
+12
@@ -10,6 +10,18 @@
10
11 namespace wsl::windows::common::io {
12
13 +// Returns the current file pointer for disk handles, and a zero offset for every other handle type.
14 +inline LARGE_INTEGER InitializeFileOffset(HANDLE File)
15 +{
16 + LARGE_INTEGER Offset{};
17 + if (GetFileType(File) == FILE_TYPE_DISK)
18 + {
19 + LOG_IF_WIN32_BOOL_FALSE(SetFilePointerEx(File, {}, &Offset, FILE_CURRENT));
20 + }
21 +
22 + return Offset;
23 +}
24 +
25 enum class IOHandleStatus
26 {
27 Standby,
src/windows/common/WSLCSessionDefaults.h
+5
@@ -25,4 +25,9 @@ inline constexpr const char DefaultHostLoopback[] = "host.wslc.internal";
25 inline constexpr uint32_t DefaultBootTimeoutMs = 30000;
26 inline constexpr const char ContainerdStorageMountPoint[] = "/var/lib/docker";
27
28 +// Grace period given to a container runtime process to exit after being asked to terminate, and
29 +// the additional time it is given after being killed.
30 +inline constexpr uint32_t ProcessTerminateTimeoutMs = 30 * 1000;
31 +inline constexpr uint32_t ProcessKillTimeoutMs = 10 * 1000;
32 +
33 } // namespace wsl::windows::wslc
src/windows/common/WslClient.cpp
+2 -2
@@ -108,7 +108,7 @@ struct ShellExecOptions
108 }
109 };
110
111 -void PromptForKeyPress()
111 +void PromptForKeyPressToExit()
112 {
113 if (wsl::windows::common::wslutil::IsInteractiveConsole())
114 {
@@ -1989,7 +1989,7 @@ int wsl::windows::common::WslClient::Main(_In_ LPCWSTR commandLine)
1989 if (g_promptBeforeExit)
1990 {
1991 g_promptBeforeExit = false;
1992 - PromptForKeyPress();
1992 + PromptForKeyPressToExit();
1993 }
1994
1995 return exitCode;
src/windows/common/relay.cpp
+1 -45
@@ -16,54 +16,10 @@ Abstract:
16 #include "relay.hpp"
17 #pragma hdrstop
18
19 +using wsl::windows::common::io::InitializeFileOffset;
20 using wsl::windows::common::relay::ScopedMultiRelay;
21 using wsl::windows::common::relay::ScopedRelay;
22
22 -namespace {
23 -
24 -LARGE_INTEGER InitializeFileOffset(HANDLE File)
25 -{
26 - LARGE_INTEGER Offset{};
27 - if (GetFileType(File) == FILE_TYPE_DISK)
28 - {
29 - LOG_IF_WIN32_BOOL_FALSE(SetFilePointerEx(File, {}, &Offset, FILE_CURRENT));
30 - }
31 -
32 - return Offset;
33 -}
34 -
35 -void CancelPendingIo(auto Handle, OVERLAPPED& Overlapped)
36 -{
37 - DWORD bytesTransferred{};
38 - if (CancelIoEx((HANDLE)Handle, &Overlapped))
39 - {
40 - if constexpr (std::is_same_v<decltype(Handle), SOCKET>)
41 - {
42 - if (!WSAGetOverlappedResult(Handle, &Overlapped, &bytesTransferred, true, nullptr))
43 - {
44 - auto error = WSAGetLastError();
45 - LOG_LAST_ERROR_IF(error != WSAECONNABORTED && error != WSA_OPERATION_ABORTED && error != WSAECONNRESET);
46 - }
47 - }
48 - else
49 - {
50 - static_assert(std::is_same_v<decltype(Handle), HANDLE>);
51 - if (!GetOverlappedResult(Handle, &Overlapped, &bytesTransferred, true))
52 - {
53 - auto error = GetLastError();
54 - LOG_LAST_ERROR_IF(error != ERROR_CONNECTION_ABORTED && error != ERROR_OPERATION_ABORTED);
55 - }
56 - }
57 - }
58 - else
59 - {
60 - // ERROR_NOT_FOUND is returned if there was no IO to cancel.
61 - LOG_LAST_ERROR_IF(GetLastError() != ERROR_NOT_FOUND);
62 - }
63 -}
64 -
65 -} // namespace
66 -
23 std::thread wsl::windows::common::relay::CreateThread(_In_ HANDLE InputHandle, _In_ HANDLE OutputHandle, _In_opt_ HANDLE ExitHandle, _In_ size_t BufferSize)
24 {
25 return std::thread([InputHandle, OutputHandle, ExitHandle, BufferSize]() {
src/windows/libwsl/CMakeLists.txt
+4 -1
@@ -15,4 +15,7 @@ target_link_libraries(libwsl
15 common
16 configfile
17 legacy_stdio_definitions
18 - VirtDisk.lib)
\ No newline at end of file
18 + VirtDisk.lib
19 + delayimp.lib)
20 +
21 +set_target_properties(libwsl PROPERTIES LINK_FLAGS "/DELAYLOAD:msi.dll /DELAYLOAD:WINTRUST.dll")
\ No newline at end of file
src/windows/service/exe/HcsVirtualMachine.cpp
+1 -1
@@ -421,7 +421,7 @@ try
421 {
422 RETURN_HR_IF_NULL(E_POINTER, Socket);
423
424 - auto socket = socket::CancellableAccept(m_listenSocket.get(), m_bootTimeoutMs, m_vmExitEvent.get());
424 + auto socket = wsl::windows::common::socket::CancellableAccept(m_listenSocket.get(), m_bootTimeoutMs, m_vmExitEvent.get());
425 THROW_HR_IF(E_ABORT, !socket.has_value());
426
427 *Socket = reinterpret_cast<HANDLE>(socket->release());
src/windows/service/exe/WslCoreVm.cpp
+3 -2
@@ -876,7 +876,8 @@ WslCoreVm::~WslCoreVm() noexcept
876
877 wil::unique_socket WslCoreVm::AcceptConnection(_In_ DWORD ReceiveTimeout, _In_ const std::source_location& Location) const
878 {
879 - auto socket = socket::CancellableAccept(m_listenSocket.get(), m_vmConfig.KernelBootTimeout, m_terminatingEvent.get(), Location);
879 + auto socket = wsl::windows::common::socket::CancellableAccept(
880 + m_listenSocket.get(), m_vmConfig.KernelBootTimeout, m_terminatingEvent.get(), Location);
881 THROW_HR_IF(E_ABORT, !socket.has_value());
882
883 if (ReceiveTimeout != 0)
@@ -1133,7 +1134,7 @@ void WslCoreVm::CollectCrashDumps(wil::unique_socket&& listenSocket) const
1134 {
1135 try
1136 {
1136 - auto socket = socket::CancellableAccept(listenSocket.get(), INFINITE, m_terminatingEvent.get());
1137 + auto socket = wsl::windows::common::socket::CancellableAccept(listenSocket.get(), INFINITE, m_terminatingEvent.get());
1138 if (!socket.has_value())
1139 {
1140 break; // VM is exiting.
src/windows/service/stub/CMakeLists.txt
+5 -1
@@ -14,4 +14,8 @@ set_source_files_properties(${SOURCES} PROPERTIES GENERATED TRUE)
14 add_library(wslserviceproxystub SHARED ${SOURCES})
15 add_dependencies(wslserviceproxystub wslserviceidl)
16 target_link_libraries(wslserviceproxystub ${COMMON_LINK_LIBRARIES})
17 -set_target_properties(wslserviceproxystub PROPERTIES FOLDER windows)
\ No newline at end of file
17 +set_target_properties(wslserviceproxystub PROPERTIES FOLDER windows)
18 +
19 +# MIDL generated proxy files each define their own MIDL_TYPE_FORMAT_STRING and
20 +# related symbols, so they can't share a translation unit.
21 +set_target_properties(wslserviceproxystub PROPERTIES UNITY_BUILD OFF)
\ No newline at end of file
src/windows/wslc/CMakeLists.txt
+2 -8
@@ -10,13 +10,6 @@ file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${SOURCE_PATTERNS})
10 # Used to build the executable and also unit testing components.
11 add_library(wslclib OBJECT ${SOURCES} ${HEADERS})
12
13 -if (DEFINED WSL_UNITY_BATCH_SIZE AND WSL_UNITY_BATCH_SIZE GREATER 0)
14 - set_target_properties(wslclib PROPERTIES
15 - UNITY_BUILD ON
16 - UNITY_BUILD_MODE BATCH
17 - UNITY_BUILD_BATCH_SIZE ${WSL_UNITY_BATCH_SIZE})
18 -endif ()
19 -
13 target_include_directories(wslclib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${WSLC_SUBDIR_PATHS})
14
15 target_link_libraries(wslclib
@@ -35,8 +28,9 @@ set_target_properties(wslclib PROPERTIES FOLDER windows)
28 # transitive dependencies. Do not also use $<TARGET_OBJECTS:wslclib>.
29 add_executable(wslc main.rc resource.h)
30
38 -target_link_libraries(wslc wslclib)
31 +target_link_libraries(wslc wslclib delayimp.lib)
32
33 +set_target_properties(wslc PROPERTIES LINK_FLAGS "/DELAYLOAD:msi.dll /DELAYLOAD:WINTRUST.dll")
34 set_target_properties(wslc PROPERTIES FOLDER windows)
35
36 # For prettier source tree browsing
src/windows/wslc/core/Command.cpp
+2 -2
@@ -571,7 +571,7 @@ std::unique_ptr<Command> Command::FindSubCommand(Invocation& inv) const
571
572 for (auto& command : commands)
573 {
574 - if (string::IsEqual(*itr, command->Name()))
574 + if (wsl::shared::string::IsEqual(*itr, command->Name()))
575 {
576 inv.consume(itr);
577 return std::move(command);
@@ -579,7 +579,7 @@ std::unique_ptr<Command> Command::FindSubCommand(Invocation& inv) const
579
580 for (const auto& alias : command->Aliases())
581 {
582 - if (string::IsEqual(*itr, alias))
582 + if (wsl::shared::string::IsEqual(*itr, alias))
583 {
584 inv.consume(itr);
585 return std::move(command);
src/windows/wslc/core/TableOutput.h
+1
@@ -21,6 +21,7 @@ Abstract:
21 #include <initializer_list>
22 #include <optional>
23 #include <string>
24 +#include <string_view>
25 #include <utility>
26 #include <variant>
27 #include <vector>
src/windows/wslcsession/CMakeLists.txt
+4 -1
@@ -65,7 +65,10 @@ target_link_libraries(wslcsession
65 common
66 legacy_stdio_definitions
67 VirtDisk.lib
68 - Crypt32.lib)
68 + Crypt32.lib
69 + delayimp.lib)
70 +
71 +set_target_properties(wslcsession PROPERTIES LINK_FLAGS "/DELAYLOAD:msi.dll /DELAYLOAD:WINTRUST.dll")
72
73 target_precompile_headers(wslcsession REUSE_FROM common)
74 set_target_properties(wslcsession PROPERTIES FOLDER windows)
src/windows/wslcsession/WSLCContainer.cpp
+5 -6
@@ -54,7 +54,6 @@ using wsl::windows::service::wslc::WSLCContainerMetadata;
54 using wsl::windows::service::wslc::WSLCContainerMetadataLabel;
55 using wsl::windows::service::wslc::WSLCContainerMetadataV1;
56 using wsl::windows::service::wslc::WSLCExecutionContext;
57 -using wsl::windows::service::wslc::WSLCPortMapping;
57 using wsl::windows::service::wslc::WSLCSession;
58 using wsl::windows::service::wslc::WSLCVirtualMachine;
59 using wsl::windows::service::wslc::WSLCVolumeMount;
@@ -138,7 +137,7 @@ std::pair<uint16_t, int> ParseExposedPortKey(const std::string& key)
137 // TODO: Remove once the port relay can allocate ephemeral ports.
138 uint16_t AllocateEphemeralPort(int family, const char* address)
139 {
141 - wil::unique_socket sock(socket(family, SOCK_STREAM, IPPROTO_TCP));
140 + wil::unique_socket sock(::socket(family, SOCK_STREAM, IPPROTO_TCP));
141 THROW_LAST_ERROR_IF(!sock);
142
143 SOCKADDR_INET addr{};
@@ -791,9 +790,9 @@ unique_com_disconnect::~unique_com_disconnect() noexcept
790 }
791 }
792
794 -WSLCPortMapping ContainerPortMapping::Serialize() const
793 +wsl::windows::service::wslc::WSLCPortMapping ContainerPortMapping::Serialize() const
794 {
796 - return WSLCPortMapping{
795 + return wsl::windows::service::wslc::WSLCPortMapping{
796 .HostPort = VmMapping.HostPort(),
797 .VmPort = VmMapping.VmPort ? VmMapping.VmPort->Port() : ContainerPort,
798 .ContainerPort = ContainerPort,
@@ -932,7 +931,7 @@ const std::string& WSLCContainerImpl::Name() const noexcept
931 return m_name;
932 }
933
935 -std::vector<WSLCPortMapping> WSLCContainerImpl::GetPorts() const
934 +std::vector<wsl::windows::service::wslc::WSLCPortMapping> WSLCContainerImpl::GetPorts() const
935 {
936 auto lock = m_lock.lock_shared();
937 if (m_state != WslcContainerStateRunning)
@@ -940,7 +939,7 @@ std::vector<WSLCPortMapping> WSLCContainerImpl::GetPorts() const
939 return {};
940 }
941
943 - std::vector<WSLCPortMapping> result;
942 + std::vector<wsl::windows::service::wslc::WSLCPortMapping> result;
943 result.reserve(m_mappedPorts.size());
944 for (const auto& port : m_mappedPorts)
945 {
src/windows/wslcsession/WSLCSession.cpp
+2 -5
@@ -38,11 +38,8 @@ using wsl::windows::service::wslc::WSLCExecutionContext;
38 using wsl::windows::service::wslc::WSLCSession;
39 using wsl::windows::service::wslc::WSLCVirtualMachine;
40
41 -constexpr auto c_containerdStorage = wsl::windows::wslc::ContainerdStorageMountPoint;
41 constexpr auto c_containerdSocket = "/run/containerd/containerd.sock";
42 constexpr auto c_storageVhdFilename = wsl::windows::wslc::DefaultStorageVhdName;
44 -constexpr DWORD c_processTerminateTimeoutMs = 30 * 1000;
45 -constexpr DWORD c_processKillTimeoutMs = 10 * 1000;
43 constexpr uint32_t c_progressPrecision = 4;
44
45 // Default grace period to keep an otherwise-idle VM running before tearing it down (used when the
@@ -577,7 +574,7 @@ void WSLCSession::ConfigureStorage(const WSLCSessionInitSettings& Settings, PSID
574 if (Settings.StoragePath == nullptr)
575 {
576 // If no storage path is specified, use a tmpfs for convenience.
580 - m_runtime.Vm().Mount("", c_containerdStorage, "tmpfs", "", 0);
577 + m_runtime.Vm().Mount("", wsl::windows::wslc::ContainerdStorageMountPoint, "tmpfs", "", 0);
578 m_runtime.SetStorageMounted(true);
579 return;
580 }
@@ -643,7 +640,7 @@ void WSLCSession::ConfigureStorage(const WSLCSessionInitSettings& Settings, PSID
640 }
641
642 // Mount the device to /root.
646 - m_runtime.Vm().Mount(diskDevice.c_str(), c_containerdStorage, "ext4", "discard", 0);
643 + m_runtime.Vm().Mount(diskDevice.c_str(), wsl::windows::wslc::ContainerdStorageMountPoint, "ext4", "discard", 0);
644 m_runtime.SetStorageMounted(true);
645
646 // Configure swap on a separate ephemeral VHD.
src/windows/wslcsession/WSLCSessionRuntime.cpp
+5 -6
@@ -21,10 +21,7 @@ using wsl::windows::service::wslc::WSLCSessionRuntime;
21
22 namespace {
23
24 -constexpr auto c_containerdStorage = wsl::windows::wslc::ContainerdStorageMountPoint;
24 constexpr auto c_dockerdReadyLogLine = "API listen on /var/run/docker.sock";
26 -constexpr DWORD c_processTerminateTimeoutMs = 30 * 1000;
27 -constexpr DWORD c_processKillTimeoutMs = 10 * 1000;
25
26 // How long a VM lease waits for an announced stop to complete before logging that it is still
27 // blocked. Purely diagnostic: the wait itself is unbounded (see VmLease).
@@ -548,13 +545,15 @@ void WSLCSessionRuntime::TearDownVmLockHeld(bool CaptureTerminationReason)
545 // N.B. dockerd waits a couple seconds if there are any outstanding HTTP request sockets opened.
546 if (m_dockerdProcess.has_value())
547 {
551 - auto dockerdExitCode = StopProcess(m_dockerdProcess.value(), c_processTerminateTimeoutMs, c_processKillTimeoutMs);
548 + auto dockerdExitCode =
549 + StopProcess(m_dockerdProcess.value(), wsl::windows::wslc::ProcessTerminateTimeoutMs, wsl::windows::wslc::ProcessKillTimeoutMs);
550 WSL_LOG("DockerdExit", TraceLoggingValue(dockerdExitCode, "code"));
551 }
552
553 if (m_containerdProcess.has_value())
554 {
557 - auto containerdExitCode = StopProcess(m_containerdProcess.value(), c_processTerminateTimeoutMs, c_processKillTimeoutMs);
555 + auto containerdExitCode =
556 + StopProcess(m_containerdProcess.value(), wsl::windows::wslc::ProcessTerminateTimeoutMs, wsl::windows::wslc::ProcessKillTimeoutMs);
557 WSL_LOG("ContainerdExit", TraceLoggingValue(containerdExitCode, "code"));
558 }
559
@@ -563,7 +562,7 @@ void WSLCSessionRuntime::TearDownVmLockHeld(bool CaptureTerminationReason)
562 {
563 try
564 {
566 - m_virtualMachine->Unmount(c_containerdStorage);
565 + m_virtualMachine->Unmount(wsl::windows::wslc::ContainerdStorageMountPoint);
566 }
567 CATCH_LOG();
568 }
src/windows/wslcsession/WSLCVirtualMachine.cpp
+1 -1
@@ -1434,7 +1434,7 @@ void WSLCVirtualMachine::CollectCrashDumps(wil::unique_socket&& listenSocket)
1434 {
1435 try
1436 {
1437 - auto socket = socket::CancellableAccept(listenSocket.get(), INFINITE, m_vmTerminatingEvent.get());
1437 + auto socket = wsl::windows::common::socket::CancellableAccept(listenSocket.get(), INFINITE, m_vmTerminatingEvent.get());
1438 if (!socket)
1439 {
1440 // VM is exiting.
src/windows/wsldevicehoststub/CMakeLists.txt
+4
@@ -23,3 +23,7 @@ target_compile_definitions(wsldevicehostproxystub PRIVATE
23 PROXY_CLSID_IS={0x6D32A4B7,0x9E1F,0x4C82,{0xA5,0x73,0xF8,0xB1,0xC4,0xD2,0x9E,0x60}})
24
25 set_target_properties(wsldevicehostproxystub PROPERTIES FOLDER windows)
26 +
27 +# MIDL generated proxy files each define their own MIDL_TYPE_FORMAT_STRING and
28 +# related symbols, so they can't share a translation unit.
29 +set_target_properties(wsldevicehostproxystub PROPERTIES UNITY_BUILD OFF)
src/windows/wslhost/CMakeLists.txt
+4 -1
@@ -12,7 +12,10 @@ add_dependencies(wslhost
12 target_link_libraries(wslhost
13 ${COMMON_LINK_LIBRARIES}
14 common
15 - runtimeobject.lib)
15 + runtimeobject.lib
16 + delayimp.lib)
17 +
18 +set_target_properties(wslhost PROPERTIES LINK_FLAGS "/DELAYLOAD:msi.dll /DELAYLOAD:WINTRUST.dll")
19
20 target_precompile_headers(wslhost REUSE_FROM common)
21 set_target_properties(wslhost PROPERTIES FOLDER windows)
\ No newline at end of file
src/windows/wslinstaller/stub/CMakeLists.txt
+4
@@ -14,3 +14,7 @@ add_library(wslinstallerproxystub SHARED ${SOURCES})
14 add_dependencies(wslinstallerproxystub wslinstalleridl)
15 target_link_libraries(wslinstallerproxystub ${COMMON_LINK_LIBRARIES})
16 set_target_properties(wslinstallerproxystub PROPERTIES FOLDER windows)
17 +
18 +# MIDL generated proxy files each define their own MIDL_TYPE_FORMAT_STRING and
19 +# related symbols, so they can't share a translation unit.
20 +set_target_properties(wslinstallerproxystub PROPERTIES UNITY_BUILD OFF)
src/windows/wslrelay/CMakeLists.txt
+4 -1
@@ -13,7 +13,10 @@ add_dependencies(wslrelay
13
14 target_link_libraries(wslrelay
15 ${COMMON_LINK_LIBRARIES}
16 - common)
16 + common
17 + delayimp.lib)
18 +
19 +set_target_properties(wslrelay PROPERTIES LINK_FLAGS "/DELAYLOAD:msi.dll /DELAYLOAD:WINTRUST.dll")
20
21 target_precompile_headers(wslrelay REUSE_FROM common)
22 set_target_properties(wslrelay PROPERTIES FOLDER windows)
\ No newline at end of file
test/windows/CMakeLists.txt
-7
@@ -25,13 +25,6 @@ add_compile_definitions(INLINE_TEST_METHOD_MARKUP)
25
26 add_library(wsltests SHARED ${SOURCES} ${HEADERS})
27
28 -if (DEFINED WSL_UNITY_BATCH_SIZE AND WSL_UNITY_BATCH_SIZE GREATER 0)
29 - set_target_properties(wsltests PROPERTIES
30 - UNITY_BUILD ON
31 - UNITY_BUILD_MODE BATCH
32 - UNITY_BUILD_BATCH_SIZE ${WSL_UNITY_BATCH_SIZE})
33 -endif ()
34 -
28 target_include_directories(wsltests PRIVATE
29 ${CMAKE_SOURCE_DIR}/src/windows/WslcSDK
30 ${CMAKE_BINARY_DIR}/src/windows/WslcSDK/winrt/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE})
test/windows/wslc/CMakeLists.txt
+4 -5
@@ -12,11 +12,10 @@ file(GLOB_RECURSE WSLC_TEST_HEADERS CONFIGURE_DEPENDS
12 # This ensures they're compiled into the main test binary.
13 target_sources(wsltests PRIVATE ${WSLC_TEST_SOURCES} ${WSLC_TEST_HEADERS})
14
15 -# Ensure the file uses the precompiled header from the parent target.
16 -set_source_files_properties(${WSLC_TEST_SOURCES}
17 - PROPERTIES
18 - COMPILE_FLAGS "/Yuprecomp.h"
19 -)
15 +# N.B. These sources are compiled into wsltests, which is defined in the parent
16 +# directory. Source file properties are scoped to the directory that sets them,
17 +# so they would be ignored here. The precompiled header comes from the target
18 +# instead, via target_precompile_headers(wsltests REUSE_FROM common).
19
20 # Add include directories needed for WSLC tests.
21 target_include_directories(wsltests PRIVATE
test/windows/wslc/ParserTestCases.h
+1
@@ -50,6 +50,7 @@ inline std::vector<wsl::windows::wslc::Argument> GetArgumentsForSet(ArgumentSet
50 {
51 using namespace wsl::windows::wslc;
52 using namespace wsl::windows::wslc::argument;
53 + using Argument = wsl::windows::wslc::Argument;
54
55 switch (argumentSet)
56 {
test/windows/wslc/WSLCCLIParserUnitTests.cpp
+2
@@ -33,6 +33,8 @@ using namespace WEX::TestExecution;
33
34 namespace WSLCCLIParserUnitTests {
35
36 +using Argument = wsl::windows::wslc::Argument;
37 +
38 class WSLCCLIParserUnitTests
39 {
40 WSLC_TEST_CLASS(WSLCCLIParserUnitTests)
test/windows/wslc/e2e/WSLCE2EHelpers.h
+2
@@ -23,6 +23,8 @@ Abstract:
23
24 namespace WSLCE2ETests {
25
26 +namespace string = wsl::shared::string;
27 +
28 // VT sequence constants and helpers for TTY testing.
29 // Sequences are sourced from wsl::windows::common::vt (VTSupport.h).
30 namespace VT {