Merge branch 'main' of https://github.com/dotnet/installer into darc-main-367919f1-b243-4e8f-9049-8e4c2a77722d

This commit is contained in:
Jason Zhai 2024-05-07 19:36:31 -07:00
commit e9046600ac
290 changed files with 37 additions and 24912 deletions

View file

@ -1,20 +1,9 @@
<Project>
<Choose>
<When Condition=" '$(InitializeVMR)' == 'true' ">
<!-- VMR bootstrap -->
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)src/VirtualMonoRepo/Tasks/VirtualMonoRepo.Tasks.csproj" BuildInParallel="false" />
<ProjectToBuild Include="$(RepoRoot)src/VirtualMonoRepo/InitializeVMR.proj" BuildInParallel="false" />
</ItemGroup>
</When>
<Otherwise>
<!-- Regular build -->
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)Microsoft.DotNet.Cli.sln" />
<ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64')"
Include="$(RepoRoot)src\finalizer\finalizer-build.csproj" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)Microsoft.DotNet.Cli.sln" />
<ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64')"
Include="$(RepoRoot)src\finalizer\finalizer-build.csproj" />
</ItemGroup>
</Project>

View file

@ -1,32 +0,0 @@
<!-- Whenever altering this or other Source Build files, please include @dotnet/source-build-internal as a reviewer. -->
<Project>
<PropertyGroup>
<GitHubRepositoryName>installer</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>
<Target Name="ConfigureInnerBuildArg" BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<InnerBuildArgs>$(InnerBuildArgs) /p:SkipBuildingInstallers=true</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:IncludeAdditionalSharedFrameworks=false</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:DISABLE_CROSSGEN=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(PgoInstrument)' == 'true'">$(InnerBuildArgs) /p:PgoInstrument=true</InnerBuildArgs>
</PropertyGroup>
</Target>
<!-- This should be resolved/removed with https://github.com/dotnet/source-build/issues/4101 -->
<Target Name="AddInstallers"
BeforeTargets="GetCategorizedIntermediateNupkgContents">
<ItemGroup Condition="'$(DotNetBuildOrchestrator)' == 'true'">
<!-- Include installers when in product VMR builds. These are not necessary when building the repo-only build as we don't
need them in downstream source-only PR legs. We could include them, but it may bump us over the package size limit. -->
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\*.msi" />
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\*.deb" />
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\*.rpm" />
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\*.pkg" />
</ItemGroup>
</Target>
</Project>

View file

