Skip to content

Commit 87b65e2

Browse files
Update eliminating prebuilts documentation (#5353)
* Update eliminating prebuilts documentation * AI provided enhancements
1 parent 4d96054 commit 87b65e2

File tree

1 file changed

+55
-54
lines changed

1 file changed

+55
-54
lines changed

Documentation/eliminating-pre-builts.md

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Eliminating pre-builts in .NET repositories
22

3-
This is a detailed guide on how to eliminate pre-builts in a source-buildable
4-
repository. It is primarily intended for developers contributing to the `dotnet`
5-
organization.
3+
This is a detailed guide on how to eliminate pre-builts in a source-buildable repository.
4+
It is primarily intended for developers contributing to the `dotnet` organization.
65

7-
## Table of content
6+
> **Important**: Starting with .NET 10.0, prebuilt detection was removed from individual repositories due to accuracy and usability issues.
7+
> Prebuilt detection now only occurs within the VMR (Virtual Monolithic Repository).
8+
9+
## Table of contents
810

911
- [What is a Prebuilt](#what-is-a-prebuilt)
10-
- [Elimitating pre-builts](#eliminating-pre-builts)
11-
- [Allowed exceptions](#allowed-exceptions)
12+
- [.NET 10.0+ VMR-based prebuilt detection](#net-100-vmr-based-prebuilt-detection)
13+
- [Pre-10.0 repository-based prebuilt detection](#pre-100-repository-based-prebuilt-detection)
14+
- [Allowed exceptions (Pre-10.0)](#allowed-exceptions-pre-100)
1215
- [Contacts](#contacts)
1316

1417
## What is a Prebuilt
@@ -26,14 +29,13 @@ given repository.
2629

2730
When onboarding a repository to source-build or adding a new dependency to a
2831
source-buildable one, the contributor runs the risk of introducing a new
29-
pre-built to the product. To protect against this and catch any new pre-builts
30-
as soon as possible, Arcade source-build infrastructure provides _pre-built
31-
detection_ - MSBuild logic responsible for veryfing that no used dependency is a
32+
pre-built to the product. To protect against this, the source-build infrastructure provides _pre-built
33+
detection_ - MSBuild logic responsible for verifying that no used dependency is a
3234
pre-built. In case one is discovered (for example, during a PR pipeline), the
3335
build will fail with an appropriate message somewhat similar to the following:
3436

3537
```text
36-
3 new packages used not in baseline! See report at ./artifacts/source-build/self/prebuilt-report/baseline-comparison.xml for more information. Package IDs are:
38+
3 new packages used not in baseline! See report at ./artifacts/log/Release/baseline-comparison.xml for more information. Package IDs are:
3739
Microsoft.Bcl.AsyncInterfaces.8.0.0-alpha.1.22557.11
3840
Microsoft.Build.16.7.0
3941
Microsoft.Build.Framework.14.3.0
@@ -46,14 +48,33 @@ tooling during the build process and not referenced by the project itself.
4648
Dependencies retrieved from external sources that are not explicitly excluded
4749
from pre-built detection will be flagged as pre-builts.
4850

49-
## Eliminating pre-builts
51+
## .NET 10.0+ VMR-based prebuilt detection
52+
53+
Starting with .NET 10.0, prebuilt detection was removed from individual repositories because it was inaccurate and problematic.
54+
Prebuilt detection now only occurs during full source builds within the VMR.
55+
56+
### For repository developers
57+
58+
Prebuilts will typically be surfaced when repository changes forward flow into the VMR.
59+
There are two ways to detect prebuilts before they reach the VMR:
60+
61+
1. **VMR validation against repository PRs**: Use the process described in [VMR Validation documentation](https://github.com/dotnet/arcade/blob/main/Documentation/VmrValidation.md) to validate your repository changes against the VMR.
62+
63+
2. **Direct VMR changes**: Changes made directly against the VMR will have prebuilt detection performed as part of the PR validation checks.
64+
65+
### VMR source-build instructions
66+
67+
Prebuilt detection is enabled anytime a source build is performed within the VMR.
68+
For complete guidance on how to build the VMR from source, see the [VMR build documentation](https://github.com/dotnet/dotnet/blob/main/README.md#building).
69+
70+
### Resolving prebuilts
5071

51-
When altering the dependecy tree of a repository, specifically adding or
52-
updating dependencies, there is a posibility that a new pre-built is introduced,
53-
failing the build and blocking any merge. This can be resolved by identifying
54-
what exactly is the pre-built and following the approriate steps listed below.
72+
When prebuilts are detected in the VMR, they will cause a build failure.
73+
Refer to the [adding a new source-build dependency](https://github.com/dotnet/source-build/blob/main/Documentation/sourcebuild-in-repos/new-dependencies.md) documentation for guidance on resolving them.
5574

56-
To check if new pre-builts were introduce, the repository needs to be
75+
## Pre-10.0 repository-based prebuilt detection
76+
77+
To check if new pre-builts were introduced, the repository needs to be
5778
source-built first. This can be done through the following command:
5879

5980
```sh
@@ -68,14 +89,11 @@ detection reports, located in the
6889
`./prebuild-usage.xml` file. The information in question can, for example, be
6990
the path to the project that is referencing the dependency.
7091

71-
With this information retrieved, the [adding a new source-build
72-
dependency](https://github.com/dotnet/source-build/blob/main/Documentation/sourcebuild-in-repos/new-dependencies.md#adding-dependencies)
73-
documentation should be referred to as the main guide for resolving the
74-
pre-built.
92+
Once you've identified a pre-built, refer to the [adding a new source-build dependency](https://github.com/dotnet/source-build/blob/main/Documentation/sourcebuild-in-repos/new-dependencies.md) documentation for guidance on resolving it.
7593

76-
### Pre-built through a transitive dependency
94+
## Pre-builts through transitive dependencies
7795

78-
During a project dependency updated, a new pre-built might be introduced by a
96+
During a project dependency update, a new pre-built might be introduced by a
7997
new or updated transitive dependency. While the Arcade tooling will highlight
8098
the name and version of the pre-built in the build exception as well as the
8199
project that restored the dependency in question, it will not point out where
@@ -86,9 +104,9 @@ dependency, it might be hard to identify the relationship that is bringing in
86104
the pre-built into the project, especially if the developer has limited
87105
knowledge of the project or code-base in general.
88106

89-
Arcade source-build infrastructure helps accomplish this this by pointing out
107+
Arcade source-build infrastructure helps accomplish this by pointing out
90108
the `project.assets.json` file that is referencing the pre-built in the
91-
`./artifacts/source-build/self/prebuild-report/prebuild-usage.xml` report file.
109+
`./artifacts/log/Release/prebuilt-usage.xml` report file.
92110
A `project.assets.json` file is a NuGet restore process artifact that contains a
93111
resolved dependency tree for a specific project. Every package that was restored
94112
by a given project is mentioned there with links between the dependencies,
@@ -101,7 +119,7 @@ entries in files mentioned above:
101119
Exception identifying the pre-built:
102120

103121
```text
104-
1 new packages used not in baseline! See report at ./artifacts/source-build/self/prebuilt-report/baseline-comparison.xml for more information. Package IDs are:
122+
1 new packages used not in baseline! See report at ./artifacts/log/Release/baseline-comparison.xml for more information. Package IDs are:
105123
System.Text.Json.8.0.0
106124
```
107125

@@ -135,40 +153,23 @@ Entry in project.assets.json:
135153
In this example, `Microsoft.Extensions.DependencyModel` would be the direct
136154
dependency causing the `System.Text.Json` pre-built.
137155

138-
## Allowed exceptions
156+
## Allowed exceptions (Pre-10.0)
139157

140-
The list of permitted pre-builts can be found in the
141-
`./eng/SourceBuildPrebuiltBaseline.xml` file in the root of the repository. It
142-
contains package information of pre-builts that for one reason or another are
143-
allowed in the source-build of the repository.
158+
> **Note**: The information in this section applies to .NET versions **prior to 10.0**.
144159
145-
Any new addition to the pre-built exception list must be signed-off by a member
146-
of the `@dotnet/source-build` team.
160+
The list of permitted pre-builts can be found in the `./eng/SourceBuildPrebuiltBaseline.xml` file in the root of the repository.
161+
It contains package information of pre-builts that for one reason or another are allowed in the source-build of the repository.
147162

148-
A common example of a exception that is present in several .NET repositories is
149-
an [_intermediate
150-
package_](https://github.com/dotnet/source-build/blob/main/Documentation/planning/arcade-powered-source-build/intermediate-nupkg.md).
151-
When a repository utilizes an intermediate package, it will be excluded from
152-
pre-built detection with the following declaration in the above-mentioned file:
153-
154-
```xml
155-
<UsageData>
156-
<IgnorePatterns>
157-
<UsagePattern IdentityGlob="Microsoft.SourceBuild.Intermediate.*" />
158-
</IgnorePatterns>
159-
</UsageData>
160-
```
161-
162-
With this ignore pattern in place, pre-built detection will not mark any .NET
163-
intermediate package as long as it conforms to the naming in the pattern.
163+
Any new additions to the pre-built exception list must be signed-off by a member of the `@dotnet/source-build` team.
164164

165165
In cases where a specific package needs to be excluded from pre-built detection
166166
(for example, to not block the introduction of changes until a source-build
167167
acceptable solution for the pre-built is provided), the developer can directly
168-
specify the name / version of the depedency:
168+
specify the name / version of the dependency:
169169

170170
```xml
171171
<UsageData>
172+
<Usages>
172173
<Usage Id="Foo.Bar" Version="x.y.z" />
173174
</Usages>
174175
</UsageData>
@@ -181,8 +182,8 @@ pre-built to the existing baseline. The new file can be found at
181182

182183
## Contacts
183184

184-
For any questions or additional information about this document, pre-builts or
185-
source-build in general, please create an
186-
[issue](https://github.com/dotnet/source-build/issues) or open a
187-
[discussion](https://github.com/dotnet/source-build/discussions) in the
188-
[source-build](https://github.com/dotnet/source-build) repository.
185+
For questions or additional information about this document, pre-builts or source-build in general, please use one of the following:
186+
187+
- [Open an issue](https://github.com/dotnet/source-build/issues)
188+
- [Create a new discussion](https://github.com/dotnet/source-build/discussions)
189+
- [Mention @dotnet/source-build](https://github.com/orgs/dotnet/teams/source-build)

0 commit comments

Comments
 (0)