Skip to content

Commit 3c910ba

Browse files
Revert 'Add "cache add" functionality to project caching' (#9188)
* Revert "Ship BuildXL assemblies in our VSIX and not our NuGet packages (#9185)" This reverts commit 0974273. * Revert "Merge pull request #8726 from dfederm/project-cache-vnext" This reverts commit 462a917, reversing changes made to 5958b59.
1 parent 763286d commit 3c910ba

File tree

77 files changed

+54
-2636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+54
-2636
lines changed

NuGet.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
99
<add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json" />
1010
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
11-
<add key="BuildXL" value="https://pkgs.dev.azure.com/ms/BuildXL/_packaging/BuildXL/nuget/v3/index.json" />
1211
</packageSources>
1312
<disabledPackageSources />
1413
</configuration>

eng/Signing.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<Project>
22
<ItemGroup>
33
<ItemsToSign Include="$(VisualStudioSetupInsertionPath)Microsoft.Build.UnGAC.exe" />
4-
5-
<FileSignInfo Include="RuntimeContracts.dll" CertificateName="3PartySHA2" />
64
</ItemGroup>
7-
5+
86
<PropertyGroup>
97
<UseDotNetCertificate>true</UseDotNetCertificate>
108
</PropertyGroup>
11-
</Project>
9+
</Project>

eng/dependabot/Packages.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<PackageVersion Include="LargeAddressAware" Version="1.0.5" />
2020
<PackageVersion Update="LargeAddressAware" Condition="'$(LargeAddressAwareVersion)' != ''" Version="$(LargeAddressAwareVersion)" />
2121

22-
<PackageVersion Include="Microsoft.BuildXL.Processes" Version="0.1.0-20230727.4.2" />
23-
<PackageVersion Update="Microsoft.BuildXL.Processes" Condition="'$(BuildXLProcessesVersion)' != ''" Version="$(BuildXLProcessesVersion)" />
24-
2522
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.2.2146" PrivateAssets="All" />
2623
<PackageVersion Update="Microsoft.VisualStudio.Setup.Configuration.Interop" Condition="'$(MicrosoftVisualStudioSetupConfigurationInteropVersion)' != ''" Version="$(MicrosoftVisualStudioSetupConfigurationInteropVersion)" PrivateAssets="All" />
2724

src/Build.UnitTests/BackEnd/TaskHostTaskComplete_Tests.cs

Lines changed: 13 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using Microsoft.Build.BackEnd;
77
using Microsoft.Build.Framework;
8-
using Microsoft.Build.Framework.FileAccess;
98
using Microsoft.Build.Shared;
109
using Microsoft.Build.Utilities;
1110
using Xunit;
@@ -26,67 +25,21 @@ public class TaskHostTaskComplete_Tests
2625
[Fact]
2726
public void TestConstructors()
2827
{
29-
#if FEATURE_REPORTFILEACCESSES
30-
var fileAccessData = new List<FileAccessData>()
31-
{
32-
new FileAccessData(
33-
ReportedFileOperation.CreateFile,
34-
RequestedAccess.Read,
35-
0,
36-
0,
37-
DesiredAccess.GENERIC_READ,
38-
FlagsAndAttributes.FILE_ATTRIBUTE_NORMAL,
39-
"foo",
40-
null,
41-
true),
42-
};
43-
#endif
44-
45-
_ = new TaskHostTaskComplete(
46-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success),
47-
#if FEATURE_REPORTFILEACCESSES
48-
fileAccessData,
49-
#endif
50-
null);
51-
_ = new TaskHostTaskComplete(
52-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Failure),
53-
#if FEATURE_REPORTFILEACCESSES
54-
fileAccessData,
55-
#endif
56-
null);
57-
_ = new TaskHostTaskComplete(
58-
new OutOfProcTaskHostTaskResult(TaskCompleteType.CrashedDuringInitialization,
59-
new ArgumentOutOfRangeException()),
60-
#if FEATURE_REPORTFILEACCESSES
61-
fileAccessData,
62-
#endif
63-
null);
64-
_ = new TaskHostTaskComplete(
65-
new OutOfProcTaskHostTaskResult(TaskCompleteType.CrashedDuringExecution, new ArgumentNullException()),
66-
#if FEATURE_REPORTFILEACCESSES
67-
fileAccessData,
68-
#endif
69-
null);
28+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success), null);
29+
TaskHostTaskComplete complete2 = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Failure), null);
30+
TaskHostTaskComplete complete3 = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.CrashedDuringInitialization, new ArgumentOutOfRangeException()), null);
31+
TaskHostTaskComplete complete4 = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.CrashedDuringExecution, new ArgumentNullException()), null);
7032

