Skip to content

Commit 66392f5

Browse files
committed
Switch Bootstrapping model to use Arcade
Summary of changes: - Update to latest version of .NET SDK - Delete all the root level wrapper scripts - Switch bootstrapping model to pull in arcade scripts - Update documentation - Update CI scripts - Update official build definitions BuildToolsVersion.txt and DotnetCLIVersion.txt are no longer used and instead the cli version is in global.json and the BuildTools version is in dependencies.props for the time being until we eliminate it completely and move everything to arcade. Root build scripts now call into eng/common build scripts. With wrapper scripts under eng to allow for custom argument alias given we have removed run.exe. Restructed Build.proj in the root to separte the different phases into targets so we can call them individually through the arcade scripts or our CI/official build definitions. Wrapped native build into a build-native.proj file so we can trigger it directly from msbuild in our normal build flow. We can still directly call the native build-native.cmd/sh for bootstraping new platforms but that isn't the default any longer for our builds. CI and official builds no longer call sync and then build we just call build directly and let it do all the phases. Fixed issues with BuildTools were we need to define RootIntermediateOutputPath explicitly now given in BuildTools it looks for init-tools.msbuild which no longer exists. Update the PackagesDir to point to NugetPackageRoot now so we can configure the packages to use the machine wide cache or local repo cache. Currently our docker build definitions don't presist the user wide nuget cache so we need to pass --ci to get the packages and tmp folder localized to the repo which is presisted across commands. Our manual shims were having issues so removed the default references and reduced the amount of seeds passed to help eliminate potential reference resolution issues.
1 parent 8f10082 commit 66392f5

Some content is hidden

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

74 files changed

+634
-2098
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ syntax: glob
44

55
# Tool Runtime Dir
66
/[Tt]ools/
7+
.dotnet/
8+
.packages/
79

810
# User-specific files
911
*.suo
@@ -12,6 +14,7 @@ syntax: glob
1214
*.sln.docstates
1315

1416
# Build results
17+
artifacts/
1518
.idea/
1619
[Dd]ebug/
1720
[Dd]ebugPublic/

BuildToolsVersion.txt

-1
This file was deleted.

Directory.Build.props

+25-17
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
<IsPrerelease>true</IsPrerelease>
3737
</PropertyGroup>
3838

39+
<!-- Provides package dependency version properties and verification/auto-upgrade configuration -->
40+
<Import Project="$(MSBuildThisFileDirectory)dependencies.props" />
41+
42+
<Import Project="$(ProjectDir)artifacts\toolset\Common\Tools.proj.nuget.g.props" Condition="Exists('$(ProjectDir)artifacts\toolset\Common\Tools.proj.nuget.g.props')" />
43+
3944
<!-- Common repo directories -->
4045
<PropertyGroup>
4146
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir>
@@ -46,24 +51,27 @@
4651

4752
<!-- Output directories -->
4853
<BinDir Condition="'$(BinDir)'==''">$(ProjectDir)bin/</BinDir>
49-
54+
<RootIntermediateOutputPath>$(MSBuildThisFileDirectory)bin/obj/</RootIntermediateOutputPath>
55+
5056
<TestWorkingDir Condition="'$(TestWorkingDir)'==''">$(BinDir)tests/</TestWorkingDir>
5157
<PackageOutputRoot Condition="'$(PackageOutputRoot)'=='' and '$(NonShippingPackage)' == 'true'">$(BinDir)packages_noship/</PackageOutputRoot>
5258
<PackageOutputRoot Condition="'$(PackageOutputRoot)'==''">$(BinDir)packages/</PackageOutputRoot>
5359

