Skip to content

Commit f8c8091

Browse files
committed
Revert "Merged PR 708176: Simplify command line config for redirecting user profiles"
This reverts commit 1cdac5d.
1 parent e05afe2 commit f8c8091

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

Public/Src/App/Bxl/Args.cs

+33
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ internal sealed class Args : IArgumentParser<ICommandLineConfiguration>, IDispos
4949
/// </summary>
5050
public const string LastBuiltCachedGraphName = "lastbuild";
5151

52+
private const string RedirectedUserProfileLocationInCloudBuild = @"d:\dbs";
53+
5254
private readonly IConsole m_console;
5355
private readonly bool m_shouldDisposeConsole;
5456

@@ -201,6 +203,7 @@ public bool TryParse(string[] args, PathTable pathTable, out ICommandLineConfigu
201203

202204
bool unsafeUnexpectedFileAccessesAreErrorsSet = false;
203205
bool failPipOnFileAccessErrorSet = false;
206+
bool? enableProfileRedirect = null;
204207
ContentHashingUtilities.SetDefaultHashType();
205208

206209
// Notes
@@ -925,6 +928,9 @@ public bool TryParse(string[] args, PathTable pathTable, out ICommandLineConfigu
925928
"qualifier",
926929
"q",
927930
opt => ParseStringOption(opt, startupConfiguration.QualifierIdentifiers)),
931+
OptionHandlerFactory.CreateBoolOption(
932+
"redirectUserProfile",
933+
opt => enableProfileRedirect = opt),
928934
OptionHandlerFactory.CreateOption(
929935
"redirectedUserProfileJunctionRoot",
930936
opt => layoutConfiguration.RedirectedUserProfileJunctionRoot = CommandLineUtilities.ParsePathOption(opt, pathTable)),
@@ -1560,12 +1566,39 @@ public bool TryParse(string[] args, PathTable pathTable, out ICommandLineConfigu
15601566
// Forcefully disable incremental scheduling in CB.
15611567
schedulingConfiguration.IncrementalScheduling = false;
15621568

1569+
// if not explicitly disabled, enable user profile redirect and force the location
1570+
if (!enableProfileRedirect.HasValue || enableProfileRedirect.Value)
1571+
{
1572+
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Create(pathTable, RedirectedUserProfileLocationInCloudBuild);
1573+
enableProfileRedirect = true;
1574+
}
1575+
15631576
if (!frontEndConfiguration.EnableCredScan.HasValue)
15641577
{
15651578
frontEndConfiguration.EnableCredScan = true;
15661579
}
15671580
}
15681581

1582+
if (!OperatingSystemHelper.IsUnixOS)
1583+
{
1584+
// if /enableProfileRedirect was set, RedirectedUserProfileJunctionRoot must have been set as well
1585+
// (either explicitly via /redirectedUserProfilePath argument or implicitly via /inCloudBuild flag)
1586+
if (enableProfileRedirect.HasValue && enableProfileRedirect.Value && !layoutConfiguration.RedirectedUserProfileJunctionRoot.IsValid)
1587+
{
1588+
throw CommandLineUtilities.Error(Strings.Args_ProfileRedirectEnabled_NoPathProvided);
1589+
}
1590+
1591+
if (!enableProfileRedirect.HasValue || enableProfileRedirect.HasValue && !enableProfileRedirect.Value)
1592+
{
1593+
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Invalid;
1594+
}
1595+
}
1596+
else
1597+
{
1598+
// profile redirection only happens on Windows
1599+
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Invalid;
1600+
}
1601+
15691602
if (OperatingSystemHelper.IsUnixOS)
15701603
{
15711604
// Non Windows OS doesn't support admin-required process external execution mode.

Public/Src/App/Bxl/HelpText.cs

-6
Original file line numberDiff line numberDiff line change
@@ -897,12 +897,6 @@ public static void DisplayHelp(HelpLevel helpLevel)
897897
HelpLevel.Verbose
898898
);
899899

900-
hw.WriteOption(
901-
"/redirectedUserProfileJunctionRoot:<path>",
902-
Strings.HelpText_DisplayHelp_RedirectedUserProfileJunctionRoot,
903-
HelpLevel.Verbose
904-
);
905-
906900
#endregion
907901

908902
hw.WriteBanner(

Public/Src/App/Bxl/Strings.resx

+3-3
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,9 @@ Example: ad2d42d2ec5d2ca0c0b7ad65402d07c7ef40b91e</value>
994994
<data name="HelpText_DisplayHelp_PosixDeleteMode" xml:space="preserve">
995995
<value>Controls the applicability of file/directory deletion using POSIX delete. Allowed values are NoRun, RunFirst, and RunLast. Defaults for Windows is RunLast, and for Unix is RunFirst</value>
996996
</data>
997+
<data name="Args_ProfileRedirectEnabled_NoPathProvided" xml:space="preserve">
998+
<value>User profile redirect was enabled (/enableProfileRedirect+) but the path to the redirected user profile was not set. Please use /RedirectedUserProfileJunctionRoot:&lt;path&gt; to set the path under which a junction to the real user profile will be created.</value>
999+
</data>
9971000
<data name="HelpText_DisplayHelp_RunInContainerAndAllowDoubleWrites" xml:space="preserve">
9981001
<value>Configures the default for all scheduled pips to run in a container with output isolation, allowing double writes to occur. Individual pips can override this setting. This is an unsafe option.</value>
9991002
</data>
@@ -1141,7 +1144,4 @@ Example: ad2d42d2ec5d2ca0c0b7ad65402d07c7ef40b91e</value>
11411144
<data name="HelpText_DisplayHelp_AlwaysRemoteInjectDetoursFrom32BitProcess" xml:space="preserve">
11421145
<value>Always use remote detours injection when launching processes from a 32-bit process. Defaults to true.</value>
11431146
</data>
1144-
<data name="HelpText_DisplayHelp_RedirectedUserProfileJunctionRoot" xml:space="preserve">
1145-
<value>When a path is set, the build engine will create a junction from a subdirectory of this path to the actual Windows user profile directory. Processes in the build will be routed to use this redirected user profile instead of the real one to help keep paths stable.</value>
1146-
</data>
11471147
</root>

Shared/Scripts/BuildDistributedTest.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ set SMDB.CACHE_TEMPLATE_PATH=%TEST_SOLUTION_ROOT%\Out\SharedCache
7575
set BuildXLExportFileDetails=1
7676
set BUILDXL_MASTER_ARGS=/maxProc:2 /replicateOutputsToWorkers %BUILDXL_MASTER_ARGS%
7777
set BUILDXL_WORKER_ARGS=/maxProc:6 %BUILDXL_WORKER_ARGS%
78-
set BUILDXL_COMMON_ARGS=/server- /inCloudBuild /remoteTelemetry- /enableAsyncLogging /historicMetadataCache "/storageRoot:{objectRoot}:\ " "/config:{sourceRoot}:\Config.dsc" "/cacheConfigFilePath:%SMDB.CACHE_CONFIG_OUTPUT_PATH%" "/rootMap:{sourceRoot}=%TEST_SOLUTION_ROOT%\TestSolution" "/rootMap:{objectRoot}=%TEST_SOLUTION_ROOT%\Out\M{machineNumber}" "/cacheDirectory:{objectRoot}:\Cache" "/p:TestCscToolPath=%ProgramFiles(x86)%\MSBuild\14.0\Bin" /p:BuildXLGrpcVerbosityEnabled=1 /parameter:BuildXLGrpcVerbosityLevel=1 /verifyCacheLookupPin /disableProcessRetryOnResourceExhaustion+
78+
set BUILDXL_COMMON_ARGS=/server- /inCloudBuild /remoteTelemetry- /redirectUserProfile- /enableAsyncLogging /historicMetadataCache "/storageRoot:{objectRoot}:\ " "/config:{sourceRoot}:\Config.dsc" "/cacheConfigFilePath:%SMDB.CACHE_CONFIG_OUTPUT_PATH%" "/rootMap:{sourceRoot}=%TEST_SOLUTION_ROOT%\TestSolution" "/rootMap:{objectRoot}=%TEST_SOLUTION_ROOT%\Out\M{machineNumber}" "/cacheDirectory:{objectRoot}:\Cache" "/p:TestCscToolPath=%ProgramFiles(x86)%\MSBuild\14.0\Bin" /p:BuildXLGrpcVerbosityEnabled=1 /parameter:BuildXLGrpcVerbosityLevel=1 /verifyCacheLookupPin /disableProcessRetryOnResourceExhaustion+
7979

8080
REM Add subst source/target to ensure real path to logs are printed on console
8181
set BUILDXL_COMMON_ARGS=%BUILDXL_COMMON_ARGS% /substTarget:{objectRoot}:\ /substSource:"%TEST_SOLUTION_ROOT%\Out\M{machineNumber}"

0 commit comments

Comments
 (0)