7133
IDictionary<string, object> parameters = new Dictionary<string, object>();
72-
_ = new TaskHostTaskComplete(
73-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters),
74-
#if FEATURE_REPORTFILEACCESSES
75-
null,
76-
#endif
77-
null);
34+
TaskHostTaskComplete complete5 = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters), null);
7835

7936
IDictionary<string, object> parameters2 = new Dictionary<string, object>();
8037
parameters2.Add("Text", "Hello!");
8138
parameters2.Add("MyBoolValue", true);
8239
parameters2.Add("MyITaskItem", new TaskItem("ABC"));
8340
parameters2.Add("ItemArray", new ITaskItem[] { new TaskItem("DEF"), new TaskItem("GHI"), new TaskItem("JKL") });
84-
_ = new TaskHostTaskComplete(
85-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters2),
86-
#if FEATURE_REPORTFILEACCESSES
87-
null,
88-
#endif
89-
null);
41+
42+
TaskHostTaskComplete complete6 = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters2), null);
9043
}
9144

9245
/// <summary>
@@ -107,12 +60,7 @@ public void TestInvalidConstructors()
10760
[Fact]
10861
public void TestTranslationWithNullDictionary()
10962
{
110-
TaskHostTaskComplete complete = new(
111-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success),
112-
#if FEATURE_REPORTFILEACCESSES
113-
null,
114-
#endif
115-
null);
63+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success), null);
11664

11765
((ITranslatable)complete).Translate(TranslationHelpers.GetWriteTranslator());
11866
INodePacket packet = TaskHostTaskComplete.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
@@ -130,12 +78,7 @@ public void TestTranslationWithNullDictionary()
13078
[Fact]
13179
public void TestTranslationWithEmptyDictionary()
13280
{
133-
TaskHostTaskComplete complete = new(
134-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, new Dictionary<string, object>()),
135-
#if FEATURE_REPORTFILEACCESSES
136-
null,
137-
#endif
138-
null);
81+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, new Dictionary<string, object>()), null);
13982

14083
((ITranslatable)complete).Translate(TranslationHelpers.GetWriteTranslator());
14184
INodePacket packet = TaskHostTaskComplete.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
@@ -156,12 +99,7 @@ public void TestTranslationWithValueTypesInDictionary()
15699
IDictionary<string, object> parameters = new Dictionary<string, object>();
157100
parameters.Add("Text", "Foo");
158101
parameters.Add("BoolValue", false);
159-
TaskHostTaskComplete complete = new(
160-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters),
161-
#if FEATURE_REPORTFILEACCESSES
162-
null,
163-
#endif
164-
null);
102+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters), null);
165103

166104
((ITranslatable)complete).Translate(TranslationHelpers.GetWriteTranslator());
167105
INodePacket packet = TaskHostTaskComplete.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
@@ -183,12 +121,7 @@ public void TestTranslationWithITaskItemInDictionary()
183121
{
184122
IDictionary<string, object> parameters = new Dictionary<string, object>();
185123
parameters.Add("TaskItemValue", new TaskItem("Foo"));
186-
TaskHostTaskComplete complete = new(
187-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters),
188-
#if FEATURE_REPORTFILEACCESSES
189-
null,
190-
#endif
191-
null);
124+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters), null);
192125

193126
((ITranslatable)complete).Translate(TranslationHelpers.GetWriteTranslator());
194127
INodePacket packet = TaskHostTaskComplete.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
@@ -209,12 +142,7 @@ public void TestTranslationWithITaskItemArrayInDictionary()
209142
{
210143
IDictionary<string, object> parameters = new Dictionary<string, object>();
211144
parameters.Add("TaskItemArrayValue", new ITaskItem[] { new TaskItem("Foo"), new TaskItem("Baz") });
212-
TaskHostTaskComplete complete = new(
213-
new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters),
214-
#if FEATURE_REPORTFILEACCESSES
215-
null,
216-
#endif
217-
null);
145+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(TaskCompleteType.Success, parameters), null);
218146