5460
<!-- Input Directories -->
5561
<PackagesDir>$(DotNetRestorePackagesPath)</PackagesDir>
62+
<PackagesDir Condition="'$(PackagesDir)'==''">$(NuGetPackageRoot)/</PackagesDir>
5663
<PackagesDir Condition="'$(PackagesDir)'==''">$(ProjectDir)packages/</PackagesDir>
5764
<RestorePackagesPath Condition="'$(RestorePackagesPath)'==''">$(PackagesDir)</RestorePackagesPath>
58-
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)'==''">$(PackagesDir)</NuGetPackageRoot>
5965
<ToolsDir Condition="'$(ToolsDir)'==''">$(ProjectDir)Tools/</ToolsDir>
6066
<IlasmToolPath>$(ToolsDir)ilasm/ilasm</IlasmToolPath>
6167
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)CodeAnalysis.ruleset</CodeAnalysisRuleset>
62-
63-
<!-- Set up ToolHostCmd for Arcade targets -->
64-
<ToolHostCmd Condition="'$(ToolHostCmd)'==''">"$(ToolsDir)dotnetcli/dotnet"</ToolHostCmd>
68+
<!-- Respect environment variable for the .NET install directory if set; otherwise, use the current default location -->
69+
<DotNetRoot Condition="'$(DotNetRoot)' == ''">$(DOTNET_INSTALL_DIR)</DotNetRoot>
70+
<DotNetRoot Condition="'$(DotNetRoot)' == ''">$(ProjectDir).dotnet\</DotNetRoot>
71+
<DotNetRoot Condition="!HasTrailingSlash('$(DotNetRoot)')">$(DotNetRoot)\</DotNetRoot>
72+
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(DotNetRoot)</DotnetCliPath>
73+
<ToolHostCmd Condition="'$(ToolHostCmd)'==''">"$(DotNetRoot)dotnet"</ToolHostCmd>
6574
</PropertyGroup>
66-
6775
<!-- Choose .targets files that come from Arcade rather than from buildtools -->
6876
<PropertyGroup>
6977
<ExcludeNotSupportedImport>true</ExcludeNotSupportedImport>
@@ -80,19 +88,17 @@
8088
</PropertyGroup>
8189

8290
<!-- Default properties for CI builds -->
83-
<!-- TODO: Remove obsolete condition when moved to arcade. -->
84-
<PropertyGroup Condition="'$(IsCIBuild)' == 'true' OR '$(ContinuousIntegrationBuild)' == 'true'">
91+
<PropertyGroup Condition="'$(IsTestProject)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true' and '$(OfficialBuildId)' == ''">
8592
<WithoutCategories>IgnoreForCI</WithoutCategories>
8693
<EnableDumpling>true</EnableDumpling>
8794
<CrashDumpFolder Condition="'$(RunningOnUnix)' != 'true'">%TMP%\CoreRunCrashDumps</CrashDumpFolder>
95+
</PropertyGroup>
96+
<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(OfficialBuildId)' == ''">
8897
<!-- Disable F5 and test explorer support for CI builds. -->
8998
<GenerateLaunchSettings>false</GenerateLaunchSettings>
9099
<IncludeVSTestReferences>false</IncludeVSTestReferences>
91100
</PropertyGroup>
92101

93-
<!-- Provides package dependency version properties and verification/auto-upgrade configuration -->
94-
<Import Project="$(MSBuildThisFileDirectory)dependencies.props" />
95-
96102
<!-- list of nuget package sources passed to nuget restore -->
97103
<!-- Example to consume local CoreCLR package:
98104
/p:OverridePackageSource=C:\coreclr\bin\Product\Windows_NT.x64.Debug\.nuget\pkg
@@ -118,6 +124,7 @@
118124
<ApiCompatExcludeAttributeList>$(MSBuildThisFileDirectory)tools-local/DefaultGenApiDocIds.txt</ApiCompatExcludeAttributeList>
119125
<!-- Build as portable by default -->
120126
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
127+
<Performance Condition="'$(Performance)' == ''">false</Performance>
121128
<!-- Used for launchSettings.json and runtime config files. -->
122129
<AppDesignerFolder>Properties</AppDesignerFolder>
123130
</PropertyGroup>
@@ -169,7 +176,7 @@
169176
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.5.0.0'">linux</_runtimeOS>
170177
<_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS>
171178
<ToolRuntimeRID>$(_runtimeOS)-x64</ToolRuntimeRID>
172-
179+
173180
<!-- There are no WebAssembly tools, so treat them as Windows -->
174181
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'WebAssembly'">win-x64</ToolRuntimeRID>
175182
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
@@ -269,6 +276,7 @@
269276
<Features>strict</Features>
270277
<WarningLevel>4</WarningLevel>
271278
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
279+
<Deterministic>false</Deterministic>
272280
</PropertyGroup>
273281

274282
<PropertyGroup Condition="'$(IsReferenceAssembly)' == 'true'">
@@ -284,9 +292,9 @@
284292

285293
<!-- Set up the default output and intermediate paths -->
286294
<PropertyGroup>
287-
<!--
288-
Microsoft.NET.TargetFrameworkInference.targets appends the TargetFramework.
289-
We do this manually and use the TargetGroup instead.
295+
<!--
296+
Microsoft.NET.TargetFrameworkInference.targets appends the TargetFramework.
297+
We do this manually and use the TargetGroup instead.
290298
-->
291299
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
292300

@@ -302,7 +310,7 @@
302310
<OutputPath Condition="'$(OutputPath)'==''">$(BaseOutputPath)$(OSPlatformConfig)/$(MSBuildProjectName)/$(TargetOutputRelPath)$(OutputPathSubfolder)</OutputPath>
303311

304312
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'==''">$(RootIntermediateOutputPath)$(OSPlatformConfig)/$(MSBuildProjectName)/</BaseIntermediateOutputPath>
305-
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)$(TargetOutputRelPath)</IntermediateOutputPath>
313+
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)$(TargetOutputRelPath)</IntermediateOutputPath>
306314

307315
<RuntimePath Condition="'$(RuntimePath)' == ''">$(BinDir)runtime/$(BuildConfiguration)/</RuntimePath>
308316
<ShimsTargetRuntimeRoot>$(BinDir)shimsTargetRuntime/</ShimsTargetRuntimeRoot>
@@ -382,7 +390,7 @@
382390
<!-- Don't run tests if we're building another platform's binaries on Windows -->
383391
<SkipTests Condition="'$(SkipTests)'=='' and ('$(OsEnvironment)'=='Windows_NT' and '$(TargetsWindows)'!='true' and '$(OSGroup)'!='AnyOS')">true</SkipTests>
384392

385-
<!--
393+
<!--
386394
Set these properties early as they are consumed by some test projects.
387395
TODO: Remove when https://github.com/dotnet/corefx/issues/32421 is fixed.
388396
-->

Directory.Build.targets

+1-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@
125125

126126
<Import Project="$(ToolsDir)/Build.Common.targets" Condition="Exists('$(ToolsDir)/Build.Common.targets')" />
127127

128-
<!-- Import Arcade targets -->
129-
<Import Project="$(PackagesDir)/$(MicrosoftDotNetGenApiPackage.ToLower())/$(MicrosoftDotNetGenApiPackageVersion)/build/$(MicrosoftDotNetGenApiPackage).targets" />
130-
<Import Project="$(PackagesDir)/$(MicrosoftDotNetGenFacadesPackage.ToLower())/$(MicrosoftDotNetGenFacadesPackageVersion)/build/$(MicrosoftDotNetGenFacadesPackage).targets" />
131-
<Import Project="$(PackagesDir)/$(MicrosoftDotNetApiCompatPackage.ToLower())/$(MicrosoftDotNetApiCompatPackageVersion)/build/$(MicrosoftDotNetApiCompatPackage).targets" />
128+
<Import Project="$(ProjectDir)artifacts\toolset\Common\Tools.proj.nuget.g.targets" Condition="Exists('$(ProjectDir)artifacts\toolset\Common\Tools.proj.nuget.g.targets')" />
132129

133130
<!-- permit a wrapping build system to contribute targets to this build -->
134131
<Import Condition="Exists('$(MSBuildThisFileDirectory)..\open.targets')" Project="$(MSBuildThisFileDirectory)..\open.targets" />

Documentation/building/code-coverage.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ You can navigate to this from your PR by clicking the "Details" link to the righ
4242

4343
You can perform code coverage runs locally on your own machine. Normally to build your entire CoreFX repo, from the root of your repo you'd run:
4444

45-
build
46-
build-tests
45+
build -includetests
4746

48-
To include code coverage in this run, augment the `build-tests` call with the `coverage` argument:
47+
To include code coverage in this run, augment the `build -includetests` call with the `coverage` argument:
4948

50-
build
51-
build-tests -coverage
49+
build -includetests -coverage
5250

5351
This will do the build and testing as with the normal ```build```, but it will run the tests using the OpenCover tool. A resulting index.htm file providing the results of the run will be available at:
5452

@@ -66,9 +64,9 @@ The results for this one library will then show up in the aforementioned index.h
6664

6765
cd src\System.Diagnostics.Debug\tests\
6866
dotnet msbuild /t:BuildAndTest /p:Coverage=true
69-
67+
7068
And then once the run completes:
71-
69+
7270
..\..\..\bin\tests\coverage\index.htm
7371

7472
## Code coverage with System.Private.CoreLib code
@@ -83,7 +81,7 @@ The build and test projects take care of copying assemblies and PDBs as needed f
8381

8482
Note: as of 10/2017 OpenCover, the default coverage tool, requires PDBs to be Windows PDBs - the needed conversions are automatically performed by coverage runs. You can determine if it is a Windows PDB by doing 'more System.Private.CoreLib.pdb', if it begins with 'Microsoft C/C++ MSF 7.00' it is a Windows PDB. If you need a Windows PDB the Pdb2Pdb tool will convert (or you can do a dotnet msbuild /t:rebuild /p:DebugType=full).
8583

