зеркало из https://github.com/microsoft/BuildXL.git
Merged PR 682668: Remove <= Win8 detection code
Including some checks in sandbox critical performance paths. Set Win10+ as the min bar in README.md.
This commit is contained in:
Родитель
c3d1fde8b2
Коммит
4277e213bc
|
@ -163,7 +163,7 @@ namespace BuildXL.Cache.Host.Service
|
|||
},
|
||||
caller: "ClearDeploymentDirectory").IgnoreFailure();
|
||||
|
||||
if (Settings.CreateJobObject && JobObject.OSSupportsNestedJobs)
|
||||
if (Settings.CreateJobObject)
|
||||
{
|
||||
JobObject.SetTerminateOnCloseOnCurrentProcessJob();
|
||||
}
|
||||
|
|
|
@ -2565,19 +2565,12 @@ namespace BuildXL.Engine
|
|||
}
|
||||
|
||||
if (Configuration.Schedule.LowPriority)
|
||||
{
|
||||
if (JobObject.OSSupportsNestedJobs)
|
||||
{
|
||||
if (!JobObject.SetLimitInformationOnCurrentProcessJob(priorityClass: ProcessPriorityClass.BelowNormal))
|
||||
{
|
||||
Logger.Log.AssignProcessToJobObjectFailed(loggingContext, NativeWin32Exception.GetFormattedMessageForNativeErrorCode(System.Runtime.InteropServices.Marshal.GetLastWin32Error()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log.CannotEnforceLowPriority(loggingContext);
|
||||
}
|
||||
}
|
||||
|
||||
var unsafeOptionLoggers = CreateUnsafeOptionLoggers();
|
||||
|
||||
|
|
|
@ -1284,15 +1284,6 @@ namespace BuildXL.Engine.Tracing
|
|||
Message = "AssignProcessToJobObject failed: Native Win32 Error: {0}")]
|
||||
public abstract void AssignProcessToJobObjectFailed(LoggingContext context, string nativeError);
|
||||
|
||||
[GeneratedEvent(
|
||||
(ushort)LogEventId.CannotHonorLowPriority,
|
||||
EventGenerators = EventGenerators.LocalOnly,
|
||||
EventLevel = Level.Warning,
|
||||
Keywords = (int)Keywords.UserMessage,
|
||||
EventTask = (int)Tasks.Engine,
|
||||
Message = "Unable to honor the /lowPriority option. This requires Win8/Server2012 or newer.")]
|
||||
public abstract void CannotEnforceLowPriority(LoggingContext context);
|
||||
|
||||
[GeneratedEvent(
|
||||
(ushort)LogEventId.ConfigUsingExperimentalOptions,
|
||||
EventGenerators = EventGenerators.LocalAndTelemetry,
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace BuildXL.Engine.Tracing
|
|||
PipWriterStats = 76,
|
||||
PipTableDeserializationContext = 84,
|
||||
EnvironmentValueForTempDisallowed = 94,
|
||||
CannotHonorLowPriority = 95,
|
||||
ErrorRelatedLocation = 110,
|
||||
BusyOrUnavailableOutputDirectoriesRetry = 214,
|
||||
FileAccessAllowlistCouldNotCreateIdentifier = 270,
|
||||
|
|
|
@ -533,8 +533,8 @@ namespace BuildXL.Processes.Internal
|
|||
hStdError = new SafeFileHandle(new IntPtr(-1), true);
|
||||
}
|
||||
|
||||
// We want a per-process job primarily. If nested job support is not available, then we make sure to not have a BuildXL-level job.
|
||||
if (JobObject.OSSupportsNestedJobs && m_createJobObjectForCurrentProcess)
|
||||
// Include the pip process in the job object for the build to ensure it is automatically closed.
|
||||
if (m_createJobObjectForCurrentProcess)
|
||||
{
|
||||
JobObject.SetTerminateOnCloseOnCurrentProcessJob();
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace Test.BuildXL.Processes
|
|||
[Fact]
|
||||
public async Task StartTimeout()
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ namespace Test.BuildXL.Processes
|
|||
[Fact]
|
||||
public async Task SuspensionExtendsTimeout()
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ namespace Test.BuildXL.Processes
|
|||
[Fact]
|
||||
public async Task SuspendResumeTimeout()
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ namespace Test.BuildXL.Processes
|
|||
[Fact(Skip = "Test is flakey TFS 495531")]
|
||||
public async Task JobCounters()
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ namespace Test.BuildXL.Processes
|
|||
[InlineData(true)]
|
||||
public async Task Survivors(bool includeAllowedSurvivingChildren)
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ namespace Test.BuildXL.Processes
|
|||
[MemberData(nameof(CmdExeLocationsData))]
|
||||
public async Task SurvivorsHaveCommandLines(string cmdExeLocation)
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ namespace Test.BuildXL.Processes
|
|||
[InlineData(false)]
|
||||
public async Task QuickSurvivors(bool waitToFinish)
|
||||
{
|
||||
if (!JobObject.OSSupportsNestedJobs)
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,10 +45,7 @@ namespace Tool.DistributedBuildRunner
|
|||
}
|
||||
|
||||
// Ensure that any launched processes will close when this process closes.
|
||||
if (JobObject.OSSupportsNestedJobs)
|
||||
{
|
||||
JobObject.SetTerminateOnCloseOnCurrentProcessJob();
|
||||
}
|
||||
|
||||
if (args.Length < 1 || args.Length > 2)
|
||||
{
|
||||
|
|
|
@ -195,17 +195,8 @@ namespace BuildXL.Native.IO.Windows
|
|||
public readonly FileId ExtendedFileId;
|
||||
|
||||
public FileIdDescriptor(FileId fileId)
|
||||
{
|
||||
if (IsExtendedFileIdSupported())
|
||||
{
|
||||
Type = FileIdDescriptorType.ExtendedFileId;
|
||||
}
|
||||
else
|
||||
{
|
||||
Contract.Assume(fileId.High == 0, "File ID should not have high bytes when extended IDs are not supported on the underlying OS");
|
||||
Type = FileIdDescriptorType.FileId;
|
||||
}
|
||||
|
||||
Size = s_size;
|
||||
ExtendedFileId = fileId;
|
||||
}
|
||||
|
@ -1028,27 +1019,10 @@ namespace BuildXL.Native.IO.Windows
|
|||
}
|
||||
|
||||
/// <nodoc />
|
||||
public static readonly Version MinWindowsVersionThatSupportsLongPaths = new Version(major: 6, minor: 2);
|
||||
|
||||
/// <nodoc />
|
||||
public static readonly Version MinWindowsVersionThatSupportsNestedJobs = new Version(major: 6, minor: 2);
|
||||
|
||||
/// <nodoc />
|
||||
public static readonly Version MinWindowsVersionThatSupportsWow64Processes = new Version(major: 5, minor: 1);
|
||||
|
||||
/// <nodoc />
|
||||
public static readonly int MaxDirectoryPathOld = 130;
|
||||
|
||||
/// <nodoc />
|
||||
public static readonly int MaxDirectoryPathNew = 260;
|
||||
public static readonly int MaxDirectoryPath = 260;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int MaxDirectoryPathLength()
|
||||
{
|
||||
return StaticIsOSVersionGreaterOrEqual(MinWindowsVersionThatSupportsLongPaths)
|
||||
? MaxDirectoryPathNew
|
||||
: MaxDirectoryPathOld;
|
||||
}
|
||||
public int MaxDirectoryPathLength() => MaxDirectoryPath;
|
||||
|
||||
private readonly Lazy<bool> m_supportUnprivilegedCreateSymbolicLinkFlag = default;
|
||||
|
||||
|
@ -1487,21 +1461,6 @@ namespace BuildXL.Native.IO.Windows
|
|||
return new Usn(writtenUsn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the running OS is at least Windows 8.0 / Server 2012
|
||||
/// (which is the first version to support nested jobs, hence <see cref="FileSystemWin.MinWindowsVersionThatSupportsNestedJobs"/>)
|
||||
/// </summary>
|
||||
private static readonly bool s_runningWindows8OrAbove = StaticIsOSVersionGreaterOrEqual(FileSystemWin.MinWindowsVersionThatSupportsNestedJobs);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the extended (128-bit) file ID type is supported on this running OS.
|
||||
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364227(v=vs.85).aspx
|
||||
/// </summary>
|
||||
private static bool IsExtendedFileIdSupported()
|
||||
{
|
||||
return s_runningWindows8OrAbove;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public unsafe FileIdAndVolumeId? TryGetFileIdAndVolumeIdByHandle(SafeFileHandle fileHandle)
|
||||
{
|
||||
|
|
|
@ -105,9 +105,6 @@ namespace BuildXL.Native.Processes
|
|||
/// <summary><see cref="ProcessUtilities.TerminateJobObject"/></summary>
|
||||
bool TerminateJobObject(IntPtr hJob, int exitCode);
|
||||
|
||||
/// <summary><see cref="ProcessUtilities.OSSupportsNestedJobs"/></summary>
|
||||
bool OSSupportsNestedJobs();
|
||||
|
||||
/// <summary><see cref="ProcessUtilities.AttachContainerToJobObject"/></summary>
|
||||
void AttachContainerToJobObject(
|
||||
IntPtr hJob,
|
||||
|
|
|
@ -43,12 +43,6 @@ namespace BuildXL.Processes
|
|||
/// </summary>
|
||||
public const int InitialProcessIdListLength = 2048; // the number needed to make the bufferSizeForProcessIdList 8KB.
|
||||
|
||||
/// <summary>
|
||||
/// Nested jobs are only supported on Win8/Server2012 or higher.
|
||||
/// http://msdn.microsoft.com/en-us/library/windows/desktop/hh448388(v=vs.85).aspx
|
||||
/// </summary>
|
||||
public static readonly bool OSSupportsNestedJobs = Native.Processes.ProcessUtilities.OSSupportsNestedJobs();
|
||||
|
||||
private static readonly object s_syncRoot = new object();
|
||||
private static readonly Lazy<CompletionPortDrainer> s_completionPortDrainer = Lazy.Create(() => new CompletionPortDrainer());
|
||||
private static bool s_terminateOnCloseOnCurrentProcessJob;
|
||||
|
@ -491,7 +485,10 @@ namespace BuildXL.Processes
|
|||
/// </summary>
|
||||
public static bool SetLimitInformationOnCurrentProcessJob(bool? terminateOnClose = null, ProcessPriorityClass? priorityClass = null)
|
||||
{
|
||||
Contract.Requires(OSSupportsNestedJobs);
|
||||
if (!OperatingSystemHelper.IsWindowsOS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
using (Process currentProcess = Process.GetCurrentProcess())
|
||||
|
@ -525,7 +522,6 @@ namespace BuildXL.Processes
|
|||
/// </remarks>
|
||||
public static void SetTerminateOnCloseOnCurrentProcessJob()
|
||||
{
|
||||
Contract.Requires(OSSupportsNestedJobs);
|
||||
if (!s_terminateOnCloseOnCurrentProcessJob)
|
||||
{
|
||||
lock (s_syncRoot)
|
||||
|
|
|
@ -273,12 +273,6 @@ namespace BuildXL.Native.Processes
|
|||
public static bool TerminateJobObject(IntPtr hJob, int exitCode)
|
||||
=> s_nativeMethods.TerminateJobObject(hJob, exitCode);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the operating system supports nested jobs.
|
||||
/// </summary>
|
||||
public static bool OSSupportsNestedJobs()
|
||||
=> s_nativeMethods.OSSupportsNestedJobs();
|
||||
|
||||
#region Helium containers
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -159,9 +159,6 @@ namespace BuildXL.Native.Processes.Unix
|
|||
public bool TerminateJobObject(IntPtr hJob, int exitCode)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool OSSupportsNestedJobs() => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AttachContainerToJobObject(
|
||||
IntPtr hJob,
|
||||
|
|
|
@ -97,15 +97,9 @@ namespace BuildXL.Native.Processes.Windows
|
|||
public bool IsWow64Process(SafeProcessHandle? process)
|
||||
{
|
||||
IntPtr handle = process == null ? GetCurrentProcess() : process.DangerousGetHandle();
|
||||
|
||||
if (IO.Windows.FileSystemWin.StaticIsOSVersionGreaterOrEqual(IO.Windows.FileSystemWin.MinWindowsVersionThatSupportsWow64Processes))
|
||||
{
|
||||
return ExternIsWow64Process(handle, out bool result) && result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool GetProcessTimes(IntPtr handle, out long creation, out long exit, out long kernel, out long user)
|
||||
=> Process.ExternGetProcessTimes(handle, out creation, out exit, out kernel, out user);
|
||||
|
@ -267,10 +261,6 @@ namespace BuildXL.Native.Processes.Windows
|
|||
public bool TerminateJobObject(IntPtr hJob, int exitCode)
|
||||
=> ExternTerminateJobObject(hJob, exitCode);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool OSSupportsNestedJobs()
|
||||
=> IO.Windows.FileSystemWin.StaticIsOSVersionGreaterOrEqual(IO.Windows.FileSystemWin.MinWindowsVersionThatSupportsNestedJobs);
|
||||
|
||||
internal static void Assert64Process()
|
||||
{
|
||||
Contract.Assert(IntPtr.Size == 8, "BuildXL is 64 bit process only.");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
## Introduction
|
||||
|
||||
BuildXL (Microsoft Build Accelerator), is a build engine originally developed for large internal teams at Microsoft. Internally at Microsoft, BuildXL runs 150,000+ builds per day on [monorepo](https://en.wikipedia.org/wiki/Monorepo) codebases up to a half-terabyte in size with a half-million process executions per build. It leverages distribution to thousands of data center machines and petabytes of source code, package, and build output caching. Thousands of developers use BuildXL on their desktops for faster builds.
|
||||
BuildXL (Microsoft Build Accelerator) is a build engine originally developed for large internal teams at Microsoft. Internally at Microsoft, BuildXL runs 150,000+ builds per day on [monorepo](https://en.wikipedia.org/wiki/Monorepo) codebases up to a half-terabyte in size with a half-million process executions per build. It leverages distribution to thousands of data center machines and petabytes of source code, package, and build output caching. Thousands of developers use BuildXL on their desktops for faster builds.
|
||||
|
||||
BuildXL accelerates multiple build languages, including:
|
||||
|
||||
|
@ -15,6 +15,10 @@ BuildXL accelerates multiple build languages, including:
|
|||
|
||||
BuildXL has a command-line interface. There are currently no plans to integrate it into Visual Studio. The project is open source in the spirit of transparency of our engineering system. You may find our technology useful if you face similar issues of scale. Note that BuildXL is not intended as a replacement for MSBuild or to indicate any future direction of build languages from Microsoft.
|
||||
|
||||
OS compatibility:
|
||||
* Windows 10+
|
||||
* Linux
|
||||
|
||||
## Examples
|
||||
See the `Examples/` folder for basic project examples.
|
||||
|
||||
|
@ -23,4 +27,3 @@ The BuildXL documentation landing page is [here](Documentation/INDEX.md) and loo
|
|||
|
||||
## Build Status - Azure DevOps Pipelines
|
||||
[![Build status](https://dev.azure.com/mseng/Domino/_apis/build/status/8196?branchName=master)](https://dev.azure.com/mseng/Domino/_build/latest?definitionId=8196)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче