Merge branch 'main' into CI-webs

This commit is contained in:
Jo Shields 2024-02-08 12:52:30 -05:00 committed by GitHub
commit 4b5fbb5e35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 104 additions and 24 deletions

View file

@ -11,12 +11,19 @@
This Codespace can help you debug the source build of .NET. This build takes about
45 minutes and, after completion, produces an archived .NET SDK located in
`/workspaces/dotnet/artifacts/x64/Release`. In case you selected the `prebuilt-sdk`
Codespace, the SDK will already be there.
Codespace, the built-from-source SDK will already be there.
## Build the SDK
To build the VMR, run following:
To build the repository, run one of the following:
```bash
# Microsoft based build
./build.sh
```
or
```bash
# Building from source only
./prep.sh && ./build.sh -sb
```

View file

@ -71,51 +71,72 @@ For the latest information about Source-Build support, please watch for announce
### Prerequisites
The dependencies for building .NET from source can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md).
The dependencies for building can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/).
In case you don't want to / cannot prepare your environment per the requirements, consider [using Docker](#building-using-docker).
### Building (source-build configuration)
### Building
1. **Clone the VMR**
1. **Clone the repository**
```bash
git clone https://github.com/dotnet/dotnet dotnet-dotnet
cd dotnet-dotnet
```
2. **Prep the source to build on your distro**
This downloads a .NET SDK and a number of .NET packages needed to build .NET from source.
2. **Build the .NET SDK**
```bash
cd dotnet-dotnet
./prep.sh
```
Choose one of the following build modes:
- **Microsoft based build**
3. **Build the .NET SDK**
For Unix:
```bash
./build.sh --clean-while-building
```
```bash
./build.sh -sb --clean-while-building
```
For Windows:
```cmd
.\build.cmd -cleanWhileBuilding
```
This builds the entire .NET SDK from source.
The resulting SDK is placed at `artifacts/x64/Release/dotnet-sdk-9.0.100-your-RID.tar.gz`.
- **Building from source**
```bash
# Prep the source to build on your distro.
# This downloads a .NET SDK and a number of .NET packages needed to build .NET from source.
./prep.sh
Run `./build.sh --help` to see more information about supported build options.
# Build the .NET SDK
./build.sh -sb --clean-while-building
```
The resulting SDK is placed at `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz` (for Unix) or `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].zip` (for Windows).
4. *(Optional)* **Unpack and install the .NET SDK**
For Unix:
```bash
mkdir -p $HOME/dotnet
tar zxf artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz -C $HOME/dotnet
ln -s $HOME/dotnet/dotnet /usr/bin/dotnet
```
For Windows:
```cmd
mkdir %userprofile%\dotnet
tar -xf artifacts/<arch>/Release/dotnet-sdk-9.0.100-[your RID].zip -C %userprofile%\dotnet
set "PATH=%userprofile%\dotnet;%PATH%"
```
To test your source-built SDK, run the following:
To test your built SDK, run the following:
```bash
dotnet --info
```
### Building using Docker (source-build configuration)
> [!NOTE]
> Run `./build.sh --help` (for Unix) or `.\build.cmd -help` (for Windows) to see more information about supported build options.
### Building using Docker
You can also build the repository using a Docker image which has the required prerequisites inside.
The example below creates a Docker volume named `vmr` and clones and builds the VMR there.
@ -123,7 +144,13 @@ The example below creates a Docker volume named `vmr` and clones and builds the
```sh
docker run --rm -it -v vmr:/vmr -w /vmr mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
git clone https://github.com/dotnet/dotnet .
# - Microsoft based build
./build.sh --clean-while-building
# - Building from source
./prep.sh && ./build.sh -sb --clean-while-building
mkdir -p $HOME/.dotnet
tar -zxf artifacts/x64/Release/dotnet-sdk-9.0.100-centos.8-x64.tar.gz -C $HOME/.dotnet
ln -s $HOME/.dotnet/dotnet /usr/bin/dotnet
@ -146,7 +173,7 @@ Alternatively, you can also provide a manifest file where this information can b
Sometimes you want to make a change in a repository and test that change in the VMR. You could of course make the change in the VMR directly (locally, as the VMR is read-only for now) but in case it's already available in your repository, you can synchronize it into the VMR (again locally).
To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) script to pull your changes in. Please refer to the documentation in the script for more details.
To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) or [eng/vmr-sync.ps1](../../eng/vmr-sync.ps1) script to pull your changes in. Please refer to the documentation in the script for more details.
## List of components

View file

@ -24,7 +24,6 @@
-->
<PrivateSourceBuiltSdkVersion>9.0.100-preview.2.24104.1</PrivateSourceBuiltSdkVersion>
<PrivateSourceBuiltArtifactsVersion>9.0.100-preview.2.24104.1</PrivateSourceBuiltArtifactsVersion>
<PrivateSourceBuiltPrebuiltsVersion>0.1.0-9.0.100-9</PrivateSourceBuiltPrebuiltsVersion>
<!-- msbuild -->
<MicrosoftBuildVersion>15.7.179</MicrosoftBuildVersion>
</PropertyGroup>

View file

@ -1,7 +1,6 @@
<Project>
<PropertyGroup>
<SkipErrorOnPrebuilts>true</SkipErrorOnPrebuilts>
<SmokeTestsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'test', 'Microsoft.DotNet.SourceBuild.SmokeTests'))</SmokeTestsDir>
</PropertyGroup>

View file

@ -0,0 +1,48 @@
From 6e36330872998c791a2c0d31b688e1bdece2451f Mon Sep 17 00:00:00 2001
From: Jo Shields <joshield@microsoft.com>
Date: Fri, 2 Feb 2024 06:56:20 -0500
Subject: [PATCH] Source built short stack support (#97725)
Backport: https://github.com/dotnet/runtime/pull/97725
--- a/eng/SourceBuild.props 2024-02-07 11:01:33.807337902 -0500
+++ b/eng/SourceBuild.props 2024-02-05 16:48:58.219933758 -0500
@@ -15,6 +15,7 @@
<!-- Split e.g. 'fedora.33-x64' into 'fedora.33' and 'x64'. -->
<_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-'))</_targetRidPlatformIndex>
<TargetArch>$(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-'))</TargetArch>
+ <TargetOS>$(TargetRid.Substring(0, $(_targetRidPlatformIndex)))</TargetOS>
<_hostRidPlatformIndex>$(_hostRid.LastIndexOf('-'))</_hostRidPlatformIndex>
<_hostArch>$(_hostRid.Substring($(_hostRidPlatformIndex)).TrimStart('-'))</_hostArch>
@@ -22,6 +23,17 @@
<LogVerbosity Condition="'$(LogVerbosity)' == ''">minimal</LogVerbosity>
</PropertyGroup>
+ <PropertyGroup Label="ShortStacks">
+ <ShortStack Condition="'$(TargetOS)' == 'wasi'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'browser'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'ios'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'iossimulator'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'tvos'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'tvossimulator'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'maccatalyst'">true</ShortStack>
+ <ShortStack Condition="'$(TargetOS)' == 'android'">true</ShortStack>
+ </PropertyGroup>
+
<Target Name="GetRuntimeSourceBuildCommandConfiguration"
BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
@@ -29,9 +41,10 @@
This allows to build the repository using './build.sh <args> /p:DotNetBuildFromSource=true'.
Properties that control flags from source-build, and the expected output for source-build should be added to this file. -->
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)arch $(TargetArch)</InnerBuildArgs>
- <InnerBuildArgs Condition=" '$(TargetArch)' != '$(_hostArch)' ">$(InnerBuildArgs) $(FlagParameterPrefix)cross</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)os $(TargetOS)</InnerBuildArgs>
+ <InnerBuildArgs Condition="'$(TargetArch)' != '$(_hostArch)' and '$(ShortStack)' != 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)cross</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)configuration $(Configuration)</InnerBuildArgs>
- <InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)allconfigurations</InnerBuildArgs>
+ <InnerBuildArgs Condition="'$(ShortStack)' != 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)allconfigurations</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)verbosity $(LogVerbosity)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</InnerBuildArgs>