Skip to content

Commit 8e0147e

Browse files
authored
Redesign the subset feature (dotnet#34663)
* Redesign subset feature and remove subsetcategory Implement proposal from dotnet#34403. Remove subsetcategory and allow all subsets to specified via the -subset switch.
1 parent 6ca5d51 commit 8e0147e

File tree

28 files changed

+144
-201
lines changed

28 files changed

+144
-201
lines changed

docs/workflow/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ build -h
3838
On Unix like systems, arguments can be passed in with a single `-` or double hyphen `--`.
3939

4040
The repository currently consists of different major parts: the runtimes, the libraries, and the installer.
41-
To build just one part you use the root build script (build.cmd/sh), and you add the `-subsetCategory` flag.
41+
To build just one part you use the root build script (build.cmd/sh), and you add the `-subset` flag.
4242

4343
## Configurations
4444

docs/workflow/building/coreclr/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# Building
22

3-
To build just CoreCLR, use the `-subsetCategory` flag to the `build.sh` (or `build.cmd`) script at the repo root:
3+
To build just CoreCLR, use the `-subset` flag to the `build.sh` (or `build.cmd`) script at the repo root:
44

55
For Linux:
66
```
7-
./build.sh -subsetCategory coreclr
7+
./build.sh -subset clr
88
```
99

1010
For Windows:
1111
```
12-
build.cmd -subsetCategory coreclr
12+
build.cmd -subset clr
1313
```
1414

1515
By default, build generates a 'debug' build type, that includes asserts and is easier for some people to debug. If you want to make performance measurements, or just want tests to execute more quickly, you can also build the 'release' version (which does not have these checks) by adding the flag `-configuration release` (or `-c release`), for example:
1616
```
17-
./build.sh -subsetCategory coreclr -configuration release
17+
./build.sh -subset clr -configuration release
1818
```
1919

2020
CoreCLR also supports a 'checked' build type which has asserts enabled like 'debug', but is built with the native compiler optimizer enabled, so it runs much faster. This is the usual mode used for running tests in the CI system. You can build that using, for example:
2121
```
22-
./build.sh -subsetCategory coreclr -configuration checked
22+
./build.sh -subset clr -configuration checked
2323
```
2424

2525
This will produce outputs as follows:

docs/workflow/building/coreclr/cross-building.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Cross compiling CoreCLR
1313

1414
Build using "arm" as the architecture. For example:
1515

16-
C:\runtime> build.cmd -subsetCategory CoreClr -subset Runtime -arch arm -c debug
16+
C:\runtime> build.cmd -subset clr.runtime -arch arm -c debug
1717

1818
-or-
1919

@@ -101,7 +101,7 @@ Cross compiling CoreCLR
101101
-----------------------
102102
`ROOTFS_DIR` must be set when running `build-runtime.sh`.
103103

104-
~/runtime/ $ ROOTFS_DIR=/home/arm ./build.sh --subsetCategory CoreClr --subset Runtime --arch arm -c debug -v verbose --cross
104+
~/runtime/ $ ROOTFS_DIR=/home/arm ./build.sh --subset clr.runtime --arch arm -c debug -v verbose --cross
105105

106106
-or-
107107

@@ -144,7 +144,7 @@ The following instructions assume you are on a Linux machine such as Ubuntu 14.0
144144
To build System.Private.CoreLib for Linux, run the following command:
145145

146146
```
147-
lgs@ubuntu ~/git/runtime/ $ ./build.sh --subsetCategory CoreClr --subset CoreLib-NativeCoreLib --arch arm -c debug -v verbose
147+
lgs@ubuntu ~/git/runtime/ $ ./build.sh --subset clr.corelib+clr.nativecorelib --arch arm -c debug -v verbose
148148
```
149149

150150
The output is at `artifacts/bin/coreclr/<TargetOS>.arm.Debug/IL/System.Private.CoreLib.dll`.

docs/workflow/building/coreclr/linux-instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Build the Runtime and System.Private.CoreLib
127127
To build the runtime on Linux, run build.sh to build the CoreCLR subset category of the runtime:
128128

129129
```
130-
./build.sh -subsetCategory coreclr
130+
./build.sh -subset clr
131131
```
132132

133133
After the build is completed, there should some files placed in `artifacts/bin/coreclr/Linux.x64.Debug`. The ones we are most interested in are:

docs/workflow/building/coreclr/osx-instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Build the Runtime and System.Private.CoreLib
4646
To Build CoreCLR, run build.sh to build the CoreCLR subset category of the runtime:
4747

4848
```
49-
./build.sh -subsetCategory coreclr
49+
./build.sh -subset clr
5050
```
5151

5252
After the build has completed, there should some files placed in `artifacts/bin/coreclr/OSX.x64.Debug`. The ones we are interested in are:

docs/workflow/building/libraries/README.md

+15-20
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Here is one example of a daily workflow for a developer working mainly on the li
99
git clean -xdf
1010
git pull upstream master & git push origin master
1111
:: Build Debug libraries on top of Release runtime:
12-
build -subsetCategory coreclr-libraries -runtimeConfiguration Release
12+
build -subset clr+libs -runtimeConfiguration Release
1313
:: The above you may only perform once in a day, or when you pull down significant new changes.
1414
1515
:: If you use Visual Studio, you might open System.Text.RegularExpressions.sln here.
@@ -33,7 +33,7 @@ The instructions for Linux and macOS are essentially the same:
3333
git clean -xdf
3434
git pull upstream master & git push origin master
3535
# Build Debug libraries on top of Release runtime:
36-
./build.sh -subsetCategory coreclr-libraries -runtimeconfiguration Release
36+
./build.sh -subset clr+libs -runtimeconfiguration Release
3737
# The above you may only perform once in a day, or when you pull down significant new changes.
3838

3939
# Switch to working on a given library (RegularExpressions in this case)
@@ -83,33 +83,28 @@ For more details on the build settings see [project-guidelines](../../../coding-
8383

8484
If you invoke the `build` script without any actions, the default action chain `-restore -build` is executed.
8585

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`.
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 -subset libs.tests -test`. To specify just the libraries, use `-subset libs`.
8787

8888
**Examples**
8989
- Building in release mode for platform x64 (restore and build are implicit here as no actions are passed in)
9090
```bash
91-
./build.sh -subsetCategory libraries -c Release -arch x64
91+
./build.sh -subset libs -c Release -arch x64
9292
```
9393

9494
- Building the src assemblies and build and run tests (running all tests takes a considerable amount of time!)
9595
```bash
96-
./build.sh -subsetCategory libraries -restore -build -test
96+
./build.sh -subset libs -test
9797
```
9898

9999
- Building for different target frameworks (restore and build are implicit again as no action is passed in)
100100
```bash
101-
./build.sh -subsetCategory libraries -framework netcoreapp5.0
102-
./build.sh -subsetCategory libraries -framework net472
103-
```
104-
105-
- Build only managed components and skip the native build
106-
```bash
107-
./build.sh -subsetCategory libraries /p:BuildNative=false
101+
./build.sh -subset libs -framework netcoreapp5.0
102+
./build.sh -subset libs -framework net472
108103
```
109104

110105
- Clean the entire solution
111106
```bash
112-
./build.sh -subsetCategory libraries -clean
107+
./build.sh -clean
113108
```
114109

115110
For Windows, replace `./build.sh` with `build.cmd`.
@@ -141,17 +136,17 @@ Similar to building the entire repo with `build.cmd` or `build.sh` in the root y
141136
- Build all projects for a given library (e.g.: System.Collections) including running the tests
142137

143138
```bash
144-
./build.sh -subsetCategory libraries src/libraries/System.Collections
139+
./build.sh -projects src/libraries/*/System.Collections.sln
145140
```
146141

147142
- Build just the tests for a library project
148143
```bash
149-
./build.sh -subsetCategory libraries src/libraries/System.Collections/tests
144+
./build.sh -projects src/libraries/System.Collections/tests/*.csproj
150145
```
151146

152147
- All the options listed above like framework and configuration are also supported (note they must be after the directory)
153148
```bash
154-
./build.sh -subsetCategory libraries System.Collections -f net472 -c Release
149+
./build.sh -projects src/libraries/*/System.Collections.sln -f net472 -c Release
155150
```
156151

157152
As `dotnet build` works on both Unix and Windows and calls the restore target implicitly, we will use it throughout this guide.
@@ -185,24 +180,24 @@ dotnet build -c Release System.Net.NetworkInformation.csproj
185180
By default the libraries will attempt to build using the CoreCLR version of `System.Private.CoreLib.dll`. In order to build against the Mono version you need to use the `/p:RuntimeFlavor=Mono` argument.
186181

187182
```
188-
.\build.cmd -subsetCategory libraries /p:RuntimeFlavor=Mono
183+
.\build.cmd -subset libs /p:RuntimeFlavor=Mono
189184
```
190185

191186
### Building all for other OSes
192187

193188
By default, building from the root will only build the libraries for the OS you are running on. One can
194-
build for another OS by specifying `./build.sh -subsetCategory libraries -os [value]`.
189+
build for another OS by specifying `./build.sh -subset libs -os [value]`.
195190

196191
Note that you cannot generally build native components for another OS but you can for managed components so if you need to do that you can do it at the individual project level or build all via passing `/p:BuildNative=false`.
197192

198193
### Building in Release or Debug
199194

200195
By default, building from the root or within a project will build the libraries in Debug mode.
201-
One can build in Debug or Release mode from the root by doing `./build.sh -subsetCategory libraries -c Release` or `./build.sh -subsetCategory libraries -c Debug`.
196+
One can build in Debug or Release mode from the root by doing `./build.sh -subset libs -c Release` or `./build.sh -subset libs -c Debug`.
202197

203198
### Building other Architectures
204199

205-
One can build 32- or 64-bit binaries or for any architecture by specifying in the root `./build.sh -subsetCategory libraries -arch [value]` or in a project `/p:TargetArchitecture=[value]` after the `dotnet build` command.
200+
One can build 32- or 64-bit binaries or for any architecture by specifying in the root `./build.sh -subset libs -arch [value]` or in a project `/p:TargetArchitecture=[value]` after the `dotnet build` command.
206201

207202
## Working in Visual Studio
208203

docs/workflow/building/mono/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Note that the debug configuration is the default option. It generates a 'debug'
1515
Once you've built the whole runtime and assuming you want to work with just mono, you want to use the following command:
1616

1717
```bash
18-
./build.sh --subsetCategory mono
18+
./build.sh --subset mono
1919
```
2020
or on Windows,
2121
```bat
22-
build.cmd -subsetCategory mono
22+
build.cmd -subset mono
2323
```
2424
When the build completes, product binaries will be dropped in the `artifacts\bin\mono\<OS>.<arch>.<flavor>` folder.
2525

@@ -44,11 +44,11 @@ The build has a number of options that you can learn about using build -?.
4444
To generate nuget packages:
4545

4646
```bash
47-
./build.sh --subsetCategory mono -pack (with optional release configuration)
47+
./build.sh --subset mono -pack (with optional release configuration)
4848
```
4949
or on Windows,
5050
```bat
51-
build.cmd -subsetCategory mono -pack (with optional release configuration)
51+
build.cmd -subset mono -pack (with optional release configuration)
5252
```
5353

5454
The following packages will be created under `artifacts\packages\<configuration>\Shipping`:

docs/workflow/testing/libraries/testing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ To build the tests and run them you can call the libraries build script.
77
**Examples**
88
- The following shows how to build only the tests but not run them:
99
```
10-
libraries -subset libtests
10+
build.cmd/sh -subset libs.tests
1111
```
1212

1313
- The following builds and runs all tests in release configuration:
1414
```
15-
libraries -test -c Release
15+
build.cmd/sh -subset libs -test -c Release
1616
```
1717

1818
- The following example shows how to pass extra msbuild properties to ignore tests ignored in CI:
1919
```
20-
libraries -test /p:WithoutCategories=IgnoreForCI
20+
build.cmd/sh -subset libs -test /p:WithoutCategories=IgnoreForCI
2121
```
2222

2323
Unless you specifiy `-testnobuild`, test assemblies are implicitly built when invoking the `Test` action.
2424
- The following shows how to only test the libraries without building them
2525
```
26-
libraries -test -testnobuild
26+
build.cmd/sh -subset libs -test -testnobuild
2727
```
2828

2929
## Running tests on the command line
3030

31-
To build tests you need to specify the `test` subset when invoking build.cmd/sh: `libraries -subset libtests`.
31+
To build tests you need to specify the `test` subset when invoking build.cmd/sh: `build.cmd/sh -subset libs.tests`.
3232

3333
The easiest (and recommended) way to build and run the tests for a specific library, is to invoke the `Test` target on that library:
3434
```cmd

eng/SubsetValidation.targets

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<Target Name="FindInvalidSpecifiedSubsetNames">
1717
<ItemGroup>
18-
<SpecifiedSubsetName Include="$([MSBuild]::Unescape($(Subset.Replace('-', ';'))))" />
18+
<SpecifiedSubsetName Include="$([MSBuild]::Unescape($(Subset.Replace('+', ';').Replace('-', ';'))))" />
1919

2020
<!-- MSBuild Exclude is case-insensitive, which matches intended behavior. -->
2121
<InvalidSpecifiedSubsetName Include="@(SpecifiedSubsetName)" Exclude="@(SubsetName)" />
@@ -29,9 +29,7 @@
2929
<Target Name="ReportValidSubsetList"
3030
Condition="'@(InvalidSpecifiedSubsetName)' != ''">
3131
<ItemGroup>
32-
<SubsetName Text="- " />
33-
<SubsetName Condition="'%(Category)' != ''" Text="%(Text)%(Category)|" />
34-
<SubsetName Text="%(Text)%(Identity)" />
32+
<SubsetName Text="- %(Identity)" />
3533
<SubsetName Text="%(Text) [only runs on demand]" Condition="'%(SubsetName.OnDemand)' == 'true'" />
3634
<SubsetName Text="%(Text)%0A %(Description)" />
3735
</ItemGroup>

0 commit comments

Comments
 (0)