@ -1,15 +0,0 @@
<!-- Whenever altering this or other Source Build files, please include @dotnet/source-build-internal as a reviewer. -->
<!-- See aka.ms/dotnet/prebuilts for guidance on what pre-builts are and how to eliminate them. -->
<UsageData>
<IgnorePatterns>
<!--
Temporary exclusion for NuGet packages, since NuGet is not producing source-build intermediate package,
see: https://github.com/NuGet/Home/issues/11059
-->
<UsagePattern IdentityGlob="NuGet.*/*" />
<!-- These are coming in via runtime but the source-build infra isn't able to automatically pick up the right intermediate. -->
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Crossgen2.linux-x64/*9.0.*" />
</IgnorePatterns>
</UsageData>

View file

@ -1,9 +1,5 @@
<Dependencies>
<ProductDependencies>
<!--
Source-build uses transitive dependency resolution to determine correct build SHA of all product contributing repos.
The order of dependencies is important and should not be modified without approval from dotnet/source-build-internal.
-->
<Dependency Name="Microsoft.WindowsDesktop.App.Ref" Version="9.0.0-preview.5.24256.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/windowsdesktop</Uri>
<Sha>436e9a8e566984a5ffe5f022de266f18d9aa9c4b</Sha>
@ -50,12 +46,6 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>84b33395057737db3ea342a5151feb6b90c1b6f6</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.runtime.linux-x64" Version="9.0.0-preview.5.24256.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>84b33395057737db3ea342a5151feb6b90c1b6f6</Sha>
<SourceBuild RepoName="runtime" ManagedOnly="false" />
</Dependency>
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="9.0.0-preview.5.24256.2" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>da3aa27233a2cec2f6780884f71934b2f5e686ce</Sha>
@ -84,12 +74,6 @@
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>da3aa27233a2cec2f6780884f71934b2f5e686ce</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.aspnetcore" Version="9.0.0-preview.5.24256.2" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>da3aa27233a2cec2f6780884f71934b2f5e686ce</Sha>
<SourceBuild RepoName="aspnetcore" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Common.ItemTemplates" Version="9.0.100-preview.5.24256.14">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>a1863f126667b4fdcd37b451b4cd3c10abf19e10</Sha>
@ -106,12 +90,6 @@
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>a1863f126667b4fdcd37b451b4cd3c10abf19e10</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.sdk" Version="9.0.100-preview.5.24256.14">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>a1863f126667b4fdcd37b451b4cd3c10abf19e10</Sha>
<SourceBuild RepoName="sdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Test.ProjectTemplates.2.1" Version="1.0.2-beta4.22406.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/test-templates</Uri>
<Sha>0385265f4d0b6413d64aea0223172366a9b9858c</Sha>
@ -136,12 +114,6 @@
<Uri>https://github.com/dotnet/test-templates</Uri>
<Sha>36e4339a33f9bdf3680591e2a3fcbc421aabc22c</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.test-templates" Version="1.1.0-rc.24252.2" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/test-templates</Uri>
<Sha>36e4339a33f9bdf3680591e2a3fcbc421aabc22c</Sha>
<SourceBuild RepoName="test-templates" ManagedOnly="true" />
</Dependency>
<!-- For coherency purposes, these versions should be gated by the versions of winforms and wpf routed via windowsdesktop -->
<Dependency Name="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="9.0.0-preview.5.24253.4" CoherentParentDependency="Microsoft.WindowsDesktop.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/winforms</Uri>
@ -155,22 +127,10 @@
<Uri>https://github.com/dotnet/fsharp</Uri>
<Sha>3ef1cb25ffb292b5c87f9604d1a09b032277bf76</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.fsharp" Version="8.0.400-beta.24229.4" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/fsharp</Uri>
<Sha>3ef1cb25ffb292b5c87f9604d1a09b032277bf76</Sha>
<SourceBuild RepoName="fsharp" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.NET.Test.Sdk" Version="17.11.0-preview-24253-02" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/microsoft/vstest</Uri>
<Sha>b521aa2c9c981f53b85af7c923175a850986173a</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.vstest" Version="17.11.0-preview-24253-02" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/microsoft/vstest</Uri>
<Sha>b521aa2c9c981f53b85af7c923175a850986173a</Sha>
<SourceBuild RepoName="vstest" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.5.24256.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>84b33395057737db3ea342a5151feb6b90c1b6f6</Sha>
@ -179,63 +139,26 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>062ad3db597a8096b5da2b188dbbbcc7f6137275</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-2.24255.2" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>062ad3db597a8096b5da2b188dbbbcc7f6137275</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Build" Version="17.11.0-preview-24256-01" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>66dcc32c3344eb76a422917dcb8c9e8f621e18fd</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.msbuild" Version="17.11.0-preview-24256-01" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>66dcc32c3344eb76a422917dcb8c9e8f621e18fd</Sha>
<SourceBuild RepoName="msbuild" ManagedOnly="true" />
</Dependency>
<Dependency Name="NuGet.Build.Tasks" Version="6.11.0-preview.1.35" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/nuget/nuget.client</Uri>
<Sha>12d5c661b77d4933f82a293008c0d56d1d6ce32b</Sha>
<SourceBuildTarball RepoName="nuget-client" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-preview.5.24223.2" CoherentParentDependency="Microsoft.NETCore.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>53288f87c588907e8ff01f129786820fe998573c</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.emsdk" Version="9.0.0-preview.5.24223.2" CoherentParentDependency="Microsoft.NETCore.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>53288f87c588907e8ff01f129786820fe998573c</Sha>
<SourceBuild RepoName="emsdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Deployment.DotNet.Releases" Version="2.0.0-preview.1.24176.3" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/deployment-tools</Uri>
<Sha>6b80783f6743ee9f18940eb6acb7135e5c111d4b</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.deployment-tools" Version="9.0.0-preview.1.24176.3" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/deployment-tools</Uri>
<Sha>6b80783f6743ee9f18940eb6acb7135e5c111d4b</Sha>
<SourceBuild RepoName="deployment-tools" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="9.0.0-alpha.1.24229.1">
<Uri>https://github.com/dotnet/source-build-externals</Uri>
<Sha>b02769661c9a51985877819e8bdebfbcbee65710</Sha>
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.24209.3" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>963d34b1fb712c673bfb198133d7e988182c9ef4</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.520903" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>963d34b1fb712c673bfb198133d7e988182c9ef4</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.24256.2">
@ -262,31 +185,14 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>9fc042c22b0e538c7f1b412127b265ca2fc77334</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24256.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>9fc042c22b0e538c7f1b412127b265ca2fc77334</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="9.0.0-alpha.1.23612.13">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>ab1a8224cdf115b65e0db5dc88d11f205068f444</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24252.1">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>9c1cc994f8123ec2a923c5179c238c13da1b4ab7</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ScenarioTests.SdkTemplateTests" Version="9.0.0-preview.24222.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/scenario-tests</Uri>
<Sha>4ab07002cb46cf169c85a09a546709a20642c65b</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.scenario-tests" Version="9.0.0-preview.24222.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/scenario-tests</Uri>
<Sha>4ab07002cb46cf169c85a09a546709a20642c65b</Sha>
<SourceBuild RepoName="scenario-tests" ManagedOnly="true" />
</Dependency>
<!-- Aspire isn't really a toolset dependency. However, it only inserts a baseline manifest in installer,
and if you squint at it, this means we can say that its specific dependency versions don't matter to installer.
Avoiding this as a product dependency avoids a long coherency path (aspnetcore->extensions->aspire->installer).
@ -298,11 +204,5 @@
<Uri>https://github.com/dotnet/aspire</Uri>
<Sha>0514ea9e12ece4dd764824ce925ae0eae6fcbd86</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.aspire" Version="9.0.0-preview.4.24229.9" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/aspire</Uri>
<Sha>0514ea9e12ece4dd764824ce925ae0eae6fcbd86</Sha>
<SourceBuild RepoName="aspire" ManagedOnly="true" />
</Dependency>
</ToolsetDependencies>
</Dependencies>

View file

@ -1,25 +0,0 @@
#!/bin/bash
set -euo pipefail
# Install instructions: https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-as-a-library-via-pip
# See latest release at https://github.com/nexB/scancode-toolkit/releases
SCANCODE_VERSION="32.1.0"
pyEnvPath="/tmp/scancode-env"
python3 -m venv $pyEnvPath
source $pyEnvPath/bin/activate
pip install scancode-toolkit==$SCANCODE_VERSION
deactivate
# Setup a script which executes scancode in the virtual environment
cat > /usr/local/bin/scancode << EOF
#!/bin/bash
set -euo pipefail
source $pyEnvPath/bin/activate
scancode "\$@"
deactivate
EOF
chmod +x /usr/local/bin/scancode

View file

@ -1,542 +0,0 @@
### This job builds https://github.com/dotnet/dotnet with given parameters
### If run in an installer PR, new changes are applied to a local copy of the VMR, then it is built and tested
parameters:
- name: architecture
type: string
- name: artifactsRid
type: string
default: ''
- name: buildName
type: string
- name: container
type: string
default: ''
- name: crossRootFs
type: string
default: ''
- name: pool
type: object
- name: targetOS
type: string
default: ''
- name: targetArchitecture
type: string
default: ''
- name: useMonoRuntime
displayName: True when build output uses the mono runtime
type: boolean
default: false
- name: useDevVersions
displayName: True when build output uses dev/CI versioning instead of official build versioning
type: boolean
default: false
#### SOURCE-ONLY parameters ####
# Instead of building the VMR directly, exports the sources into a tarball and builds from that
- name: buildFromArchive
type: boolean
default: false
# Enable for source-building the VMR
- name: buildSourceOnly
type: boolean
default: false
- name: enablePoison
type: boolean
default: false
- name: excludeOmniSharpTests
type: boolean
default: false
# Name of a previous job (from the same template as this) whose output will be used to build this job
# The SDK from its artifacts is copied to $(sourcesPath)/.dotnet
- name: reuseBuildArtifactsFrom
type: string
default: ''
# Allow downloading artifacts from the internet during the build
- name: runOnline
type: boolean
default: true
- name: runTests
type: boolean
default: true
# Freeform field for extra values to pass to build.sh for special build modes
- name: extraProperties
type: string
default: ''
# Use the previous version's SDK to build the current one
- name: withPreviousSDK
type: boolean
default: false
#### INSTALLER parameters ####
- name: isBuiltFromVmr
displayName: True when build is running from dotnet/dotnet directly
type: boolean
- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
jobs:
- job: ${{ parameters.buildName }}_${{ parameters.architecture }}
pool: ${{ parameters.pool }}
# Currently, CodeQL slows the build down too much
# https://github.com/dotnet/source-build/issues/4276
${{ if and(parameters.isBuiltFromVmr, startswith(parameters.buildName, 'Windows'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
timeoutInMinutes: 720
${{ else }}:
timeoutInMinutes: 240
${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
# Always attempt to run the bootstrap leg (e.g. even when stage 1 tests fail) in order to get a complete accessment of the build status.
# The build shortcuts when stage 1 build fails and doesn't produce the SDK.
condition: succeededOrFailed()
dependsOn: ${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}
variables:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
- ${{ if and(not(parameters.isBuiltFromVmr), eq(variables['System.TeamProject'], 'internal'), not(startswith(parameters.vmrBranch, 'internal/release/')), ne(variables['Build.Reason'], 'PullRequest')) }}:
- group: DotNetBot-GitHub
- ${{ else }}:
- name: BotAccount-dotnet-bot-repo-PAT
value: N/A
- name: additionalBuildArgs
value: ''
- ${{ if parameters.isBuiltFromVmr }}:
- name: vmrPath
value: $(Build.SourcesDirectory)
- ${{ else }}:
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
# Location of the VMR sources
# We either build the repo directly, or we extract them outside (which is what partners do)
- ${{ if parameters.buildFromArchive }}:
- name: sourcesPath
value: $(Build.StagingDirectory)/dotnet-sources/
- ${{ else }}:
- name: sourcesPath
value: $(vmrPath)
templateContext:
outputs:
- output: pipelineArtifact
displayName: Publish BuildLogs
condition: succeededOrFailed()
targetPath: $(Build.StagingDirectory)/BuildLogs
artifactName: $(Agent.JobName)_BuildLogs_Attempt$(System.JobAttempt)
- output: pipelineArtifact
path: $(Build.ArtifactStagingDirectory)/publishing
artifact: $(Agent.JobName)_Artifacts
displayName: Publish Artifacts
condition: always()
- ${{ if not(parameters.isBuiltFromVmr) }}:
- output: pipelineArtifact
displayName: Upload failed patches
condition: failed()
targetPath: $(Agent.TempDirectory)
artifactName: $(System.JobDisplayName)_FailedPatches
steps:
- ${{ if not(parameters.isBuiltFromVmr) }}:
- template: ../steps/vmr-prepare.yml@self
parameters:
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
vmrBranch: $(System.PullRequest.TargetBranch)
${{ else }}:
vmrBranch: ${{ parameters.vmrBranch }}
# Synchronize new content in the VMR during PRs (we expect this to come
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: ../steps/vmr-pull-updates.yml@self
parameters:
vmrPath: $(vmrPath)
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: $(Build.SourceVersion) # Synchronize the current installer commit
- ${{ if parameters.buildFromArchive }}:
- script: |
set -ex
cp -r "$(vmrPath)" "$(sourcesPath)"
rm -rf "$(sourcesPath)/.git"
displayName: Export VMR sources
workingDirectory: $(Build.StagingDirectory)
- ${{ if ne(parameters.reuseBuildArtifactsFrom, '') }}:
- download: current
artifact: ${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}_Artifacts
patterns: |
**/Private.SourceBuilt.Artifacts.*.tar.gz
**/dotnet-sdk-*.tar.gz
displayName: Download Previous Build
- task: CopyFiles@2
displayName: Copy Previous Build
inputs:
SourceFolder: $(Pipeline.Workspace)/${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}_Artifacts/assets/Release
Contents: '*.tar.gz'
TargetFolder: $(sourcesPath)/prereqs/packages/archive/
- ${{ if eq(parameters.withPreviousSDK, 'true') }}:
- script: |
set -euo pipefail
if [[ '${{ parameters.artifactsRid }}' == '' ]]; then
echo "'artifactsRid' is not specified. Cannot download source-built SDK."
exit 1
fi
packageVersionsPath="$(sourcesPath)/eng/Versions.props"
notFoundMessage="No source-built SDK found to download..."
echo "Looking for source-built SDK to download..."
archiveVersionLine=$(grep -m 1 "<PrivateSourceBuiltSdkVersion>" "$packageVersionsPath" || :)
versionPattern="<PrivateSourceBuiltSdkVersion>(.*)</PrivateSourceBuiltSdkVersion>"
if [[ $archiveVersionLine =~ $versionPattern ]]; then
archiveVersion="${BASH_REMATCH[1]}"
archiveUrl="https://dotnetcli.azureedge.net/source-built-artifacts/sdks/dotnet-sdk-$archiveVersion-${{ parameters.artifactsRid }}.tar.gz"
downloadDir="$(sourcesPath)/prereqs/packages/archive/"
echo "Downloading source-built SDK from $archiveUrl..."
(cd "$downloadDir" && curl --retry 5 -O "$archiveUrl")
else
echo "$notFoundMessage"
exit 1
fi
displayName: Setup Previously Source-Built SDK
- ${{ if eq(parameters.targetOS, 'windows') }}:
# Node 20.x is a toolset dependency to build aspnetcore
# Keep in sync with aspnetcore: https://github.com/dotnet/aspnetcore/blob/7d5309210d8f7bae8fa074da495e9d009d67f1b4/.azure/pipelines/ci.yml#L719-L722
- task: NodeTool@0
displayName: Install Node 20.x
inputs:
versionSpec: 20.x
- script: |
call $(sourcesPath)\build.cmd -ci -cleanWhileBuilding -prepareMachine %devArgument% /p:TargetOS=${{ parameters.targetOS }} /p:TargetArchitecture=${{ parameters.targetArchitecture }} ${{ parameters.extraProperties }}
displayName: Build
env:
${{ if eq(parameters.useDevVersions, 'True') }}:
devArgument: -dev
${{ else }}:
devArgument: ''
- ${{ if eq(parameters.runTests, 'True') }}:
- script: |
call $(sourcesPath)\build.cmd -ci -prepareMachine -test /bl:artifacts/log/Release/Test.binlog /p:TargetOS=${{ parameters.targetOS }} /p:TargetArchitecture=${{ parameters.targetArchitecture }} ${{ parameters.extraProperties }}
displayName: Run Tests
- ${{ else }}:
- ${{ if eq(parameters.buildSourceOnly, 'true') }}:
- script: |
set -ex
customPrepArgs=""
prepSdk=true
if [[ -n '${{ parameters.artifactsRid }}' ]]; then
customPrepArgs="${customPrepArgs} --artifacts-rid ${{ parameters.artifactsRid }}"
fi
if [[ '${{ parameters.withPreviousSDK }}' == 'True' ]]; then
# Source-built artifacts are from CentOS 8 Stream or Alpine 3.19. We want to download them without
# downloading portable versions from the internet.
customPrepArgs="${customPrepArgs} --no-sdk --no-bootstrap"
prepSdk=false
elif [[ -n '${{ parameters.reuseBuildArtifactsFrom }}' ]]; then
customPrepArgs="${customPrepArgs} --no-sdk --no-artifacts"
prepSdk=false
fi
if [[ "$prepSdk" == "false" ]]; then
mkdir $(sourcesPath)/.dotnet
previousSdkPath="$(sourcesPath)/prereqs/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$previousSdkPath" -C "$(sourcesPath)/.dotnet"
eval rm -f "$previousSdkPath"
echo "##vso[task.setvariable variable=additionalBuildArgs]--with-sdk /vmr/.dotnet"
fi
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep-source-build.sh $customPrepArgs
displayName: Prep the Build
- script: |
set -ex
df -h
customEnvVars=""
customBuildArgs="--ci --clean-while-building --prepareMachine"
if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --online"
fi
if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --poison"
fi
if [[ '${{ parameters.buildFromArchive }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-repository https://github.com/dotnet/dotnet"
customBuildArgs="$customBuildArgs --source-version $(git -C "$(vmrPath)" rev-parse HEAD)"
fi
if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --source-only"
fi
if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --use-mono-runtime"
fi
if [[ '${{ parameters.useDevVersions }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --dev"
fi
if [[ -n "${{ parameters.crossRootFs }}" ]]; then
customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
if [[ '${{ parameters.targetArchitecture }}' != 'wasm' ]]; then
extraBuildProperties="$extraBuildProperties /p:CrossBuild=true"
fi
fi
if [[ ! -z '${{ parameters.targetOS }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetOS=${{ parameters.targetOS }}"
fi
if [[ ! -z '${{ parameters.targetArchitecture }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetArchitecture=${{ parameters.targetArchitecture }}"
fi
if [[ -n "${{ parameters.extraProperties }}" ]]; then
extraBuildProperties="$extraBuildProperties ${{ parameters.extraProperties }}"
fi
buildArgs="$(additionalBuildArgs) $customBuildArgs $extraBuildProperties"
# Only use Docker when a container is specified
if [[ -n "${{ parameters.container }}" ]]; then
# Allows Arcade to have access to the commit for the build, pass it through to the container
customEnvVars="$customEnvVars BUILD_SOURCEVERSION=$BUILD_SOURCEVERSION"
customEnvVars="$customEnvVars BUILD_BUILDNUMBER=$(Build.BuildNumber)"
customDockerRunArgs=""
for envVar in $customEnvVars; do
customDockerRunArgs="$customDockerRunArgs -e $envVar"
done
if [[ '${{ parameters.runOnline }}' == 'False' ]]; then
customDockerRunArgs="$customDockerRunArgs --network none"
fi
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr $customDockerRunArgs ${{ parameters.container }} ./build.sh $buildArgs
else
for envVar in $customEnvVars; do
customEnvVarsWithBashSyntax="$customEnvVarsWithBashSyntax export $envVar;"
done
cd $(sourcesPath)
eval $customEnvVarsWithBashSyntax
./build.sh $buildArgs
fi
displayName: Build
# Only run tests if enabled
# TODO: Remove the PullRequest condition after the next re-bootstrap: https://github.com/dotnet/source-build/issues/4362
- ${{ if eq(parameters.runTests, 'True') }}:
- script: |
set -ex
dockerVolumeArgs="-v $(sourcesPath):/vmr"
customBuildArgs=''
extraBuildProperties=''
if [[ ! -z '${{ parameters.targetOS }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetOS=${{ parameters.targetOS }}"
fi
if [[ ! -z '${{ parameters.targetArchitecture }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetArchitecture=${{ parameters.targetArchitecture }}"
fi
if [[ '${{ parameters.useDevVersions }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --dev"
fi
if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
customBuildArgs="$customBuildArgs --poison"
fi
customBuildArgs="$customBuildArgs --source-only /p:SmokeTestsWarnOnSdkContentDiffs=true /p:SmokeTestsExcludeOmniSharpTests=${{ parameters.excludeOmniSharpTests }}"
fi
if [[ -n "${{ parameters.extraProperties }}" ]]; then
extraBuildProperties="$extraBuildProperties ${{ parameters.extraProperties }}"
fi
# Only use Docker when a container is specified
if [[ -n "${{ parameters.container }}" ]]; then
docker run --rm $dockerVolumeArgs -w /vmr ${{ parameters.container }} ./build.sh /bl:artifacts/log/Release/Test.binlog --test $customBuildArgs $extraBuildProperties $(additionalBuildArgs)
else
cd $(sourcesPath)
./build.sh /bl:artifacts/log/Release/Test.binlog --test $customBuildArgs $extraBuildProperties $(additionalBuildArgs)
fi
displayName: Run Tests
- ${{ if eq(parameters.targetOS, 'windows') }}:
# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.
- powershell: |
function CopyWithRelativeFolders($sourcePath, $targetFolder, $filter) {
Get-ChildItem -Path $sourcePath -Filter $filter -Recurse | ForEach-Object {
$targetPath = Join-Path $targetFolder (Resolve-Path -Relative $_.FullName)
New-Item -ItemType Directory -Path (Split-Path -Parent $targetPath) -Force | Out-Null
Copy-Item $_.FullName -Destination $targetPath -Force
}
}
$targetFolder = "$(Build.StagingDirectory)/BuildLogs/"
New-Item -ItemType Directory -Path $targetFolder -Force | Out-Null
cd "$(sourcesPath)"
CopyWithRelativeFolders "artifacts/log/" $targetFolder "*.binlog"
CopyWithRelativeFolders "artifacts/log/" $targetFolder "*.log"
CopyWithRelativeFolders "src/" $targetFolder "*.binlog"
CopyWithRelativeFolders "src/" $targetFolder "*.log"
if (Test-Path "artifacts/scenario-tests/") {
CopyWithRelativeFolders "artifacts/scenario-tests/" $targetFolder "*.binlog"
}
if (Test-Path "artifacts/TestResults/*") {
CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "*.binlog"
CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "*.diff"
CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "Updated*.txt"
CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "*.trx"
}
# check if we have assets to publish
if (Test-Path "artifacts/assets/Release/*") {
echo "##vso[task.setvariable variable=hasAssets]true"
}
displayName: Prepare BuildLogs staging directory and check assets
continueOnError: true
condition: succeededOrFailed()
- ${{ else }}:
# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.
- script: |
set -x
targetFolder=$(Build.StagingDirectory)/BuildLogs/
mkdir -p ${targetFolder}
cd "$(sourcesPath)"
find artifacts/log/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \;
find artifacts/log/ -type f -name "*.log" -exec rsync -R {} -t ${targetFolder} \;
[ -d "artifacts/scenario-tests/" ] && find artifacts/scenario-tests/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \;
find artifacts/TestResults/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \;
find artifacts/TestResults/ -type f -name "*.diff" -exec rsync -R {} -t ${targetFolder} \;
find artifacts/TestResults/ -type f -name "Updated*.txt" -exec rsync -R {} -t ${targetFolder} \;
find artifacts/TestResults/ -type f -name "*.trx" -exec rsync -R {} -t ${targetFolder} \;
if [[ "${{ parameters.buildSourceOnly }}" == "True" ]]; then
find artifacts/prebuilt-report/ -exec rsync -R {} -t ${targetFolder} \;
find artifacts/log/binary-report/ -exec rsync -R {} -t ${targetFolder} \;
fi
find src/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \;
find src/ -type f -name "*.log" -exec rsync -R {} -t ${targetFolder} \;
# check if we have assets to publish
if [ -n "$(ls -A 'artifacts/assets/Release/')" ]; then
echo "##vso[task.setvariable variable=hasAssets]true"
fi
displayName: Prepare BuildLogs staging directory and check assets
continueOnError: true
condition: succeededOrFailed()
- ${{ if or(ne(variables['System.TeamProject'], 'internal'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- publish: $(Build.StagingDirectory)/BuildLogs
artifact: $(Agent.JobName)_BuildLogs_Attempt$(System.JobAttempt)
displayName: Publish BuildLogs
continueOnError: true
condition: always()
# Only upload test results if enabled
- ${{ if eq(parameters.runTests, 'True') }}:
- task: PublishTestResults@2
displayName: Publish Test Results
condition: succeededOrFailed()
continueOnError: true
inputs:
testRunner: VSTest
testResultsFiles: 'artifacts/TestResults/Release/*.trx'
searchFolder: $(sourcesPath)
mergeTestResults: true
publishRunAttachments: true
testRunTitle: Tests_$(Agent.JobName)
- task: PublishTestResults@2
displayName: Publish Scenario Test Results
condition: succeededOrFailed()
continueOnError: true
inputs:
testRunner: xUnit
testResultsFiles: 'artifacts/TestResults/**/scenario-tests/*.xml'
searchFolder: $(sourcesPath)
mergeTestResults: true
publishRunAttachments: true
testRunTitle: ScenarioTests_$(Agent.JobName)
- task: CopyFiles@2
inputs:
SourceFolder: $(sourcesPath)/artifacts
Contents: |
VerticalManifest.xml
assets/**
TargetFolder: $(Build.ArtifactStagingDirectory)/publishing
displayName: Copy artifacts to Artifact Staging Directory
condition: succeededOrFailed()
# When building from source, the Private.SourceBuilt.Artifacts archive already contains the nuget packages
- ${{ if ne(parameters.buildSourceOnly, 'true') }}:
- task: CopyFiles@2
inputs:
SourceFolder: $(sourcesPath)/artifacts/packages
TargetFolder: $(Build.ArtifactStagingDirectory)/publishing/packages
displayName: Copy packages to Artifact Staging Directory
condition: succeededOrFailed()
- ${{ if or(ne(variables['System.TeamProject'], 'internal'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- publish: $(Build.ArtifactStagingDirectory)/publishing
artifact: $(Agent.JobName)_Artifacts
displayName: Publish Artifacts
condition: succeededOrFailed()
continueOnError: true

View file

@ -1,89 +0,0 @@
### This job synchronizes code from product repositories into the VMR (https://github.com/dotnet/dotnet)
### It synchronizes the content of the VMR to this new commit and pushes the changes
parameters:
- name: targetRef
displayName: Target revision of dotnet/installer to synchronize
type: string
default: $(Build.SourceVersion)
- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
default: $(Build.SourceBranch)
- name: noPush
displayName: Don't push changes to dotnet/dotnet
type: boolean
default: false
jobs:
- job: Synchronize_VMR
displayName: Synchronize VMR's ${{ parameters.vmrBranch }}
timeoutInMinutes: 120
variables:
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- template: /eng/common/templates/variables/pool-providers.yml
- ${{ else }}:
- template: /eng/common/templates-official/variables/pool-providers.yml
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
- ${{ if not(parameters.noPush) }}:
- ${{ if and( eq(variables['System.TeamProject'], 'internal'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}:
- group: DotNetBot-GitHub
- group: DotNetBot-GitHub-No-Scopes
- name: vmrPublicUrl
value: https://github.com/dotnet/dotnet
- ${{ if and( eq(variables['System.TeamProject'], 'internal'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/')) }}:
# https://dev.azure.com/dnceng/internal/_library?itemType=VariableGroups&view=VariableGroupView&variableGroupId=172&path=DotNetBot-AzDO-PAT
- group: DotNetBot-AzDO-PAT
- name: vmrInternalUrl
value: https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-dotnet
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
image: 1es-ubuntu-2004-open
os: linux
${{ else }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-ubuntu-2004
os: linux
steps:
- template: ../steps/vmr-prepare.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
- template: ../steps/vmr-pull-updates.yml
parameters:
vmrPath: $(vmrPath)
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: ${{ parameters.targetRef }}
- ${{ if and(not(parameters.noPush), not(in(variables['Build.Reason'], 'PullRequest')), eq(variables['System.TeamProject'], 'internal')) }}:
# Push main and release branches to the public VMR
- ${{ if or(eq(parameters.vmrBranch, 'main'), startsWith(parameters.vmrBranch, 'release/')) }}:
- script: >
./.dotnet/dotnet darc vmr push
--vmr '$(vmrPath)'
--commit-verification-pat '$(BotAccount-dotnet-maestro-bot-no-scopes-PAT)'
--branch '${{ parameters.vmrBranch }}'
--remote-url '$(vmrPublicUrl)'
--github-pat '$(BotAccount-dotnet-bot-repo-PAT)'
--verbose
displayName: Push changes to dotnet/dotnet (public)
workingDirectory: $(Agent.BuildDirectory)/installer
# Push internal/release branches to the internal VMR
- ${{ if startsWith(parameters.vmrBranch, 'internal/release/') }}:
- script: >
./.dotnet/dotnet darc vmr push
--vmr '$(vmrPath)'
--skip-commit-verification
--branch '${{ parameters.vmrBranch }}'
--remote-url '$(vmrInternalUrl)'
--azdev-pat '$(dn-bot-dnceng-build-rw-code-rw)'
--verbose
displayName: Push changes to dotnet-dotnet (internal)
workingDirectory: $(Agent.BuildDirectory)/installer

File diff suppressed because it is too large Load diff

View file

@ -1,18 +0,0 @@
### These steps clone the VMR (https://github.com/dotnet/dotnet) into $(Agent.BuildDirectory)/vmr for installer
parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
steps:
- checkout: vmr
displayName: Clone dotnet/dotnet
path: vmr
clean: true
- script: |
git checkout --track origin/${{ parameters.vmrBranch }}
echo "##vso[task.setvariable variable=vmrBranch]${{ parameters.vmrBranch }}"
displayName: Check out ${{ parameters.vmrBranch }}
workingDirectory: $(Agent.BuildDirectory)/vmr

View file

@ -1,99 +0,0 @@
### These steps synchronize new code from product repositories into the VMR (https://github.com/dotnet/dotnet).
### They initialize the darc CLI and pull the new updates.
### Changes are applied locally onto the already cloned VMR (located in $vmrPath).
parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
- name: targetRef
displayName: Target revision in dotnet/installer to synchronize
type: string
default: $(Build.SourceVersion)
- name: vmrPath
displayName: Path where the dotnet/dotnet is checked out to
type: string
default: $(Agent.BuildDirectory)/vmr
steps:
- checkout: self
displayName: Clone dotnet/installer
path: installer
# This step is needed so that when we get a detached HEAD / shallow clone,
# we still pull the commit into the temporary installer clone to use it during the sync.
- script: |
git branch installer-head
git rev-parse HEAD
displayName: Label PR commit
workingDirectory: $(Agent.BuildDirectory)/installer
- script: |
git checkout -B ${{ parameters.vmrBranch }}
echo "##vso[task.setvariable variable=vmrBranch]${{ parameters.vmrBranch }}"
displayName: Prepare branch ${{ parameters.vmrBranch }}
workingDirectory: ${{ parameters.vmrPath }}
- script: |
git config --global user.name "dotnet-maestro[bot]"
git config --global user.email "dotnet-maestro[bot]@users.noreply.github.com"
displayName: Set git author to dotnet-maestro[bot]
workingDirectory: ${{ parameters.vmrPath }}
- script: |
echo '**/*' > .artifactignore
echo '!./*.patch' >> .artifactignore
displayName: Prepare .artifactignore
workingDirectory: $(Agent.TempDirectory)
- script: >
./eng/vmr-sync.sh
--vmr ${{ parameters.vmrPath }}
--tmp $(Agent.TempDirectory)
--azdev-pat '$(dn-bot-all-orgs-code-r)'
--branch ${{ parameters.vmrBranch }}
--repository "installer:${{ parameters.targetRef }}"
--recursive
--remote "installer:$(Agent.BuildDirectory)/installer"
--component-template $(Agent.BuildDirectory)/installer/src/VirtualMonoRepo/Component.template.md
--tpn-template $(Agent.BuildDirectory)/installer/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt
--debug
||
(echo "##vso[task.logissue type=error]Failed to synchronize the VMR" && exit 1)
displayName: Synchronize dotnet/dotnet (Unix)
condition: ne(variables['Agent.OS'], 'Windows_NT')
workingDirectory: $(Agent.BuildDirectory)/installer
- script: git config --global diff.astextplain.textconv echo
displayName: Disable astextplain in git diff (Windows)
condition: eq(variables['Agent.OS'], 'Windows_NT')
- powershell: >
./eng/vmr-sync.ps1 `
-vmr ${{ parameters.vmrPath }} `
-tmp $(Agent.TempDirectory) `
-azdevPat '$(dn-bot-all-orgs-code-r)' `
-branch ${{ parameters.vmrBranch }} `
-repository "installer:${{ parameters.targetRef }}" `
-recursive `
# passing remote fails for some reason, but it is the default anyway
# -remote "installer:$(Agent.BuildDirectory)/installer"
-componentTemplate $(Agent.BuildDirectory)/installer/src/VirtualMonoRepo/Component.template.md `
-tpnTemplate $(Agent.BuildDirectory)/installer/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt `
-debugOutput
if ($LASTEXITCODE -ne 0) {
echo "##vso[task.logissue type=error]Failed to synchronize the VMR"
exit 1
}
displayName: Synchronize dotnet/dotnet (Windows)
condition: eq(variables['Agent.OS'], 'Windows_NT')
workingDirectory: $(Agent.BuildDirectory)/installer
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- publish: $(Agent.TempDirectory)
artifact: $(System.JobDisplayName)_FailedPatches
displayName: Upload failed patches
condition: failed()

View file

@ -1,71 +0,0 @@
parameters:
- name: vmrBranch
type: string
variables:
- ${{ if ne(parameters.vmrBranch, '') }}:
- name: VmrBranch
value: ${{ parameters.vmrBranch }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
- name: alpine319Container
value: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-WithNode
- name: centOSStream9Container
value: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9
- name: fedora39Container
value: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-39
- name: ubuntu2204Container
value: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04
- name: ubuntu2204ArmContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-arm64
- name: marinerX64CrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64
- name: marinerArmCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm
- name: marinerArm64CrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64
- name: marinerX64AlpineCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-alpine
- name: marinerArmAlpineCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm-alpine
- name: marinerArm64AlpineCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine
- name: androidCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-android-amd64
- name: browserCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-webassembly-20230917141449-2aaa02c
- name: wasiCrossContainer
value: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-webassembly
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: defaultPoolName
value: NetCore-Public-XL
- name: poolImage_Linux
value: 1es-ubuntu-2004-open
- name: poolImage_LinuxArm64
value: Mariner-2-Docker-ARM64
- name: poolName_LinuxArm64
value: Docker-Linux-Arm-Public
- name: poolImage_Mac
value: macos-12
- name: poolImage_Windows
value: windows.vs2022preview.amd64.open
- ${{ else }}:
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- name: defaultPoolName
value: NetCore1ESPool-Internal-XL
- ${{ else }}:
- name: defaultPoolName
value: $(DncEngInternalBuildPool)
- name: poolImage_Linux
value: 1es-ubuntu-2204
- name: poolImage_LinuxArm64
value: Mariner-2-Docker-ARM64
- name: poolName_LinuxArm64
value: Docker-Linux-Arm-Internal
- name: poolImage_Mac
value: macos-13-arm64
- name: poolImage_Windows
value: windows.vs2022preview.amd64

View file

@ -1,79 +0,0 @@
# This YAML is used by these PR pipelines:
#
# - installer-source-build
# https://dev.azure.com/dnceng-public/public/_build?definitionId=233
# - installer-unified-build
# https://dev.azure.com/dnceng-public/public/_build?definitionId=277
# - installer-unified-build-full
# https://dev.azure.com/dnceng-public/public/_build?definitionId=279
trigger: none
pr:
branches:
include:
- main
- release/*
exclude:
- release/*.0.2xx
- release/*.0.3xx
- release/*.0.4xx
parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to push to
type: string
default: ' '
- name: disableBuild
displayName: Skip the VMR Build stage
type: boolean
default: false
variables:
- template: /eng/common/templates/variables/pool-providers.yml@self
- ${{ if ne(parameters.vmrBranch, ' ') }}:
- name: VmrBranch
value: ${{ replace(parameters.vmrBranch, ' ', '') }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['System.PullRequest.TargetBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
# enable source-only build for pipelines with the -source-build suffix
- name: isSourceOnlyBuild
value: ${{ contains(variables['Build.DefinitionName'], '-source-build') }}
resources:
repositories:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet
ref: ${{ variables.VmrBranch }}
stages:
# You can temporarily disable the VMR Build stage by setting the disableBuild variable
- ${{ if not(parameters.disableBuild) }}:
- template: templates/stages/vmr-build.yml
parameters:
vmrBranch: ${{ variables.VmrBranch }}
isBuiltFromVmr: false
isSourceOnlyBuild: ${{ variables.isSourceOnlyBuild }}
${{ if contains(variables['Build.DefinitionName'], '-full') }}:
scope: full
${{ elseif eq(variables.isSourceOnlyBuild, 'true') }}:
scope: ultralite
${{ else }}:
scope: lite
# In case the VMR Build stage is temporarily disabled, the VMR synchronization step is run to validate
# that the PR can be merged and later synchronized into the VMR without problems.
- ${{ else }}:
- stage: Synchronize_VMR
displayName: Synchronize VMR
dependsOn: []
jobs:
- template: templates/jobs/vmr-synchronization.yml
parameters:
vmrBranch: ${{ variables.VmrBranch }}
noPush: true

View file

@ -1,64 +0,0 @@
pr: none
trigger:
batch: true
branches:
include:
- internal/release/*
exclude:
- internal/release/*.0.2xx
- internal/release/*.0.3xx
- internal/release/*.0.4xx
resources:
repositories:
- repository: vmr
type: git
name: dotnet-dotnet
ref: $(Build.SourceBranch)
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
parameters:
- name: vmrBranch
displayName: dotnet-dotnet branch to push to
type: string
default: ' '
variables:
- template: /eng/common/templates-official/variables/pool-providers.yml@self
- ${{ if ne(parameters.vmrBranch, ' ') }}:
- name: VmrBranch
value: ${{ replace(parameters.vmrBranch, ' ', '') }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
sdl:
sourceAnalysisPool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
sourceRepositoriesToScan:
exclude:
- repository: vmr
componentgovernance:
sourceScanPath: $(Agent.BuildDirectory)/vmr
ignoreDirectories: $(Agent.BuildDirectory)/vmr/src
stages:
- stage: VMRSynchronization
displayName: VMR Synchronization
jobs:
- template: /eng/pipelines/templates/jobs/vmr-synchronization.yml@self
parameters:
vmrBranch: ${{ variables.VmrBranch }}

View file

@ -1,66 +0,0 @@
pr: none
trigger:
batch: true
branches:
include:
- main
- release/*
exclude:
- release/*.0.2xx
- release/*.0.3xx
- release/*.0.4xx
resources:
repositories:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet
ref: $(Build.SourceBranch)
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
parameters:
- name: vmrBranch
displayName: dotnet/dotnet branch to push to
type: string
default: ' '
variables:
- template: /eng/common/templates-official/variables/pool-providers.yml@self
- ${{ if ne(parameters.vmrBranch, ' ') }}:
- name: VmrBranch
value: ${{ replace(parameters.vmrBranch, ' ', '') }}
- ${{ else }}:
- name: VmrBranch
value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }}
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
sdl:
sourceAnalysisPool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
sourceRepositoriesToScan:
exclude:
- repository: vmr
componentgovernance:
sourceScanPath: $(Agent.BuildDirectory)/vmr
ignoreDirectories: $(Agent.BuildDirectory)/vmr/src
stages:
- stage: VMRSynchronization
displayName: VMR Synchronization
jobs:
- template: /eng/pipelines/templates/jobs/vmr-synchronization.yml@self
parameters:
vmrBranch: ${{ variables.VmrBranch }}

View file

@ -3,12 +3,6 @@ function InitializeCustomSDKToolset {
return
}
# The following frameworks and tools are used only for testing.
# Do not attempt to install them in source build.
if ($productBuild -or $properties -like "*DotNetBuildRepo=true*") {
return
}
# InstallDotNetSharedFramework "1.0.5"
# InstallDotNetSharedFramework "1.1.2"
# InstallDotNetSharedFramework "2.1.0"

View file

@ -3,12 +3,6 @@ function InitializeCustomSDKToolset {
return
fi
# The following frameworks and tools are used only for testing.
# Do not attempt to install them in source build.
if [[ $product_build == true || $properties == *"DotNetBuildRepo=true"* ]]; then
return
fi
#InstallDotNetSharedFramework "1.0.5"
#InstallDotNetSharedFramework "1.1.2"

View file

@ -1,216 +0,0 @@
<#
.SYNOPSIS
This script is used for synchronizing the dotnet/dotnet VMR locally. This means pulling new
code from various repositories into the 'dotnet/dotnet' repository.
.DESCRIPTION
The script is used during CI to ingest new code based on dotnet/installer but it can also help
for reproducing potential failures during installer's PRs, namely to fix the Source-Build.
Another usecase is to try manually synchronizing a given commit of some repo into the VMR and
trying to Source-Build the VMR. This can help when fixing the Source-Build but using a commit
from a not-yet merged branch (or fork) to test the fix will help.
The tooling that synchronizes the VMR will need to clone the various repositories into a temporary
folder. These clones can be re-used in future synchronizations so it is advised you dedicate a
folder to this to speed up your re-runs.
.EXAMPLE
Synchronize current installer and all dependencies into a local VMR:
./vmr-sync.ps1 -vmrDir "$HOME/repos/dotnet" -tmpDir "$HOME/repos/tmp"
Synchronize the VMR to a specific commit of dotnet/runtime using custom fork:
./vmr-sync.ps1 `
-repository runtime:e7e71da303af8dc97df99b098f21f526398c3943 `
-remote runtime:https://github.com/yourfork/runtime `
-tmpDir "$HOME/repos/tmp"
.PARAMETER tmpDir
Required. Path to the temporary folder where repositories will be cloned
.PARAMETER vmrBranch
Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch
.PARAMETER component-template
Optional. Template for VMRs Component.md used for regenerating the file to list the newest versions of
components.
Defaults to src/VirtualMonoRepo/Component.template.md
.PARAMETER recursive
Optional. Recursively synchronize all the source build dependencies (declared in Version.Details.xml)
This is used when performing the full synchronization during installer's CI and the final VMR sync.
Defaults to false unless no repository is supplied in which case a recursive sync of installer is performed.
.PARAMETER remote
Optional. Additional remote to use during the synchronization
This can be used to synchronize to a commit from a fork of the repository
Example: 'runtime:https://github.com/yourfork/runtime'
.PARAMETER repository
Optional. Repository + git ref separated by colon to synchronize to.
This can be a specific commit, branch, tag.
If not supplied, the revision of the parent installer repository of this script will be used (recursively).
Example: 'runtime:my-branch-name'
.PARAMETER tpnTemplate
Optional. Template for the header of VMRs THIRD-PARTY-NOTICES file.
Defaults to src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt
.PARAMETER azdevPat
Optional. Azure DevOps PAT to use for cloning private repositories.
.PARAMETER vmrDir
Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder
.PARAMETER debugOutput
Optional. Enables debug logging in the darc vmr command.
#>
param (
[Parameter(Mandatory=$true, HelpMessage="Path to the temporary folder where repositories will be cloned")]
[string][Alias('t', 'tmp')]$tmpDir,
[string][Alias('b', 'branch')]$vmrBranch,
[string]$componentTemplate = "src/VirtualMonoRepo/Component.template.md",
[switch]$recursive,
[string]$remote,
[string][Alias('r')]$repository,
[string]$tpnTemplate = "src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt",
[string]$azdevPat,
[string][Alias('v', 'vmr')]$vmrDir,
[switch]$debugOutput
)
$scriptRoot = $PSScriptRoot
function Fail {
Write-Host "> $($args[0])" -ForegroundColor 'Red'
}
function Highlight {
Write-Host "> $($args[0])" -ForegroundColor 'Cyan'
}
$installerDir = (Split-Path -Parent $scriptRoot)
# If installer is a repo, we're in an installer and not in the dotnet/dotnet repo
if (Test-Path -Path "$installerDir/.git" -PathType Container) {
$additionalRemotes = "installer:$installerDir"
}
if ($remote) {
$additionalRemotes = "$additionalRemotes $remote"
}
$verbosity = 'verbose'
if ($debugOutput) {
$verbosity = 'debug'
}
# Validation
if (-not (Test-Path -Path $installerDir -PathType Container)) {
Fail "Directory '$installerDir' does not exist. Please specify the path to the dotnet/installer repo"
exit 1
}
if (-not $tmpDir) {
Fail "Missing -tmpDir argument. Please specify the path to the temporary folder where the repositories will be cloned"
exit 1
}
if (-not (Test-Path -Path $componentTemplate -PathType Leaf)) {
Fail "File '$componentTemplate' does not exist. Please specify a valid path to the component template"
exit 1
}
if (-not (Test-Path -Path $tpnTemplate -PathType Leaf)) {
Fail "File '$tpnTemplate' does not exist. Please specify a valid path to the THIRD-PARTY-NOTICES template"
exit 1
}
# Sanitize the input
# Default when no repository is provided
if (-not $repository) {
$repository = "installer:$(git -C $installerDir rev-parse HEAD)"
$recursive = $true
}
if (-not $vmrDir) {
$vmrDir = Join-Path $tmpDir 'dotnet'
}
if (-not (Test-Path -Path $tmpDir -PathType Container)) {
New-Item -ItemType Directory -Path $tmpDir | Out-Null
}
# Prepare the VMR
if (-not (Test-Path -Path $vmrDir -PathType Container)) {
Highlight "Cloning 'dotnet/dotnet' into $vmrDir.."
git clone https://github.com/dotnet/dotnet $vmrDir
if ($vmrBranch) {
git -C $vmrDir switch -c $vmrBranch
}
}
else {
if ((git -C $vmrDir diff --quiet) -eq $false) {
Fail "There are changes in the working tree of $vmrDir. Please commit or stash your changes"
exit 1
}
if ($vmrBranch) {
Highlight "Preparing $vmrDir"
git -C $vmrDir checkout $vmrBranch
git -C $vmrDir pull
}
}
Set-StrictMode -Version Latest
# Prepare darc
Highlight 'Installing .NET, preparing the tooling..'
. $scriptRoot\common\tools.ps1
$dotnetRoot = InitializeDotNetCli -install:$true
$dotnet = "$dotnetRoot\dotnet.exe"
& "$dotnet" tool restore
Highlight "Starting the synchronization of '$repository'.."
# Synchronize the VMR
$darcArgs = (
"darc", "vmr", "update",
"--vmr", $vmrDir,
"--tmp", $tmpDir,
"--$verbosity",
"--component-template", $componentTemplate,
"--tpn-template", $tpnTemplate,
"--discard-patches",
$repository
)
if ($recursive) {
$darcArgs += ("--recursive")
}
if ($additionalRemotes) {
$darcArgs += ("--additional-remotes", $additionalRemotes)
}
if ($azdevPat) {
$darcArgs += ("--azdev-pat", $azdevPat)
}
& "$dotnet" $darcArgs
if ($LASTEXITCODE -eq 0) {
Highlight "Synchronization succeeded"
}
else {
Fail "Synchronization of dotnet/dotnet to '$repository' failed!"
Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)."
Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)."
Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script."
exit 1
}

View file

@ -1,284 +0,0 @@
#!/bin/bash
### This script is used for synchronizing the dotnet/dotnet VMR locally. This means pulling new
### code from various repositories into the 'dotnet/dotnet' repository.
###
### The script is used during CI to ingest new code based on dotnet/installer but it can also help
### for reproducing potential failures during installer's PRs, namely to fix the Source-Build.
### Another usecase is to try manually synchronizing a given commit of some repo into the VMR and
### trying to Source-Build the VMR. This can help when fixing the Source-Build but using a commit
### from a not-yet merged branch (or fork) to test the fix will help.
###
### The tooling that synchronizes the VMR will need to clone the various repositories into a temporary
### folder. These clones can be re-used in future synchronizations so it is advised you dedicate a
### folder to this to speed up your re-runs.
###
### USAGE:
### Synchronize current installer and all dependencies into a local VMR:
### ./vmr-sync.sh --vmr "$HOME/repos/dotnet" --tmp "$HOME/repos/tmp"
###
### Synchronize the VMR to a specific commit of dotnet/runtime using custom fork:
### ./vmr-sync.sh \
### --repository runtime:e7e71da303af8dc97df99b098f21f526398c3943 \
### --remote runtime:https://github.com/yourfork/runtime \
### --tmp "$HOME/repos/tmp"
###
### Options:
### -t, --tmp, --tmp-dir PATH
### Required. Path to the temporary folder where repositories will be cloned
###
### -b, --branch, --vmr-branch BRANCH_NAME
### Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch
###
### --debug
### Optional. Turns on the most verbose logging for the VMR tooling
###
### --component-template
### Optional. Template for VMRs Component.md used for regenerating the file to list the newest versions of
### components.
### Defaults to src/VirtualMonoRepo/Component.template.md
###
### --recursive
### Optional. Recursively synchronize all the source build dependencies (declared in Version.Details.xml)
### This is used when performing the full synchronization during installer's CI and the final VMR sync.
### Defaults to false unless no repository is supplied in which case a recursive sync of installer is performed.
###
### --remote name:URI
### Optional. Additional remote to use during the synchronization
### This can be used to synchronize to a commit from a fork of the repository
### Example: 'runtime:https://github.com/yourfork/runtime'
###
### -r, --repository name:GIT_REF
### Optional. Repository + git ref separated by colon to synchronize to.
### This can be a specific commit, branch, tag.
### If not supplied, the revision of the parent installer repository of this script will be used (recursively).
### Example: 'runtime:my-branch-name'
###
### --tpn-template
### Optional. Template for the header of VMRs THIRD-PARTY-NOTICES file.
### Defaults to src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt
###
### --azdev-pat
### Optional. Azure DevOps PAT to use for cloning private repositories.
###
### -v, --vmr, --vmr-dir PATH
### Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder
source="${BASH_SOURCE[0]}"
# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
function print_help () {
sed -n '/^### /,/^$/p' "$source" | cut -b 5-
}
COLOR_RED=$(tput setaf 1 2>/dev/null || true)
COLOR_CYAN=$(tput setaf 6 2>/dev/null || true)
COLOR_CLEAR=$(tput sgr0 2>/dev/null || true)
COLOR_RESET=uniquesearchablestring
FAILURE_PREFIX='> '
function fail () {
echo "${COLOR_RED}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_RED}}${COLOR_CLEAR}" >&2
}
function highlight () {
echo "${COLOR_CYAN}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_CYAN}}${COLOR_CLEAR}"
}
# realpath is not available in macOS 12, try horrible-but-portable workaround
installer_dir=$(cd "$scriptroot/../"; pwd -P)
tmp_dir=''
vmr_dir=''
vmr_branch=''
repository=''
additional_remotes=''
recursive=false
verbosity=verbose
component_template="$installer_dir/src/VirtualMonoRepo/Component.template.md"
tpn_template="$installer_dir/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt"
azdev_pat=''
# If installer is a repo, we're in an installer and not in the dotnet/dotnet repo
if [[ -d "$installer_dir/.git" ]]; then
additional_remotes="installer:$installer_dir"
fi
while [[ $# -gt 0 ]]; do
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
-t|--tmp|--tmp-dir)
tmp_dir=$2
shift
;;
-v|--vmr|--vmr-dir)
vmr_dir=$2
shift
;;
-b|--branch|--vmr-branch)
vmr_branch=$2
shift
;;
-r|--repository)
repository=$2
shift
;;
--recursive)
recursive=true
;;
--remote)
additional_remotes="$additional_remotes $2"
shift
;;
--component-template)
component_template=$2
shift
;;
--tpn-template)
tpn_template=$2
shift
;;
--azdev-pat)
azdev_pat=$2
shift
;;
-d|--debug)
verbosity=debug
;;
-h|--help)
print_help
exit 0
;;
*)
fail "Invalid argument: $1"
print_help
exit 1
;;
esac
shift
done
# Validation
if [[ ! -d "$installer_dir" ]]; then
fail "Directory '$installer_dir' does not exist. Please specify the path to the dotnet/installer repo"
exit 1
fi
if [[ -z "$tmp_dir" ]]; then
fail "Missing --tmp-dir argument. Please specify the path to the temporary folder where the repositories will be cloned"
exit 1
fi
if [[ ! -f "$component_template" ]]; then
fail "File '$component_template' does not exist. Please specify a valid path to the Component.md template"
exit 1
fi
if [[ ! -f "$tpn_template" ]]; then
fail "File '$tpn_template' does not exist. Please specify a valid path to the THIRD-PARTY-NOTICES template"
exit 1
fi
# Sanitize the input
# Default when no repository is provided
if [[ -z "$repository" ]]; then
repository="installer:$(git -C "$installer_dir" rev-parse HEAD)"
recursive=true
fi
if [[ -z "$vmr_dir" ]]; then
vmr_dir="$tmp_dir/dotnet"
fi
if [[ ! -d "$tmp_dir" ]]; then
mkdir -p "$tmp_dir"
fi
if [[ "$verbosity" == "debug" ]]; then
set -x
fi
# Prepare the VMR
if [[ ! -d "$vmr_dir" ]]; then
highlight "Cloning 'dotnet/dotnet' into $vmr_dir.."
git clone https://github.com/dotnet/dotnet "$vmr_dir"
if [[ -n "$vmr_branch" ]]; then
git -C "$vmr_dir" switch -c "$vmr_branch"
fi
else
if ! git -C "$vmr_dir" diff --quiet; then
fail "There are changes in the working tree of $vmr_dir. Please commit or stash your changes"
exit 1
fi
if [[ -n "$vmr_branch" ]]; then
highlight "Preparing $vmr_dir"
git -C "$vmr_dir" checkout "$vmr_branch"
git -C "$vmr_dir" pull
fi
fi
set -e
# Prepare darc
highlight 'Installing .NET, preparing the tooling..'
source "$scriptroot/common/tools.sh"
InitializeDotNetCli true
dotnetDir=$( cd $scriptroot/../.dotnet/; pwd -P )
dotnet=$dotnetDir/dotnet
"$dotnet" tool restore
highlight "Starting the synchronization of '$repository'.."
set +e
recursive_arg=''
if [[ "$recursive" == "true" ]]; then
recursive_arg="--recursive"
fi
if [[ -n "$additional_remotes" ]]; then
additional_remotes="--additional-remotes $additional_remotes"
fi
if [[ -n "$azdev_pat" ]]; then
azdev_pat="--azdev-pat $azdev_pat"
fi
# Synchronize the VMR
"$dotnet" darc vmr update \
--vmr "$vmr_dir" \
--tmp "$tmp_dir" \
$azdev_pat \
--$verbosity \
$recursive_arg \
$additional_remotes \
--component-template "$component_template" \
--tpn-template "$tpn_template" \
--discard-patches \
"$repository"
if [[ $? == 0 ]]; then
highlight "Synchronization succeeded"
else
fail "Synchronization of dotnet/dotnet to '$repository' failed!"
fail "'$vmr_dir' is left in its last state (re-run of this script will reset it)."
fail "Please inspect the logs which contain path to the failing patch file (use --debug to get all the details)."
fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script."
exit 1
fi