219147
((ITranslatable)complete).Translate(TranslationHelpers.GetWriteTranslator());
220148
INodePacket packet = TaskHostTaskComplete.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
@@ -240,12 +168,7 @@ private void AssertInvalidConstructorThrows(Type expectedExceptionType, TaskComp
240168

241169
try
242170
{
243-
TaskHostTaskComplete complete = new(
244-
new OutOfProcTaskHostTaskResult(taskResult, taskOutputParameters, taskException, taskExceptionMessage, taskExceptionMessageArgs),
245-
#if FEATURE_REPORTFILEACCESSES
246-
null,
247-
#endif
248-
buildProcessEnvironment);
171+
TaskHostTaskComplete complete = new TaskHostTaskComplete(new OutOfProcTaskHostTaskResult(taskResult, taskOutputParameters, taskException, taskExceptionMessage, taskExceptionMessageArgs), buildProcessEnvironment);
249172
}
250173
catch (Exception e)
251174
{

src/Build/BackEnd/BuildManager/BuildManager.cs

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
using Microsoft.Build.Exceptions;
2626
using Microsoft.Build.Experimental;
2727
using Microsoft.Build.Experimental.ProjectCache;
28-
using Microsoft.Build.FileAccesses;
2928
using Microsoft.Build.Framework;
3029
using Microsoft.Build.Framework.Telemetry;
3130
using Microsoft.Build.Graph;
@@ -559,19 +558,6 @@ public void BeginBuild(BuildParameters parameters)
559558
_buildParameters.OutputResultsCacheFile = FileUtilities.NormalizePath("msbuild-cache");
560559
}
561560

562-
#if FEATURE_REPORTFILEACCESSES
563-
if (_buildParameters.ReportFileAccesses)
564-
{
565-
// To properly report file access, we need to disable the in-proc node which won't be detoured.
566-
_buildParameters.DisableInProcNode = true;
567-
568-
// Node reuse must be disabled as future builds will not be able to listen to events raised by detours.
569-
_buildParameters.EnableNodeReuse = false;
570-
571-
_componentFactories.ReplaceFactory(BuildComponentType.NodeLauncher, DetouredNodeLauncher.CreateComponent);
572-
}
573-
#endif
574-
575561
// Initialize components.
576562
_nodeManager = ((IBuildComponentHost)this).GetComponent(BuildComponentType.NodeManager) as INodeManager;
577563

@@ -586,17 +572,9 @@ public void BeginBuild(BuildParameters parameters)
586572

587573
InitializeCaches();
588574

589-
#if FEATURE_REPORTFILEACCESSES
590-
var fileAccessManager = ((IBuildComponentHost)this).GetComponent(BuildComponentType.FileAccessManager) as IFileAccessManager;
591-
#endif
592-
593575
_projectCacheService = new ProjectCacheService(
594576
this,
595577
loggingService,
596-
#if FEATURE_REPORTFILEACCESSES
597-
fileAccessManager,
598-
#endif
599-
_configCache,
600578
_buildParameters.ProjectCacheDescriptor);
601579

602580
_taskHostNodeManager = ((IBuildComponentHost)this).GetComponent(BuildComponentType.TaskHostNodeManager) as INodeManager;
@@ -606,9 +584,7 @@ public void BeginBuild(BuildParameters parameters)
606584
_nodeManager.RegisterPacketHandler(NodePacketType.BuildRequestConfiguration, BuildRequestConfiguration.FactoryForDeserialization, this);
607585
_nodeManager.RegisterPacketHandler(NodePacketType.BuildRequestConfigurationResponse, BuildRequestConfigurationResponse.FactoryForDeserialization, this);
608586
_nodeManager.RegisterPacketHandler(NodePacketType.BuildResult, BuildResult.FactoryForDeserialization, this);
609-
_nodeManager.RegisterPacketHandler(NodePacketType.FileAccessReport, FileAccessReport.FactoryForDeserialization, this);
610587
_nodeManager.RegisterPacketHandler(NodePacketType.NodeShutdown, NodeShutdown.FactoryForDeserialization, this);
611-
_nodeManager.RegisterPacketHandler(NodePacketType.ProcessReport, ProcessReport.FactoryForDeserialization, this);
612588
_nodeManager.RegisterPacketHandler(NodePacketType.ResolveSdkRequest, SdkResolverRequest.FactoryForDeserialization, SdkResolverService as INodePacketHandler);
613589
_nodeManager.RegisterPacketHandler(NodePacketType.ResourceRequest, ResourceRequest.FactoryForDeserialization, this);
614590

@@ -1588,16 +1564,6 @@ private void ProcessPacket(int node, INodePacket packet)
15881564
HandleNodeShutdown(node, shutdownPacket);
15891565
break;
15901566

1591-
case NodePacketType.FileAccessReport:
1592-
FileAccessReport fileAccessReport = ExpectPacketType<FileAccessReport>(packet, NodePacketType.FileAccessReport);
1593-
HandleFileAccessReport(node, fileAccessReport);
1594-
break;
1595-
1596-
case NodePacketType.ProcessReport:
1597-
ProcessReport processReport = ExpectPacketType<ProcessReport>(packet, NodePacketType.ProcessReport);
1598-
HandleProcessReport(node, processReport);
1599-
break;
1600-
16011567
default:
16021568
ErrorUtilities.ThrowInternalError("Unexpected packet received by BuildManager: {0}", packet.Type);
16031569
break;
@@ -2405,39 +2371,6 @@ private void HandleResult(int node, BuildResult result)
24052371
configuration.ProjectTargets ??= result.ProjectTargets;
24062372
}
24072373

