Skip to content

Commit ccab904

Browse files
Merge branch 'main' into update-project-reference-docs
2 parents 9b7cc99 + dba9b23 commit ccab904

22 files changed

+300
-94
lines changed

.github/ISSUE_TEMPLATE/03_mybuildisbroken.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ labels: needs-triage
1010

1111
<!--
1212
* Here are some useful links to help you figure out what's wrong.
13-
* Our wiki: https://github.com/microsoft/msbuild/blob/master/documentation/wiki/Home.md
14-
* General Help: https://github.com/microsoft/msbuild/blob/master/documentation/wiki/Something's-wrong-in-my-build.md
15-
* Tips & Tricks: https://github.com/microsoft/msbuild/blob/master/documentation/wiki/MSBuild-Tips-%26-Tricks.md
13+
* Our documentation: https://github.com/dotnet/msbuild/blob/main/documentation/README.md
14+
* General Help: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Something's-wrong-in-my-build.md
15+
* Tips & Tricks: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/MSBuild-Tips-%26-Tricks.md
1616
-->
1717

1818
### Issue Description
@@ -50,4 +50,4 @@ If you want to share one just with Microsoft, you can [report a problem through
5050
<!--
5151
* We ask that you first browse the above links, as your question may already have been answered.
5252
* Be as detailed as you can with these questions.
53-
-->
53+
-->

documentation/specs/project-cache.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Summary
22

3-
Project cache is a new assembly-based plugin extension point in MSBuild which determines whether a build request (a project) can be skipped during build. The main expected benefit is reduced build times via [caching and/or distribution](https://github.com/dotnet/msbuild/blob/master/documentation/specs/static-graph.md#weakness-of-the-old-model-caching-and-distributability).
3+
Project cache is a new assembly-based plugin extension point in MSBuild which determines whether a build request (a project) can be skipped during build. The main expected benefit is reduced build times via [caching and/or distribution](https://github.com/dotnet/msbuild/blob/main/documentation/specs/static-graph.md#weakness-of-the-old-model-caching-and-distributability).
44

55
# Motivation
66

7-
As the introduction to [static graph](https://github.com/dotnet/msbuild/blob/master/documentation/specs/static-graph.md#what-is-static-graph-for) suggests, large and complex repos expose the weaknesses in MSBuild's scheduling and incrementality models as build times elongate. This project cache plugin lets MSBuild natively communicate with existing tools that enable build caching and/or distribution, enabling true scalability.
7+
As the introduction to [static graph](https://github.com/dotnet/msbuild/blob/main/documentation/specs/static-graph.md#what-is-static-graph-for) suggests, large and complex repos expose the weaknesses in MSBuild's scheduling and incrementality models as build times elongate. This project cache plugin lets MSBuild natively communicate with existing tools that enable build caching and/or distribution, enabling true scalability.
88

99
Visual Studio is one beneficiary. This plugin inverts dependencies among build systems: instead of higher level build engines ([Cloudbuild](https://www.microsoft.com/research/publication/cloudbuild-microsofts-distributed-and-caching-build-service/), [Anybuild](https://github.com/AnyBuild/AnyBuild), [BuildXL](https://github.com/microsoft/BuildXL), etc) calling into MSBuild, MSBuild calls into them, keeping MSBuild's external APIs and command line arguments largely unchanged and thus reusable by Visual Studio.
1010

@@ -78,7 +78,7 @@ This change also simplifies and unifies user experiences. MSBuild works the same
7878
- On cache hits, MSBuild skips the project, but needs a BuildResult with target results to send back to the [Scheduler](https://github.com/dotnet/msbuild/blob/d39f2e4f5f3d461bc456f9abed9adec4a2f0f542/src/Build/BackEnd/Components/Scheduler/Scheduler.cs#L25).
7979
- Plugins have three options:
8080
- Worst: plugins fake the build results for each target. We consider this brittle since the plugins will have to be updated whenever the build logic changes.
81-
- Better: plugins tell MSBuild to run a proxy target as a replacement for the expensive target (e.g. it tells MSBuild to run `GetTargetPath` and use those results for the Build target). See the [ProjectReference protocol](https://github.com/dotnet/msbuild/blob/master/documentation/ProjectReference-Protocol.md) for more details.
81+
- Better: plugins tell MSBuild to run a proxy target as a replacement for the expensive target (e.g. it tells MSBuild to run `GetTargetPath` and use those results for the Build target). See the [ProjectReference protocol](https://github.com/dotnet/msbuild/blob/main/documentation/ProjectReference-Protocol.md) for more details.
8282
- Proxy target assumptions:
8383
- They are very fast and only retrieve items and properties from the evaluated state (like `GetTargetPath`).
8484
- They do not mutate state (file system, environment variables, etc).
@@ -105,7 +105,7 @@ This change also simplifies and unifies user experiences. MSBuild works the same
105105
- Absolute paths will likely break the build, since they'd be captured on the machine that writes to the cache.
106106
- Slow connections. In a coffee shop it might be faster to build everything instead of downloading from the cache. Consider racing plugin checks and building: if the bottom up build traversal reaches a node that's still querying the cache, cancel the cache query and build the node instead.
107107
- Inferring what targets to run on each node when using /graph
108-
- Msbuild /graph requires that the [target inference protocol](https://github.com/dotnet/msbuild/blob/master/documentation/specs/static-graph.md#inferring-which-targets-to-run-for-a-project-within-the-graph) is good enough.
108+
- Msbuild /graph requires that the [target inference protocol](https://github.com/dotnet/msbuild/blob/main/documentation/specs/static-graph.md#inferring-which-targets-to-run-for-a-project-within-the-graph) is good enough.
109109
- Small repos will probably be slower with plugin implementations that access the network. Remote distribution and caching will only be worth it for repos that are large enough.
110110

111111
# Future work

documentation/specs/single-project-isolated-builds.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The presence of either input or output caches turns on [isolated build constrain
1111

1212
## Input / Output Cache Implementation
1313
<!-- cache structure -->
14-
The cache files contain the serialized state of MSBuild's [`ConfigCache`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ConfigCache.cs) and [`ResultsCache`](https://github.com/dotnet/msbuild/blob/master/src/Build/BackEnd/Components/Caching/ResultsCache.cs), which have been traditionally used by the engine to cache build results. They ensure that a target is only built once per build submission. `ConfigCache` entries are instances of [`BuildRequestConfiguration`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs#L25)s (a `(project path, global properties)` tuple), and `ResultsCache` entries are instances of [`BuildResult`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/BuildResult.cs#L34)s, which contain [`TargetResult`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/TargetResult.cs#L22)s. The `ConfigCache` entries and `ResultsCache` entries form a [bijection](https://en.wikipedia.org/wiki/Bijection).
14+
The cache files contain the serialized state of MSBuild's [`ConfigCache`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ConfigCache.cs) and [`ResultsCache`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ResultsCache.cs), which have been traditionally used by the engine to cache build results. They ensure that a target is only built once per build submission. `ConfigCache` entries are instances of [`BuildRequestConfiguration`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs#L25)s (a `(project path, global properties)` tuple), and `ResultsCache` entries are instances of [`BuildResult`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/BuildResult.cs#L34)s, which contain [`TargetResult`](https://github.com/dotnet/msbuild/blob/37c5a9fec416b403212a63f95f15b03dbd5e8b5d/src/Build/BackEnd/Shared/TargetResult.cs#L22)s. The `ConfigCache` entries and `ResultsCache` entries form a [bijection](https://en.wikipedia.org/wiki/Bijection).
1515

1616
<!-- cache lifetime -->
1717
In a build, the input and output cache files have the same lifetime as the `ConfigCache` and `ResultsCache`. The `ConfigCache` and `ResultsCache` are owned by the [`BuildManager`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/BuildManager/BuildManager.cs), and their lifetimes are one `BuildManager.BeginBuild` / `BuildManager.EndBuild` session. On command-line builds, the cache lifetime is the same as the entire process lifetime since `MSBuild.exe` uses one `BuildManager` with one `BeginBuild` / `EndBuild` session. When other processes (e.g. Visual Studio's `devenv.exe`) perform MSBuild builds via the `BuildManager` APIs, there can be multiple build sessions in the same process.
@@ -27,7 +27,7 @@ When loading input cache files, MSBuild merges incoming instances of `ConfigCach
2727
Note that the output cache file contains a single `BuildResult` with the `TargetResult`s from the project specified to be built in the `BeginBuild` / `EndBuild` session, as any `BuildResult`s obtained through isolation exemption are excluded to prevent potential duplicate input cache entries; Entries from input caches are not transferred to the output cache.
2828

2929
<!-- How input / output cache entries are separated with the override caches -->
30-
Input cache entries are separated from output cache entries with the composite caches [`ConfigCacheWithOverride`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ConfigCacheWithOverride.cs) and [`ResultsCacheWithOverride`](https://github.com/dotnet/msbuild/blob/master/src/Build/BackEnd/Components/Caching/ResultsCacheWithOverride.cs). Each composite cache contains two underlying caches: a cache where input caches files are loaded into (the override cache), and a cache where new results are written into (the current cache).* In the `ConfigCacheWithOverride`, these caches are instances of `ConfigCache`s and, in the `ResultsCacheWithOverride`, these caches are instances of `ResultsCache`s. A query for a cache entry is first attempted from the override cache and, if unsatisfied, a second attempt is made from the current cache. Writes are only written to the current cache, never into the override cache.* It is illegal for both the current cache and override cache to contain entries for the same project configuration, a constraint that is checked by the two override caches on each cache query.
30+
Input cache entries are separated from output cache entries with the composite caches [`ConfigCacheWithOverride`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ConfigCacheWithOverride.cs) and [`ResultsCacheWithOverride`](https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/Caching/ResultsCacheWithOverride.cs). Each composite cache contains two underlying caches: a cache where input caches files are loaded into (the override cache), and a cache where new results are written into (the current cache).* In the `ConfigCacheWithOverride`, these caches are instances of `ConfigCache`s and, in the `ResultsCacheWithOverride`, these caches are instances of `ResultsCache`s. A query for a cache entry is first attempted from the override cache and, if unsatisfied, a second attempt is made from the current cache. Writes are only written to the current cache, never into the override cache.* It is illegal for both the current cache and override cache to contain entries for the same project configuration, a constraint that is checked by the two override caches on each cache query.
3131

3232
## Isolation Implementation
3333

documentation/specs/task-isolation-and-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ We also want to load groups of tasks which belong together into the same ALC (fo
2323

2424
# Task dependency resolution
2525
## Problem definition
26-
Tasks with complex and specifically platform specific dependencies don't work out of the box. For example if a task uses [`LibGit2Sharp`](https://www.nuget.org/packages/LibGit2Sharp) package it will not work as is. `LibGit2Sharp` has native dependencies which are platform specific. While the package carries all of them, there's no built in support for the task to load the right ones. For example [source link](https://github.com/dotnet/sourcelink/blob/master/src/Microsoft.Build.Tasks.Git/GitLoaderContext.cs) runs into this problem.
26+
Tasks with complex and specifically platform specific dependencies don't work out of the box. For example if a task uses [`LibGit2Sharp`](https://www.nuget.org/packages/LibGit2Sharp) package it will not work as is. `LibGit2Sharp` has native dependencies which are platform specific. While the package carries all of them, there's no built in support for the task to load the right ones. For example [source link](https://github.com/dotnet/sourcelink/blob/29b3197e824c05d03427c05d56700e4c704233e4/src/Microsoft.Build.Tasks.Git/GitLoaderContext.cs) runs into this problem.
2727

2828
## Solution
2929
.NET Core uses `.deps.json` files to describe dependencies of components. It would be natural to treat task assemblies as components and use associated .deps.json file to determine their dependencies. This would make the system work nicely end to end with the .NET Core CLI/SDK and VS integration.

documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Building MSBuild for the .NET Framework
22

3-
These instructions refer to working with the `master` branch.
3+
These instructions refer to working with the `main` branch.
44

55
## Required Software
66

documentation/wiki/Contributing-Code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Because our focus right now is on maintaining backwards compatibility, the team
55

66
- Contributions must be discussed with the team first, or they will likely be declined. As our process matures and our experience grows, the team expects to take larger contributions.
77
- Only contributions referencing an approved Issue will be accepted.
8-
- Pull requests that do not merge easily with the tip of the master branch will be declined. The author will be asked to merge with tip and submit a new pull request.
8+
- Pull requests that do not merge easily with the tip of the main branch will be declined. The author will be asked to merge with tip and submit a new pull request.
99
- Submissions must meet functional and performance expectations, including scenarios for which the team doesn't yet have open source tests. This means you may be asked to fix and resubmit your pull request against a new open test case if it fails one of these tests.
1010
- Submissions must follow the [.NET Runtime Coding Guidelines](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md)
1111

documentation/wiki/Localization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
## Process for interacting with the localization team
2323

24-
- 3 weeks cadence for master, initiated by loc team
25-
- on demand for master / release branches, initiated by msbuild team
24+
- 3 weeks cadence for main, initiated by loc team
25+
- on demand for main / release branches, initiated by msbuild team
2626

2727
## Contributing a better translation
2828

src/Build.UnitTests/BackEnd/DebugUtils_tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.Build.UnitTests
1616
public class DebugUtils_Tests
1717
{
1818
[Fact]
19-
public void DumpExceptionToFileShouldWriteInTempPathByDefault()
19+
public void DumpExceptionToFileShouldWriteInDebugDumpPath()
2020
{
2121
var exceptionFilesBefore = Directory.GetFiles(ExceptionHandling.DebugDumpPath, "MSBuild_*failure.txt");
2222

src/Build.UnitTests/BinaryLogger_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public void BinaryLoggerShouldEmbedFilesViaTaskOutput()
216216
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"));
217217
}
218218

219-
[Fact]
219+
[RequiresSymbolicLinksFact]
220220
public void BinaryLoggerShouldEmbedSymlinkFilesViaTaskOutput()
221221
{
222222
string testFileName = "foobar.txt";

src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@
122122
<Compile Include="..\Shared\UnitTests\LongPathSupportDisabledFactAttribute.cs">
123123
<Link>Shared\LongPathSupportDisabledFactAttribute.cs</Link>
124124
</Compile>
125+
<Compile Include="..\UnitTests.Shared\RequiresSymbolicLinksFactAttribute.cs">
126+
<Link>RequiresSymbolicLinksFactAttribute.cs</Link>
127+
</Compile>
125128

126129
<None Include="..\Shared\UnitTests\App.config">
127130
<Link>App.config</Link>

src/Framework/ChangeWaves.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ internal enum ChangeWaveConversionState
2020
/// Coupled together with the MSBUILDDISABLEFEATURESFROMVERSION environment variable,
2121
/// this class acts as a way to make risky changes while giving customers an opt-out.
2222
/// </summary>
23-
/// See docs here: https://github.com/dotnet/msbuild/blob/master/documentation/wiki/ChangeWaves.md
24-
/// For dev docs: https://github.com/dotnet/msbuild/blob/master/documentation/wiki/ChangeWaves-Dev.md
23+
/// See docs here: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/ChangeWaves.md
24+
/// For dev docs: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/ChangeWaves-Dev.md
2525
internal class ChangeWaves
2626
{
2727
internal static readonly Version Wave17_2 = new Version(17, 2);

src/Framework/NativeMethods.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ internal static MemoryStatus GetMemoryStatus()
10171017
return null;
10181018
}
10191019

1020-
internal static bool MakeSymbolicLink(string newFileName, string exitingFileName, ref string errorMessage)
1020+
internal static bool MakeSymbolicLink(string newFileName, string existingFileName, ref string errorMessage)
10211021
{
10221022
bool symbolicLinkCreated;
10231023
if (IsWindows)
@@ -1029,12 +1029,12 @@ internal static bool MakeSymbolicLink(string newFileName, string exitingFileName
10291029
flags |= SymbolicLink.AllowUnprivilegedCreate;
10301030
}
10311031

1032-
symbolicLinkCreated = CreateSymbolicLink(newFileName, exitingFileName, flags);
1032+
symbolicLinkCreated = CreateSymbolicLink(newFileName, existingFileName, flags);
10331033
errorMessage = symbolicLinkCreated ? null : Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()).Message;
10341034
}
10351035
else
10361036
{
1037-
symbolicLinkCreated = symlink(exitingFileName, newFileName) == 0;
1037+
symbolicLinkCreated = symlink(existingFileName, newFileName) == 0;
10381038
errorMessage = symbolicLinkCreated ? null : Marshal.GetLastWin32Error().ToString();
10391039
}
10401040

src/MSBuild/LiveLogger/ANSIBuilder.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,7 @@ public static string Spinner(int n)
427427

428428
public static string ProgressBar(float percentage, int width = 10, char completedChar = '█', char remainingChar = '░')
429429
{
430-
string result = String.Empty;
431-
for (int i = 0; i < (int)Math.Floor(width * percentage); i++)
432-
{
433-
result += completedChar;
434-
}
435-
for (int i = (int)Math.Floor(width * percentage); i < width; i++)
436-
{
437-
result += remainingChar;
438-
}
439-
return result;
430+
return new string(completedChar, (int)Math.Floor(width * percentage)) + new string(remainingChar, width - (int)Math.Floor(width * percentage));
440431
}
441432

442433
public static string Bell()

0 commit comments

Comments
 (0)