86-
## Cross-platform Coverage
84+
## Cross-platform Coverage
8785
As of 07/2018 CoreFx is only able to get coverage information on Windows. To correct this we are experimenting with [coverlet](https://github.com/tonerdo/coverlet).
8886

8987
### Know Issues ###
@@ -95,7 +93,7 @@ On Windows by default coverage runs will use OpenCover instead of coverlet, use
9593

9694
```
9795
dotnet msbuild /t:RebuildAndTest /p:Coverage=True /p:UseCoverlet=True
98-
```
96+
```
9997

10098
### Unix Instructions ###
10199
On Unix just specifying `/p:Coverage=True` triggers the usage of coverlet. However, in order to generate the html report a few setup steps are needed.

Documentation/building/cross-building.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The managed components of CoreFX are architecture-independent and thus do not re
7878

7979
Many of the managed binaries are also OS-independent, e.g. System.Linq.dll, while some are OS-specific, e.g. System.IO.FileSystem.dll, with different builds for Windows and Linux.
8080

81-
lgs@ubuntu ~/git/corefx/ $ ./build-managed.sh -debug -verbose
81+
lgs@ubuntu ~/git/corefx/ $ ./build.sh -debug /p:BuildNative=false
8282

8383
The output is at `bin/[BuildConfiguration]` where `BuildConfiguration` looks something like `netcoreapp-<OSGroup>-Debug-<Architecture>`. Ex: `bin/netcoreapp-Linux-Debug-x64`. For more details on the build configurations see [project-guidelines](../coding-guidelines/project-guidelines.md)
8484

@@ -112,10 +112,10 @@ When building for a new architecture you will need to build the native pieces se
112112

113113
Example building for armel
114114
```
115-
build-native.sh -buildArch=armel
115+
src/Native/build-native.sh armel
116116
--> Output goes to bin/runtime/netcoreapp-Linux-Debug-armel
117117
118-
build-managed.sh -buildArch=x64
118+
build /p:ArchGroup=x64 /p:BuildNative=false
119119
--> Output goes to bin/runtime/netcoreapp-Linux-Debug-x64
120120
```
121121

Documentation/building/windows-instructions.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The following are the minimum requirements:
3838
* .NET Framework 4.6 Targeting Pack
3939
* Windows Universal CRT SDK
4040
* VC++ 2015.3 v140 Toolset (x86, x64)
41-
41+
4242
#### Visual Studio 2017 - Command line install
4343

4444
If you've installed Visual Studio 2017 already, go to `C:\Program Files (x86)\Microsoft Visual Studio\Installer` and run
@@ -56,7 +56,6 @@ For the best possible experience make sure to have the latest version of Visual
5656
From a (non-admin) Command Prompt window:
5757

5858
- `build.cmd` - Will cause basic tool initialization and build the default configuration for refs, libs, and packages.
59-
- `build-tests.cmd` - Will build and run tests for the default configuration.
6059

6160
For information on different configurations see [project-guidelines](../coding-guidelines/project-guidelines.md).
6261

Documentation/project-docs/developer-guide.md

+25-42
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ The CoreFX repo can be built from a regular, non-admin command prompt. The build
1919
Developer Workflow
2020
------------------
2121
The dev workflow describes the [development process](https://github.com/dotnet/buildtools/blob/master/Documentation/Dev-workflow.md) to follow. It is divided into specific tasks that are fast, transparent and easy to understand.
22-
The tasks are represented in scripts (cmd/sh) in the root of the repo:
23-
* clean - Cleans up the binary output and optionally the working directory (`-all`)
24-
* sync - Pulls down external dependencies needed to build (i.e. build tools, xunit, coreclr, etc)
25-
* build - Builds the shipping libraries in corefx.
26-
* build-tests - Builds and runs the corefx tests.
2722

2823
For more information about the different options that each task has, use the argument `-?` when calling the script. For example:
2924
```
@@ -44,36 +39,41 @@ The build configurations are generally defaulted based on where you are building
4439
- `-debug|-release` controls the optimization level the compilers use for the build. It defaults to `Debug`. (msbuild property `ConfigurationGroup`)
4540
- `-buildArch` identifies the architecture for the build. It defaults to `x64` but possible values include `x64`, `x86`, `arm`, or `arm64`. (msbuild property `ArchGroup`)
4641

47-
These options are common for build, build-managed, build-native, and build-tests scripts.
48-
4942
For more details on the build configurations see [project-guidelines](../coding-guidelines/project-guidelines.md#build-pivots).
5043

5144
**Note**: Before working on individual projects or test projects you **must** run `build` from the root once before beginning that work. It is also a good idea to run `build` whenever you pull a large set of unknown changes into your branch.
5245

53-
**Common full clean build and test run**
46+
The most common workflow for developers is to call `build` from the root once (preceeded by a `clean -all` if you have built previously) and then go and work on the individual library that you are trying to make changes for. On windows folks will usually open up the solution file in the root of that library directory and work in VS.
47+
48+
By default build only builds the product libraries and none of the tests if you want to build and run all the tests you can call `build -test` to build and run only the tests or `build -includetests` to build the project as well as the tests
49+
50+
**Examples**
51+
- Clean and build the product libraries
5452
```
5553
clean -all
5654
build
57-
build-tests
5855
```
5956

60-
**Examples**
61-
6257
- Building in debug mode for platform x64
6358
```
64-
build -debug -buildArch=x64
59+
build -debug /p:ArchGroup=x64
6560
```
6661

6762
- Building the src and then building and running the tests
6863
```
69-
build -tests
64+
build -includetests
7065
```
7166

7267
- Building for different target frameworks
7368
```
74-
build -framework=netcoreapp
75-
build -framework=netfx
76-
build -framework=uap
69+
build -framework netcoreapp
70+
build -framework netfx
71+
build -framework uap
72+
```
73+
74+
- Build only managed components and skip the native build
75+
```
76+
build /p:BuildNative=false
7777
```
7878

7979
### Build Native
@@ -87,50 +87,33 @@ The native component should be buildable on any system.
8787

8888
- Building in debug mode for platform x64
8989
```
90-
build-native -debug -buildArch=x64
90+
./src/Native/build-native debug x64
9191
```
9292

93-
- The following example shows the argument `--`. Everything that is after it is not going to be processed, and will be passed as-is.
93+
- The following example shows how you would do an arm cross-compile build.
9494
```
95-
build-native -debug -buildArch=arm -- cross verbose
95+
./src/Native/build-native debug arm cross verbose
9696
```
9797

9898
For more information about extra parameters take a look at the scripts `build-native` under src/Native.
9999

100-
### Build Managed
101-
Since the managed build uses the .NET Core CLI (which the build will download), managed components can only be built on a subset of distros.
102-
There are some additional prerequisites from the CLI which need to be installed. Both libicu and libunwind are used by CoreCLR to execute managed code, so they must be installed. Since CoreFX does not actually link against these packages, runtime versions are sufficient. We also require curl to be present, which we use to download the .NET Core CLI.
103-
104-
**Examples**
105-
106-
- Building in debug mode for platform x64
107-
```
108-
build-managed -debug -buildArch=x64
109-
```
110-
111-
- Building in debug mode for platform x64 targeting OS Linux
112-
```
113-
build-managed -debug -buildArch=x64 -os=Linux
114-
```
115-
116100
### Build And Run Tests
117-
To build the tests and run them you can call the build-test script. The same parameters you pass to build should also be passed to build-tests script to ensure you are building and running the tests on the same configuration you have build the product on. However to run tests on the same machine you need to ensure the machine supports the configuration you are building.
101+
To build the tests and run them you can call the build script passing -tests option. The same parameters you pass to build should also be passed to ensure you are building and running the tests on the same configuration you have build the product on. However to run tests on the same machine you need to ensure the machine supports the configuration you are building.
118102

119103
**Examples**
120-
- The following shows how to build tests but not run them
104+
- The following shows how to build only the tests but not run them
121105
```
122-
build-tests -skiptests
106+
build -test -skiptests
123107
```
124108

125109
- The following builds and runs all tests for netcoreapp in release configuration.
126110
```
127-
build-tests -release -framework=netcoreapp
111+
build -test -release -framework=netcoreapp
128112
```
129113

130-
- The following example shows the argument `--`. Everything that is after it is not going to be processed and it is going to be passed as it is.
131-
Use it to pass extra msbuild properties, in this case to ignore tests ignored in CI.
114+
- The following example shows how to pass extra msbuild properties to ignore tests ignored in CI.
132115
```
133-
build-tests -- /p:WithoutCategories=IgnoreForCI
116+
build -test /p:WithoutCategories=IgnoreForCI
134117
```
135118

136119
### Building individual libraries

DotnetCLIVersion.txt

-1
This file was deleted.

NuGet.config

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
</fallbackPackageFolders>
88
<packageSources>
99
<clear/>
10+
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
1011
</packageSources>
1112
</configuration>

build-managed.cmd

-2
This file was deleted.

build-managed.sh

-4
This file was deleted.

build-native.cmd

-2
This file was deleted.

build-native.sh

-5
This file was deleted.

build-packages.cmd

-2
This file was deleted.

0 commit comments

Comments
 (0)