You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable restore for ref and src projects in libs (#33553)
- Use RestoreUseStaticGraphEvaluation which improves no-op restore by 10-15x down to 10-20 seconds.
- .builds msbuild files renamed to .proj as RestoreUseStaticGraphEvaluation throws for non .proj files without an env var set.
- Introducing subsets for libraries and mono and replacing -buildtests switch which was only working for libraries in favor of the subset switch -subset tests which works consistently.
- Fixing the Microsoft.DotNet.CodeAnalysis analyzer which wasn't running and adding missing exclusions.
- Separating restore and build phases in different parts in the repo (ie for installer.tasks) as generated props and targets need to be imported which requires a reevaluation in the build phase.
- Fix eng/docker/build-docker-sdk.ps1 by using the official build entrypoints (cc @alnikola)
- Remove a few depprojs in favor of project restore (faster restore :))
- Fix root code coverage measurement not working correctly
- Traversal support instead of dir.traversal.targets or manual build target defines.
- Introduce a root Build.proj entrypoint which is responsible for building and restoring the repository. This is necessary to enable the new NuGet fast restore which works best and fastest with a single entrypoint.
- Avoid binclashes in libraries and between libraries and installer (netstandard.depproj vs netstandard.csproj)
- Upgrading the SDK to 5.0 latest
- Code cleanup
Framework specific libraries are effectively the same as the previous example. The difference is that the src project reference **must** refer to the `.builds` file which will provide multiple assets from multiple projects.
Sample \ref .builds file defining a constant used to filter API that were added on top of the netstandard1.7 ones and are available only in netcoreapp1.1:
These packages need to provide a different platform specific implementation on each platform. They do this by splitting the implementations into separate packages and associating those platform specific packages with the primary reference package. Each platform specific package sets `PackageTargetRuntime` to the specific platform RID that it applies.
The makeup of a package folder is primarily a grouping of project references to the projects that compose that package. Settings within each referenced project determines where that asset will be placed in the package. For example, reference assembly projects will be placed under the `ref/{targetMoniker}` folder in the package and implementations will be under either `lib/{targetMoniker}` or `runtimes/{rid}/lib/{targetMoniker}`. Whenever NuGet evaluates a package in the context of a referencing project it will choose the best compile time asset (preferring `ref`, then falling back to `lib`) and runtime asset (preferring `runtimes/{rid}/lib` and falling back to `lib`) for every package that is referenced. For more information see http://docs.nuget.org/.
@@ -221,8 +63,8 @@ Asset projects (`.csproj`, `.vbproj`, or `.depproj`) can control their `{targetM
221
63
222
64
The primary thing that the library author needs to do in order to ensure the correct asset selection is:
223
65
224
-
1. Configure the correct projects in your library's `.builds` file.
225
-
2. Reference the `.builds` file from the package project.
66
+
1. Configure the correct projects in your library's `.proj` file.
67
+
2. Reference the `.proj` file from the package project.
226
68
3. Provide a default PackageTargetFramework for empty-BuildTargetFramework builds in the library's `.csproj` or `.vbproj`.
Copy file name to clipboardExpand all lines: docs/project/library-servicing.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ Where the `AssemblyVersion` is set to the old version before updating. To determ
33
33
34
34
If you incremented the `AssemblyVersion` in the last step, you'll also need to add an entry to [packageIndex.json](https://github.com/dotnet/runtime/blob/master/src/libraries/pkg/Microsoft.Private.PackageBaseline/packageIndex.json). Find the entry for your library in that file (again, making sure you're in the correct release branch), then find the subsection labeled `AssemblyVersionInPackageVersion`. There, add an entry that maps your new `AssemblyVersion` to your new `PackageVersion`. For an example, see [this PR](https://github.com/dotnet/runtime/commit/d0e4dcc7ebf008e7b6835cafbd03878c3a0e75f8#diff-ec9fd7a62cb0c494d86029014940382cR107), where we bumped the `PackageVersion` of `Microsoft.Diagnostics.Tracing.EventSource` from `2.0.0` to `2.0.1`, and bumped the `AssemblyVersion` from `2.0.0.0` to `2.0.1.0`. Therefore, we added an entry to `packageIndex.json` of the form `"2.0.1.0": "2.0.1"`.
35
35
36
-
## Add your package to packages.builds
36
+
## Add your package to libraries-packages.proj
37
37
38
-
In order to ensure that your package gets built, you need to add it to [packages.builds](https://github.com/dotnet/runtime/blob/master/src/libraries/packages.builds). In the linked example, we were building `System.Drawing.Common`. All you have to do is add a `Project` block inside the linked ItemGroup that matches the form of the linked example, but with `System.Drawing.Common` replaced by your library's name. Again, make sure to do this in the right servicing branch.
38
+
In order to ensure that your package gets built, you need to add it to [libraries-packages.proj](https://github.com/dotnet/runtime/blob/master/src/libraries/libraries-packages.proj). In the linked example, we were building `System.Drawing.Common`. All you have to do is add a `Project` block inside the linked ItemGroup that matches the form of the linked example, but with `System.Drawing.Common` replaced by your library's name. Again, make sure to do this in the right servicing branch.
For more details on the build settings see [project-guidelines](../../../coding-guidelines/project-guidelines.md#build-pivots).
83
83
84
-
If you invoke the `build` script without any actions, the default action chain `-restore -build` is executed. You can chain multiple actions together (e.g., `-restore -build -buildtests`) and they will execute in the appropriate order. Note that if you specify actions like `-build` explicitly, you likely need to explicitly add `-restore` as well.
84
+
If you invoke the `build` script without any actions, the default action chain `-restore -build` is executed.
85
85
86
-
By default the `build` script only builds the product libraries and none of the tests. If you want to build the tests you can add the flag`-buildtests`. If you want to run the tests you can add the flag `-test`. To build and run the tests combine both arguments: `-buildtests -test`. To specify just the libraries, use `-subcategory libraries`.
86
+
By default the `build` script only builds the product libraries and none of the tests. If you want to include tests, you want to add the subset`-subset libtests`. If you want to run the tests you want to use the `-test` action instead of the `-build`, e.g. `build.cmd/sh -subsetcategory libraries -test`. To specify just the libraries, use `-subcategory libraries`.
87
87
88
88
**Examples**
89
89
- Building in release mode for platform x64 (restore and build are implicit here as no actions are passed in)
@@ -93,7 +93,7 @@ By default the `build` script only builds the product libraries and none of the
93
93
94
94
- Building the src assemblies and build and run tests (running all tests takes a considerable amount of time!)
Copy file name to clipboardExpand all lines: docs/workflow/debugging/libraries/debugging-packages.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Assuming the current directory is `\src\contractname\`:
25
25
26
26
Check the logs for output such as:
27
27
```
28
-
Project "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.builds" (1) is building "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (2:3) on node 1
28
+
Project "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (1) is building "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (2:3) on node 1
29
29
(Build target(s)).
30
30
31
31
[...]
@@ -37,7 +37,7 @@ CopyFilesToOutputDirectory:
37
37
38
38
[...]
39
39
40
-
Project "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.builds" (1) is building "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (2:4) on node 1
40
+
Project "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (1) is building "S:\c1\src\System.Net.ServicePoint\ref\System.Net.ServicePoint.csproj" (2:4) on node 1
41
41
(Build target(s)).
42
42
43
43
[...]
@@ -86,7 +86,7 @@ Ensure that the right `BuildTargetFramework` (what we're testing) is set.
86
86
To identify which of the combinations failed, search for the following pattern in the output:
87
87
88
88
```
89
-
Project "S:\c1\src\System.Net.ServicePoint\tests\System.Net.ServicePoint.Tests.builds" (1) is building "S:\c1\src\System.Net.ServicePoint\tests\System.Net.ServicePoint.Tests.csproj"
89
+
Project "S:\c1\src\System.Net.ServicePoint\tests\System.Net.ServicePoint.Tests.csproj" (1) is building "S:\c1\src\System.Net.ServicePoint\tests\System.Net.ServicePoint.Tests.csproj"
90
90
(2:5) on node 1 (Build target(s)).
91
91
ResolvePkgProjReferences:
92
92
Resolved compile assets from .NETStandard,Version=v2.0: S:\c1\bin\ref\System.Net.ServicePoint\4.0.0.0\System.Net.ServicePoint.dll
Copy file name to clipboardExpand all lines: docs/workflow/testing/libraries/testing.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ To build the tests and run them you can call the libraries build script.
7
7
**Examples**
8
8
- The following shows how to build only the tests but not run them:
9
9
```
10
-
libraries -buildtests
10
+
libraries -subset libtests
11
11
```
12
12
13
13
- The following builds and runs all tests in release configuration:
@@ -20,17 +20,15 @@ libraries -test -c Release
20
20
libraries -test /p:WithoutCategories=IgnoreForCI
21
21
```
22
22
23
-
Unless you specifiy `/p:TestNoBuild=true`, test assemblies are implicitly built when invoking the `Test`target.
23
+
Unless you specifiy `-testnobuild`, test assemblies are implicitly built when invoking the `Test`action.
24
24
- The following shows how to only test the libraries without building them
25
25
```
26
-
libraries -test /p:TestNoBuild=true
26
+
libraries -test -testnobuild
27
27
```
28
28
29
29
## Running tests on the command line
30
30
31
-
To build tests you need to pass the `-buildtests` flag to `build.cmd/sh` or run `libraries -restore -build -buildtests` (note that you need to specify `-restore` and `-build` additionally as those are only implicit if no action is passed in).
32
-
33
-
If you are interested in building and running the tests only for a specific library, then there are two different ways to do it:
31
+
To build tests you need to specify the `test` subset when invoking build.cmd/sh: `libraries -subset libtests`.
34
32
35
33
The easiest (and recommended) way to build and run the tests for a specific library, is to invoke the `Test` target on that library:
0 commit comments