2408-
// Only report results to the project cache services if it's the result for a build submission.
2409-
// Note that graph builds create a submission for each node in the graph, so each node in the graph will be
2410-
// handled here. This intentionally mirrors the behavior for cache requests, as it doesn't make sense to
2411-
// report for projects which aren't going to be requested. Ideally, *any* request could be handled, but that
2412-
// would require moving the cache service interactions to the Scheduler.
2413-
if (_buildSubmissions.TryGetValue(result.SubmissionId, out BuildSubmission buildSubmission))
2414-
{
2415-
// The result may be associated with the build submission due to it being the submission which
2416-
// caused the build, but not the actual request which was originally used with the build submission.
2417-
// ie. it may be a dependency of the "root-level" project which is associated with this submission, which
2418-
// isn't what we're looking for. Ensure only the actual submission's request is considered.
2419-
if (buildSubmission.BuildRequest != null
2420-
&& buildSubmission.BuildRequest.ConfigurationId == configuration.ConfigurationId
2421-
&& _projectCacheService.ShouldUseCache(configuration))
2422-
{
2423-
BuildEventContext buildEventContext = _projectStartedEvents.TryGetValue(result.SubmissionId, out BuildEventArgs buildEventArgs)
2424-
? buildEventArgs.BuildEventContext
2425-
: new BuildEventContext(result.SubmissionId, node, configuration.Project?.EvaluationId ?? BuildEventContext.InvalidEvaluationId, configuration.ConfigurationId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidTaskId);
2426-
try
2427-
{
2428-
_projectCacheService.HandleBuildResultAsync(configuration, result, buildEventContext, _executionCancellationTokenSource.Token).Wait();
2429-
}
2430-
catch (AggregateException ex) when (ex.InnerExceptions.All(inner => inner is OperationCanceledException))
2431-
{
2432-
// The build is being cancelled. Swallow any exceptions related specifically to cancellation.
2433-
}
2434-
catch (OperationCanceledException)
2435-
{
2436-
// The build is being cancelled. Swallow any exceptions related specifically to cancellation.
2437-
}
2438-
}
2439-
}
2440-
24412374
IEnumerable<ScheduleResponse> response = _scheduler.ReportResult(node, result);
24422375
PerformSchedulingActions(response);
24432376
}
@@ -2504,36 +2437,6 @@ private void HandleNodeShutdown(int node, NodeShutdown shutdownPacket)
25042437
CheckForActiveNodesAndCleanUpSubmissions();
25052438
}
25062439

2507-
/// <summary>
2508-
/// Report the received <paramref name="fileAccessReport"/> to the file access manager.
2509-
/// </summary>
2510-
/// <param name="nodeId">The id of the node from which the <paramref name="fileAccessReport"/> was received.</param>
2511-
/// <param name="fileAccessReport">The file access report.</param>
2512-
private void HandleFileAccessReport(int nodeId, FileAccessReport fileAccessReport)
2513-
{
2514-
#if FEATURE_REPORTFILEACCESSES
2515-
if (_buildParameters.ReportFileAccesses)
2516-
{
2517-
((FileAccessManager)((IBuildComponentHost)this).GetComponent(BuildComponentType.FileAccessManager)).ReportFileAccess(fileAccessReport.FileAccessData, nodeId);
2518-
}
2519-
#endif
2520-
}
2521-
2522-
/// <summary>
2523-
/// Report the received <paramref name="processReport"/> to the file access manager.
2524-
/// </summary>
2525-
/// <param name="nodeId">The id of the node from which the <paramref name="processReport"/> was received.</param>
2526-
/// <param name="processReport">The process data report.</param>
2527-
private void HandleProcessReport(int nodeId, ProcessReport processReport)
2528-
{
2529-
#if FEATURE_REPORTFILEACCESSES
2530-
if (_buildParameters.ReportFileAccesses)
2531-
{
2532-
((FileAccessManager)((IBuildComponentHost)this).GetComponent(BuildComponentType.FileAccessManager)).ReportProcess(processReport.ProcessData, nodeId);
2533-
}
2534-
#endif
2535-
}
2536-
25372440
/// <summary>
25382441
/// If there are no more active nodes, cleans up any remaining submissions.
25392442
/// </summary>

0 commit comments

Comments
 (0)