From 5d2cfeb8b3d21b6bd930fe3af8cb66efba485022 Mon Sep 17 00:00:00 2001 From: olkononenko <48926876+olkononenko@users.noreply.github.com> Date: Thu, 18 Jul 2019 01:06:46 -0700 Subject: [PATCH] DropDaemon refactoring (#528) AB#1552016 --- .../BuildLocalDev.cmd | 4 +- Public/Sdk/SelfHost/BuildXL/BuildXLSdk.dsc | 8 +- Public/Src/Tools/DropDaemon/Command.cs | 131 --- Public/Src/Tools/DropDaemon/Daemon.cs | 438 --------- Public/Src/Tools/DropDaemon/DropDaemon.cs | 914 ++++++++++++++++++ .../DropDaemon/DropItemForBuildXLFile.cs | 11 +- .../Src/Tools/DropDaemon/DropItemForFile.cs | 13 +- Public/Src/Tools/DropDaemon/IDropClient.cs | 20 +- Public/Src/Tools/DropDaemon/IDropItem.cs | 18 +- Public/Src/Tools/DropDaemon/Program.cs | 908 +---------------- .../Src/Tools/DropDaemon/Tool.DropDaemon.dsc | 1 + Public/Src/Tools/DropDaemon/VsoClient.cs | 5 +- .../BuildXLBasedCloudBuildLogger.cs | 2 +- Public/Src/Tools/ServicePipDaemon/Command.cs | 149 +++ .../DaemonConfig.cs | 8 +- .../DaemonException.cs} | 7 +- .../DisabledCloudBuildLogger.cs | 2 +- .../DropEtwListener.cs | 2 +- .../ICloudBuildLogger.cs | 2 +- .../Reloader.cs | 2 +- .../ReloadingDropServiceClient.cs | 4 +- .../ServicePipDaemon/ServicePipDaemon.cs | 502 ++++++++++ .../Statics.cs | 20 +- .../Tool.ServicePipDaemon.dsc | 49 + .../Tools/UnitTests/DropDaemon/CLITests.cs | 37 +- .../UnitTests/DropDaemon/ConcurrencyTest.cs | 12 +- .../DropDaemon/DropOperationTests.cs | 25 +- .../UnitTests/DropDaemon/ReloaderTests.cs | 2 +- .../ReloadingDropServiceClientTest.cs | 2 +- .../DropDaemon/Test.Tool.DropDaemon.dsc | 1 + Public/Src/Utilities/Ipc/Common/IpcResult.cs | 20 +- .../Utilities/Ipc/Interfaces/IIpcResult.cs | 6 + 32 files changed, 1762 insertions(+), 1563 deletions(-) delete mode 100644 Public/Src/Tools/DropDaemon/Command.cs delete mode 100644 Public/Src/Tools/DropDaemon/Daemon.cs create mode 100644 Public/Src/Tools/DropDaemon/DropDaemon.cs rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/BuildXLBasedCloudBuildLogger.cs (95%) create mode 100644 Public/Src/Tools/ServicePipDaemon/Command.cs rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/DaemonConfig.cs (93%) rename Public/Src/Tools/{DropDaemon/DropDaemonException.cs => ServicePipDaemon/DaemonException.cs} (62%) rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/DisabledCloudBuildLogger.cs (91%) rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/DropEtwListener.cs (95%) rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/ICloudBuildLogger.cs (94%) rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/Reloader.cs (96%) rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/ReloadingDropServiceClient.cs (96%) create mode 100644 Public/Src/Tools/ServicePipDaemon/ServicePipDaemon.cs rename Public/Src/Tools/{DropDaemon => ServicePipDaemon}/Statics.cs (62%) create mode 100644 Public/Src/Tools/ServicePipDaemon/Tool.ServicePipDaemon.dsc diff --git a/Private/DistributedIntegrationTest/BuildLocalDev.cmd b/Private/DistributedIntegrationTest/BuildLocalDev.cmd index 321391431..e73e8bd05 100644 --- a/Private/DistributedIntegrationTest/BuildLocalDev.cmd +++ b/Private/DistributedIntegrationTest/BuildLocalDev.cmd @@ -8,7 +8,7 @@ if NOT DEFINED ENLISTMENTROOT ( echo ======================================================= echo Building BuildXL echo ======================================================= -call %ENLISTMENTROOT%\bxl.cmd -deploy dev /server- /f:output='Out\Bin\debug\net472\*' +call %ENLISTMENTROOT%\bxl.cmd -deploydev /server- if %ERRORLEVEL% NEQ 0 ( echo. echo ERROR: BuildXL build failed. @@ -16,7 +16,7 @@ if %ERRORLEVEL% NEQ 0 ( endlocal && exit /b 1 ) -set BUILDXL_BIN_DIRECTORY=%ENLISTMENTROOT%\Out\Bin\Debug\net472 +set BUILDXL_BIN_DIRECTORY=%ENLISTMENTROOT%\Out\Bin\Debug\win-x64 if NOT DEFINED TF_ROLLING_DROPNAME ( set TF_ROLLING_DROPNAME=%USERNAME%-%random% diff --git a/Public/Sdk/SelfHost/BuildXL/BuildXLSdk.dsc b/Public/Sdk/SelfHost/BuildXL/BuildXLSdk.dsc index 61d2dccc4..c30107812 100644 --- a/Public/Sdk/SelfHost/BuildXL/BuildXLSdk.dsc +++ b/Public/Sdk/SelfHost/BuildXL/BuildXLSdk.dsc @@ -115,11 +115,17 @@ export const restrictTestRunToDebugNet461OnWindows = (qualifier.targetFramework !== "netcoreapp3.0" && qualifier.targetFramework !== "net472") || (Context.isWindowsOS() && qualifier.targetRuntime === "osx-x64"); +@@public +/*** +* Whether service pip daemon tooling is included with the BuildXL deployment +*/ +export const isDaemonToolingEnabled = Flags.isMicrosoftInternal && isFullFramework; + /*** * Whether drop tooling is included with the BuildXL deployment */ @@public -export const isDropToolingEnabled = Flags.isMicrosoftInternal && isFullFramework; +export const isDropToolingEnabled = isDaemonToolingEnabled && Flags.isMicrosoftInternal && isFullFramework; namespace Flags { export declare const qualifier: {}; diff --git a/Public/Src/Tools/DropDaemon/Command.cs b/Public/Src/Tools/DropDaemon/Command.cs deleted file mode 100644 index 57ce4a143..000000000 --- a/Public/Src/Tools/DropDaemon/Command.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Collections.Generic; -using System.Diagnostics.ContractsLight; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using BuildXL.Ipc.Common; -using BuildXL.Ipc.Interfaces; -using BuildXL.Utilities.CLI; - -namespace Tool.DropDaemon -{ - internal delegate int ClientAction(ConfiguredCommand conf, IClient rpc); - - internal delegate Task ServerAction(ConfiguredCommand conf, Daemon daemon); - - /// - /// A command has a name, description, a list of options it supports, and two actions: - /// one for executing this command on the client, and one for executing it on the server. - /// - /// When this program (DropDaemon.exe) is invoked, command line arguments are parsed to - /// determine the command specified by the user. That command is then interpreted by - /// executing its . Most of DropDaemon's commands will be - /// RPC calls, i.e., when a command is received via the command line, it is to be - /// marshaled and sent over to a running DropDaemon server via an RPC. In such a case, - /// the client action simply invokes . When an RPC is - /// received by a DropDaemon server (), a - /// is unmarshaled from the payload of the RPC operation and the - /// command is interpreted on the server by executing its . - /// - /// - /// Immutable. - /// - internal sealed class Command - { - /// A unique command name. - internal string Name { get; } - - /// Arbitrary description. - internal string Description { get; } - - /// Options that may/must be passed to this command. - internal IReadOnlyCollection