Merge branch 'main' of https://github.com/dotnet/installer into darc-main-b1c66f9b-859b-483e-9778-5c662888fb9a

This commit is contained in:
Michael Simons 2023-01-17 18:23:25 +00:00
commit 94a38989db
34 changed files with 602 additions and 592 deletions

View file

@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"microsoft.dotnet.darc": {
"version": "1.1.0-beta.23059.1",
"version": "1.1.0-beta.23062.1",
"commands": [
"darc"
]

View file

@ -11,12 +11,8 @@
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="general-testing" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet3-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json" />
<add key="dotnet3.1-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json" />
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<add key="dotnet5-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json" />
<add key="dotnet-eol-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eol-transport/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet6-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json" />
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />

View file

@ -60,7 +60,13 @@ For the latest information about Source-Build support for new .NET versions, ple
The dependencies for building .NET from source can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md).
## Building
## Building .NET 8.0
.NET 8.0 (currently in prerelease) and newer will be built from the [dotnet/dotnet](https://github.com/dotnet/dotnet) repo.
Clone the dotnet/dotnet repo and check out the tag for the desired release.
Then, follow the instructions in [dotnet/dotnet's README](https://github.com/dotnet/dotnet/blob/main/README.md#dev-instructions) to build .NET from source.
## Building .NET 7.0 and .NET 6.0
1. Create a .NET source tarball.

View file

@ -167,22 +167,22 @@
<Uri>https://github.com/Microsoft/ApplicationInsights-dotnet</Uri>
<Sha>53b80940842204f78708a538628288ff5d741a1d</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.net6.Manifest-8.0.100" Version="8.0.0-alpha.1.23054.1">
<Dependency Name="Microsoft.NET.Workload.Emscripten.net6.Manifest-8.0.100" Version="8.0.0-alpha.1.23061.1">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>c91d3e0511d3888e5c6ddc096a224ec6c141beed</Sha>
<Sha>5578fc4c0d1f4a1a01ad2801de2852cbe422b9ab</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100" Version="8.0.0-alpha.1.23054.1">
<Dependency Name="Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100" Version="8.0.0-alpha.1.23061.1">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>c91d3e0511d3888e5c6ddc096a224ec6c141beed</Sha>
<Sha>5578fc4c0d1f4a1a01ad2801de2852cbe422b9ab</Sha>
</Dependency>
<Dependency Name="Microsoft.Deployment.DotNet.Releases" Version="1.0.0-preview5.1.22263.1">
<Uri>https://github.com/dotnet/deployment-tools</Uri>
<Sha>c3ad00ae84489071080a606f6a8e43c9a91a5cc2</Sha>
<SourceBuildTarball RepoName="deployment-tools" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23055.2">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23062.2">
<Uri>https://github.com/dotnet/source-build-externals</Uri>
<Sha>54fb15633d58bf41248a7ea4bf366b4ea4798b89</Sha>
<Sha>df9dd3b66b2fa6d86eb01bb5b2493435bdfa2649</Sha>
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.symreader" Version="1.4.0-beta2-21475-02">
@ -205,13 +205,13 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>5a5ae41c42e475e280342b668e668ff34539e36d</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.23059.1">
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.23062.1">
<Uri>https://github.com/dotnet/arcade-services</Uri>
<Sha>60e937ba1a05bfa01ce51a4fe0a10fa3f5b026f8</Sha>
<Sha>068e0045e2903fb9a1ac09630c28537f09ec68d8</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.23059.1">
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.23062.1">
<Uri>https://github.com/dotnet/arcade-services</Uri>
<Sha>60e937ba1a05bfa01ce51a4fe0a10fa3f5b026f8</Sha>
<Sha>068e0045e2903fb9a1ac09630c28537f09ec68d8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="8.0.0-alpha.1.22557.12">
<Uri>https://github.com/dotnet/runtime</Uri>

View file

@ -30,7 +30,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/arcade-services -->
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.23059.1</MicrosoftDotNetDarcLibVersion>
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.23062.1</MicrosoftDotNetDarcLibVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/winforms -->
@ -147,14 +147,14 @@
<NUnit3Templates70PackageVersion>$(NUnit3DotNetNewTemplatePackageVersion)</NUnit3Templates70PackageVersion>
<MicrosoftDotNetCommonItemTemplates70PackageVersion>$(MicrosoftDotNetCommonItemTemplates70PackageVersion)</MicrosoftDotNetCommonItemTemplates70PackageVersion>
<MicrosoftDotNetCommonProjectTemplates70PackageVersion>$(MicrosoftDotNetCommonItemTemplates70PackageVersion)</MicrosoftDotNetCommonProjectTemplates70PackageVersion>
<AspNetCorePackageVersionFor70Templates>7.0.0</AspNetCorePackageVersionFor70Templates>
<AspNetCorePackageVersionFor70Templates>7.0.2</AspNetCorePackageVersionFor70Templates>
<!-- 6.0 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates60PackageVersion>$(MicrosoftWinFormsProjectTemplates60PackageVersion)</MicrosoftDotnetWinFormsProjectTemplates60PackageVersion>
<MicrosoftDotNetWpfProjectTemplates60PackageVersion>$(MicrosoftWPFProjectTemplates60PackageVersion)</MicrosoftDotNetWpfProjectTemplates60PackageVersion>
<NUnit3Templates60PackageVersion>$(NUnit3DotNetNewTemplatePackageVersion)</NUnit3Templates60PackageVersion>
<MicrosoftDotNetCommonItemTemplates60PackageVersion>$(MicrosoftDotNetCommonItemTemplates60PackageVersion)</MicrosoftDotNetCommonItemTemplates60PackageVersion>
<MicrosoftDotNetCommonProjectTemplates60PackageVersion>$(MicrosoftDotNetCommonItemTemplates60PackageVersion)</MicrosoftDotNetCommonProjectTemplates60PackageVersion>
<AspNetCorePackageVersionFor60Templates>6.0.11</AspNetCorePackageVersionFor60Templates>
<AspNetCorePackageVersionFor60Templates>6.0.13</AspNetCorePackageVersionFor60Templates>
<!-- 5.0 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates50PackageVersion>$(MicrosoftWinFormsProjectTemplates50PackageVersion)</MicrosoftDotnetWinFormsProjectTemplates50PackageVersion>
<MicrosoftDotNetWpfProjectTemplates50PackageVersion>$(MicrosoftWPFProjectTemplates50PackageVersion)</MicrosoftDotNetWpfProjectTemplates50PackageVersion>
@ -168,7 +168,7 @@
<NUnit3Templates31PackageVersion>1.7.2</NUnit3Templates31PackageVersion>
<MicrosoftDotNetCommonItemTemplates31PackageVersion>3.1.27</MicrosoftDotNetCommonItemTemplates31PackageVersion>
<MicrosoftDotNetCommonProjectTemplates31PackageVersion>$(MicrosoftDotNetCommonItemTemplates31PackageVersion)</MicrosoftDotNetCommonProjectTemplates31PackageVersion>
<AspNetCorePackageVersionFor31Templates>3.1.31</AspNetCorePackageVersionFor31Templates>
<AspNetCorePackageVersionFor31Templates>3.1.32</AspNetCorePackageVersionFor31Templates>
<MicrosoftAspNetCoreComponentsWebAssemblyTemplatesPackageVersion>3.2.1</MicrosoftAspNetCoreComponentsWebAssemblyTemplatesPackageVersion>
<!-- 3.0 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates30PackageVersion>4.8.0-rc2.19462.10</MicrosoftDotnetWinFormsProjectTemplates30PackageVersion>
@ -200,8 +200,8 @@
<XamarinMacOSWorkloadManifestVersion>12.3.2372</XamarinMacOSWorkloadManifestVersion>
<XamarinTvOSWorkloadManifestVersion>16.0.1478</XamarinTvOSWorkloadManifestVersion>
<MonoWorkloadManifestVersion>$(MicrosoftNETCoreAppRefPackageVersion)</MonoWorkloadManifestVersion>
<MicrosoftNETWorkloadEmscriptennet6Manifest80100Version>8.0.0-alpha.1.23054.1</MicrosoftNETWorkloadEmscriptennet6Manifest80100Version>
<MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>8.0.0-alpha.1.23054.1</MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>
<MicrosoftNETWorkloadEmscriptennet6Manifest80100Version>8.0.0-alpha.1.23061.1</MicrosoftNETWorkloadEmscriptennet6Manifest80100Version>
<MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>8.0.0-alpha.1.23061.1</MicrosoftNETWorkloadEmscriptennet7Manifest80100Version>
<EmscriptenWorkloadManifestVersion>$(MicrosoftNETWorkloadEmscriptennet7Manifest80100Version)</EmscriptenWorkloadManifestVersion>
</PropertyGroup>
<!-- dependencies for VMR initialization -->

View file

@ -51,6 +51,10 @@ parameters:
- name: enablePoison
type: boolean
# Instead of building the VMR directly, exports the sources into a tarball and builds from that
- name: buildFromArchive
type: boolean
jobs:
- job: ${{ parameters.buildName }}_${{ parameters.architecture }}
timeoutInMinutes: 150
@ -75,6 +79,15 @@ jobs:
- name: additionalBuildArgs
value: ' --with-sdk /vmr/.dotnet'
# 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: ${{ parameters.vmrPath }}
steps:
- template: ../steps/vmr-prepare.yml
parameters:
@ -90,15 +103,24 @@ jobs:
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: $(Build.SourceVersion) # Synchronize the current installer commit
- ${{ if parameters.buildFromArchive }}:
- script: |
set -ex
"${{ parameters.vmrPath }}/eng/pack-sources.sh" -o "$(Build.StagingDirectory)/dotnet-sources.tar.gz"
tar -xf dotnet-sources.tar.gz
mv "dotnet-$(Build.SourceVersion)" "$(sourcesPath)"
displayName: Export VMR sources
workingDirectory: $(Build.StagingDirectory)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: cp ${{ parameters.vmrPath }}/src/installer/NuGet.config ${{ parameters.vmrPath }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config
- script: cp "$(sourcesPath)/src/installer/NuGet.config" "$(sourcesPath)/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config"
displayName: Copy Test NuGet Config
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: ${{ parameters.vmrPath }}/src/installer/eng/common/SetupNugetSources.sh
arguments: ${{ parameters.vmrPath }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config $Token
filePath: $(sourcesPath)/src/installer/eng/common/SetupNugetSources.sh
arguments: $(sourcesPath)/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
@ -119,7 +141,7 @@ jobs:
inputs:
SourceFolder: $(Pipeline.Workspace)/${{ parameters.reuseBuildArtifactsFrom }}_${{ parameters.architecture }}_Artifacts
Contents: '*.tar.gz'
TargetFolder: ${{ parameters.vmrPath }}/packages/archive/
TargetFolder: ${{ variables.sourcesPath }}/packages/archive/
- script: |
set -x
@ -130,11 +152,11 @@ jobs:
customPrepArgs='--bootstrap'
fi
docker run --rm -v ${{ parameters.vmrPath }}:/vmr -w /vmr ${{ parameters.container }} ./prep.sh ${customPrepArgs}
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh ${customPrepArgs}
else
mkdir ${{ parameters.vmrPath }}/.dotnet
previousSdkPath="${{ parameters.vmrPath }}/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$previousSdkPath" -C "${{ parameters.vmrPath }}/.dotnet"
mkdir $(sourcesPath)/.dotnet
previousSdkPath="$(sourcesPath)/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$previousSdkPath" -C "$(sourcesPath)/.dotnet"
eval rm -f "$previousSdkPath"
fi
displayName: Prep the Build
@ -155,13 +177,13 @@ jobs:
customBuildArgs="$customBuildArgs --poison"
fi
docker run --rm -v ${{ parameters.vmrPath }}:/vmr -w /vmr ${networkArgs} ${{ parameters.container }} ./build.sh --clean-while-building $(additionalBuildArgs) ${customBuildArgs}
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${networkArgs} ${{ parameters.container }} ./build.sh --clean-while-building $(additionalBuildArgs) ${customBuildArgs}
displayName: Build
- script: |
set -x
dockerVolumeArgs="-v ${{ parameters.vmrPath }}:/vmr"
dockerVolumeArgs="-v $(sourcesPath):/vmr"
dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests }} -e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=true"
poisonArg=''
@ -186,7 +208,7 @@ jobs:
targetFolder=$(Build.StagingDirectory)/BuildLogs/
mkdir -p ${targetFolder}
cd "${{ parameters.vmrPath }}"
cd "$(sourcesPath)"
find artifacts/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/ -type f -name "*.log" -exec cp {} --parents -t ${targetFolder} \;
find artifacts/prebuilt-report/ -exec cp {} --parents -t ${targetFolder} \;
@ -212,12 +234,12 @@ jobs:
inputs:
testRunner: vSTest
testResultsFiles: 'test/**/*.trx'
searchFolder: ${{ parameters.vmrPath }}
searchFolder: ${{ variables.sourcesPath }}
mergeTestResults: true
publishRunAttachments: true
testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName)
- publish: '${{ parameters.vmrPath }}/artifacts/${{ parameters.architecture }}/Release/'
- publish: '${{ variables.sourcesPath }}/artifacts/${{ parameters.architecture }}/Release/'
artifact: $(Agent.JobName)_Artifacts
displayName: Publish Artifacts
condition: succeededOrFailed()

View file

@ -68,11 +68,12 @@ stages:
name: ${{ variables.defaultPoolName }}
demands: ${{ variables.defaultPoolDemands }}
container: ${{ parameters.centOSStream8Container }}
bootstrapPrep: false # 🚫
enablePoison: false # 🚫
excludeSdkContentTests: true # ✅
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
bootstrapPrep: false # 🚫
enablePoison: false # 🚫
excludeSdkContentTests: true # ✅
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
buildFromArchive: false # 🚫
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- template: ../jobs/vmr-build.yml
@ -90,6 +91,7 @@ stages:
excludeSdkContentTests: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: false # 🚫
buildFromArchive: true # ✅
- template: ../jobs/vmr-build.yml
parameters:
@ -106,6 +108,7 @@ stages:
excludeSdkContentTests: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
buildFromArchive: true # ✅
- template: ../jobs/vmr-build.yml
parameters:
@ -122,6 +125,7 @@ stages:
excludeSdkContentTests: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
buildFromArchive: true # ✅
- template: ../jobs/vmr-build.yml
parameters:
@ -138,6 +142,7 @@ stages:
excludeSdkContentTests: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
buildFromArchive: false # 🚫
- template: ../jobs/vmr-build.yml
parameters:
@ -152,6 +157,7 @@ stages:
excludeSdkContentTests: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
buildFromArchive: false # 🚫
- template: ../jobs/vmr-build.yml
parameters:
@ -168,4 +174,5 @@ stages:
excludeSdkContentTests: true # ✅
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
buildFromArchive: false # 🚫
reuseBuildArtifactsFrom: Fedora36_Offline

View file

@ -83,7 +83,7 @@ function highlight () {
echo "${COLOR_CYAN}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_CYAN}}${COLOR_CLEAR}"
}
installer_dir="$scriptroot/../"
installer_dir=$(realpath "$scriptroot/../")
tmp_dir=''
vmr_dir=''
vmr_branch='main'
@ -179,10 +179,6 @@ fi
highlight "Starting the synchronization to '$target_ref'.."
set +e
# Temporary workaround while we fix fetching commits
rm -rf "$tmp_dir/installer"
cp -r "$installer_dir" "$tmp_dir/installer"
if "$dotnet" darc vmr update --vmr "$vmr_dir" --tmp "$tmp_dir" --$verbosity --recursive --additional-remotes "installer:$installer_dir" "installer:$target_ref"; then
highlight "Synchronization succeeded"
else

View file

@ -3,7 +3,7 @@
"name": "Default",
"image": "mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-36",
"hostRequirements": {
// A completely built .NET source-tarball is >64 GB
// A completely source built .NET is >64 GB with all the repos/artifacts
"storage": "128gb"
},
"customizations": {

View file

@ -3,7 +3,7 @@
"name": "Pre-built .NET SDK",
"image": "mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-36",
"hostRequirements": {
// A completely built .NET source-tarball is >64 GB
// A completely source built .NET is >64 GB with all the repos/artifacts
"storage": "128gb"
},
"customizations": {

View file

@ -0,0 +1,7 @@
Contributing
============
See [dotnet/runtime](./src/runtime/CONTRIBUTING.md) for general contribution guidelines such as allowed licenses.
At this time, the VMR will not accept any changes and is a read-only mirror of the development repositories only.
Please, make the changes in the respective development repositories (e.g., [dotnet/runtime](https://github.com/dotnet/runtime) or [dotnet/sdk](https://github.com/dotnet/sdk)) and they will get synchronized into the VMR automatically.

View file

@ -119,9 +119,6 @@
<SourceBuiltToolsetDir>$(LocalBlobStorageRoot)Sdk/</SourceBuiltToolsetDir>
<SourceBuiltRuntimeDir>$(LocalBlobStorageRoot)Runtime/</SourceBuiltRuntimeDir>
<SourceBuiltAspNetCoreRuntime>$(LocalBlobStorageRoot)aspnetcore/Runtime/</SourceBuiltAspNetCoreRuntime>
<RestoreSourcePropsPath>$(IntermediatePath)RestoreSources.props</RestoreSourcePropsPath>
<PackageVersionPropsPath>$(IntermediatePath)PackageVersions.props</PackageVersionPropsPath>
<CurrentSourceBuiltPackageVersionPropsPath>$(IntermediatePath)CurrentSourceBuiltPackageVersions.props</CurrentSourceBuiltPackageVersionPropsPath>
<LoggingDir>$(BaseOutputPath)logs/</LoggingDir>
<MSBuildDebugPathTargetDir>$(BaseOutputPath)msbuild-debug/</MSBuildDebugPathTargetDir>
<RoslynDebugPathTargetDir>$(BaseOutputPath)roslyn-debug/</RoslynDebugPathTargetDir>

View file

@ -102,19 +102,14 @@ fi
if [ -f "${packagesArchiveDir}archiveArtifacts.txt" ]; then
ARCHIVE_ERROR=0
if [ ! -d "$SCRIPT_ROOT/.dotnet" ] && [ "$CUSTOM_SDK_DIR" == "" ]; then
echo "ERROR: SDK not found at $SCRIPT_ROOT/.dotnet"
echo "ERROR: SDK not found at '$SCRIPT_ROOT/.dotnet'. Either run prep.sh to acquire one or specify one via the --with-sdk parameter."
ARCHIVE_ERROR=1
fi
if [ ! -f ${packagesArchiveDir}Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PACKAGES_DIR" == "" ]; then
echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at $packagesArchiveDir - Either run prep.sh or pass --with-packages parameter"
echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at '$packagesArchiveDir'. Either run prep.sh to acquire it or specify one via the --with-packages parameter."
ARCHIVE_ERROR=1
fi
if [ $ARCHIVE_ERROR == 1 ]; then
echo ""
echo " Errors detected in tarball. To prep the tarball, run prep.sh while online to install an SDK"
echo " and Private.SourceBuilt.Artifacts tarball. After prepping the tarball, the tarball can be"
echo " built offline. As an alternative to prepping the tarball, these assets can be provided using"
echo " the --with-sdk and --with-packages parameters"
exit 1
fi
fi
@ -161,7 +156,7 @@ if [[ $arcadeSdkLine =~ $versionPattern ]]; then
export ARCADE_BOOTSTRAP_VERSION=${BASH_REMATCH[1]}
# Ensure that by default, the bootstrap version of the Arcade SDK is used. Source-build infra
# projects use bootstrap Arcade SDK, and would fail to find it in the tarball build. The repo
# projects use bootstrap Arcade SDK, and would fail to find it in the build. The repo
# projects overwrite this so that they use the source-built Arcade SDK instad.
export SOURCE_BUILT_SDK_ID_ARCADE=Microsoft.DotNet.Arcade.Sdk
export SOURCE_BUILT_SDK_VERSION_ARCADE=$ARCADE_BOOTSTRAP_VERSION

View file

@ -139,6 +139,12 @@ ln -s $HOME/.dotnet/dotnet /usr/bin/dotnet
You can also utilize [GitHub Codespaces](https://github.com/features/codespaces) where you can find preset containers in this repository.
### Exporting a source archive
In case you'd like to export a more lightweight archive of sources that can be built outside of this git repository, a simple copy of the working tree won't do.
The build is using some git metadata (information from the `.git` directory) that are needed to be kept with the sources.
To export a `tar.gz` archive of the sources, you need to use the `eng/pack-sources.sh` script from within a clone of the VMR checked out at the revision that you're interested in.
## List of components
To enable full offline source-building of the VMR, we have no other choice than to synchronize all the necessary code into the VMR. This also includes any code referenced via git submodules. More details on why and how this is done can be found here:

View file

@ -0,0 +1,96 @@
#!/usr/bin/env bash
### This script exports the sources of VMR (dotnet/dotnet) as an archive that can be used
### to build the .NET SDK.
### It expects you clone the dotnet/dotnet repo locally and check out the desired revision.
###
### USAGE:
### ./pack-sources.sh -o dotnet.tar.gz
### Options:
### -o, --output PATH
### Optional. Path or dir where the archive is created.
### Defaults to artifacts/packages/dotnet-[SHA].tar.gz
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-
}
GIT_ROOT=$(realpath "$scriptroot/../")
output=''
while [[ $# -gt 0 ]]; do
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
-o|--output)
output=$2
shift
;;
-h|--help)
print_help
exit 0
;;
*)
fail "Invalid argument: $1"
usage
exit 1
;;
esac
shift
done
revision=$(git -C "$GIT_ROOT" rev-parse HEAD)
filename="dotnet-$revision"
if [[ -z "$output" ]]; then
output="$GIT_ROOT/artifacts/packages/$filename.tar.gz"
fi
# If output is directory, use the default filename
if [[ -d "$output" ]]; then
output="$output/$filename.tar.gz"
fi
set -e
echo "Packing sources of $revision to $output.."
mkdir -p "$(dirname "$output")"
rm -f "$output"
tmp="$GIT_ROOT/artifacts/tmp"
mkdir -p "$tmp"
config_file="$tmp/config"
HEAD_file="$tmp/HEAD"
start_time=$(date +%s)
# We need to had `.git/HEAD` and `.git/config` to the archive as the build expects those
echo $'[remote "origin"]\nurl="http://github.com/dotnet/dotnet"' > "$config_file"
echo "$revision" > "$HEAD_file"
git -C "$GIT_ROOT" archive \
-o "$output" \
--prefix "$filename/.git/" \
--add-file "$config_file" \
--add-file "$HEAD_file" \
--prefix "$filename/" \
"$revision" "$GIT_ROOT"
end_time=$(date +%s)
elapsed=$(( end_time - start_time ))
duration=$(date -u +%H:%M:%S "-d@$elapsed")
echo "Archive created in $duration"

View file

@ -2,7 +2,7 @@
<!--
Do not import the Arcade SDK for the local tooling projects. This lets us
build them with just the .NET Core SDK, simplifying tarball build.
build them with just the .NET Core SDK, simplifying the build.
-->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>

View file

@ -9,7 +9,6 @@
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="NuGetPack" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ZipFileExtractToDirectory" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceRegexInFiles" />
<ItemGroup>
<BuildTasksTarget Include="Restore;Build;InstallResolver" />
@ -23,7 +22,6 @@
<CallTarget Targets="
UnpackTarballs;
BuildXPlatTasks;
PatchPackageVersions;
BuildLeakDetection;
ExtractToolPackage;
GenerateRootFs;
@ -67,37 +65,6 @@
<Copy SourceFiles="@(UnpackedSourceBuildReferencePackages)" DestinationFiles="$(ReferencePackagesDir)%(Filename)%(Extension)" />
<!-- remove some reference packages that are generated incorrectly and instead use the prebuilt checked-in version instead -->
<!-- relevant issues: https://github.com/dotnet/runtime/issues/44646, https://github.com/dotnet/runtime/issues/45183,
https://github.com/dotnet/runtime/issues/45417. this should be fixed for the 6.0 release. -->
<ItemGroup>
<PrebuiltPackagesToUse Include="$(PrebuiltPackagesPath)/*.nupkg" />
<ReferencePackagesToOverride Include="@(PrebuiltPackagesToUse -> '$(ReferencePackagesDir)/%(Filename)%(Extension)')" />
</ItemGroup>
<Message Text="Overriding @(ReferencePackagesToOverride) with @(PrebuiltPackagesToUse)" Importance="High" />
<Delete Files="@(ReferencePackagesToOverride)" />
<!-- Setup the PackageVersions.props file to be a combination of source built and previously source built packages -->
<Copy SourceFiles="$(PrebuiltSourceBuiltPackagesPath)PackageVersions.props" DestinationFiles="$(IntermediatePath)PreviouslySourceBuiltPackageVersions.props" />
<PropertyGroup>
<PackageVersionsPropsFile>$(IntermediatePath)PackageVersions.props</PackageVersionsPropsFile>
<PackageVersionsPropsContents>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="PreviouslySourceBuiltPackageVersions.props" Condition="Exists('PreviouslySourceBuiltPackageVersions.props')" />
<Import Project="CurrentSourceBuiltPackageVersions.props" Condition="Exists('CurrentSourceBuiltPackageVersions.props')" />
</Project>
]]>
</PackageVersionsPropsContents>
</PropertyGroup>
<WriteLinesToFile File="$(PackageVersionsPropsFile)"
Lines="$(PackageVersionsPropsContents)"
Overwrite="true" />
<WriteLinesToFile File="$(CompletedSemaphorePath)UnpackTarballs.complete" Overwrite="true" />
</Target>
@ -119,16 +86,6 @@
<WriteLinesToFile File="$(CompletedSemaphorePath)BuildXPlatTasks.complete" Overwrite="true" />
</Target>
<!-- TODO: Remove this when the .NET 8 artifacts tarball no longer includes MicrosoftAspNetCoreAppRuntimePackageVersion -->
<Target Name="PatchPackageVersions">
<!-- Rename MicrosoftAspNetCoreAppRuntimePackageVersion so it isn't used
Fixes https://github.com/dotnet/installer/issues/14492 -->
<ReplaceRegexInFiles
InputFiles="$(IntermediatePath)PreviouslySourceBuiltPackageVersions.props"
OldTextRegex="\bMicrosoftAspNetCoreAppRuntimePackageVersion\b"
NewText="__unused" />
</Target>
<Target Name="BuildLeakDetection"
DependsOnTargets="ExtractToolPackage"
Inputs="$(MSBuildProjectFullPath)"

View file

@ -16,8 +16,8 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.UsageReport
{
public class WriteUsageReports : Task
{
private const string SnapshotPrefix = "PackageVersions.props.pre.";
private const string SnapshotSuffix = ".xml";
private const string SnapshotPrefix = "PackageVersions.";
private const string SnapshotSuffix = ".Current.props";
/// <summary>
/// Source usage data JSON file.
@ -26,7 +26,7 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.UsageReport
public string DataFile { get; set; }
/// <summary>
/// A set of "PackageVersions.props.pre.{repo}.xml" files. They are analyzed to find
/// A set of "PackageVersions.{repo}.Current.props" files. They are analyzed to find
/// packages built during source-build, and which repo built them. This info is added to the
/// report. New packages are associated to a repo by going through each PVP in ascending
/// file modification order.
@ -114,7 +114,7 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.UsageReport
string id = usage.PackageIdentity.Id;
string version = usage.PackageIdentity.Version.OriginalVersion;
string pvpIdent = WriteBuildOutputProps.GetPropertyName(id);
string pvpIdent = WritePackageVersionsProps.GetPropertyName(id, WritePackageVersionsProps.VersionPropertySuffix);
var sourceBuildCreator = new StringBuilder();
foreach (RepoOutput output in sourceBuildRepoOutputs)
@ -200,7 +200,7 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.UsageReport
// Get the creation time element.
?.Element(snapshot.Xml
.GetDefaultNamespace()
.GetName(WriteBuildOutputProps.CreationTimePropertyName))
.GetName(WritePackageVersionsProps.CreationTimePropertyName))
?.Value;
if (string.IsNullOrEmpty(creationTime))

View file

@ -1,142 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Microsoft.DotNet.Build.Tasks
{
public class WriteBuildOutputProps : Task
{
private static readonly Regex InvalidElementNameCharRegex = new Regex(@"(^|[^A-Za-z0-9])(?<FirstPartChar>.)");
public const string CreationTimePropertyName = "BuildOutputPropsCreationTime";
[Required]
public ITaskItem[] NuGetPackages { get; set; }
[Required]
public string OutputPath { get; set; }
/// <summary>
/// Adds a second PropertyGroup to the output XML containing a property with the time of
/// creation in UTC DateTime Ticks. This can be used to track creation time in situations
/// where file metadata isn't reliable or preserved.
/// </summary>
public bool IncludeCreationTimeProperty { get; set; }
/// <summary>
/// Properties to add to the build output props, which may not exist as nupkgs.
/// FOr example, this is used to pass the version of the CLI toolset archives.
///
/// %(Identity): Package identity.
/// %(Version): Package version.
/// </summary>
public ITaskItem[] ExtraProperties { get; set; }
/// <summary>
/// Additional assets to be added to the build output props.
/// i.e. /bin/obj/x64/Release/blobs/Toolset/3.0.100
/// This parameter is the <pathToAsset>/<assetName> portion only, and the asset
/// must be in a <AdditionalAssetDir>/<assetVersion> folder.
/// </summary>
public string[] AdditionalAssetDirs { get; set; }
public override bool Execute()
{
PackageIdentity[] latestPackages = NuGetPackages
.Select(item =>
{
using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath")))
{
return reader.GetIdentity();
}
})
.GroupBy(identity => identity.Id)
.Select(g => g.OrderBy(id => id.Version).Last())
.OrderBy(id => id.Id)
.ToArray();
var additionalAssets = (AdditionalAssetDirs ?? new string[0])
.Where(Directory.Exists)
.Where(dir => Directory.GetDirectories(dir).Count() > 0)
.Select(dir => new {
Name = new DirectoryInfo(dir).Name + "Version",
Version = new DirectoryInfo(Directory.EnumerateDirectories(dir).OrderBy(s => s).Last()).Name
}).ToArray();
Directory.CreateDirectory(Path.GetDirectoryName(OutputPath));
using (var outStream = File.Open(OutputPath, FileMode.Create))
using (var sw = new StreamWriter(outStream, new UTF8Encoding(false)))
{
sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>");
sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
sw.WriteLine(@" <PropertyGroup>");
foreach (PackageIdentity packageIdentity in latestPackages)
{
string propertyName = GetPropertyName(packageIdentity.Id);
sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>");
propertyName = GetAlternatePropertyName(packageIdentity.Id);
sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>");
}
foreach (var extraProp in ExtraProperties ?? Enumerable.Empty<ITaskItem>())
{
string propertyName = extraProp.GetMetadata("Identity");
bool doNotOverwrite = false;
string overwriteCondition = string.Empty;
if (bool.TryParse(extraProp.GetMetadata("DoNotOverwrite"), out doNotOverwrite) && doNotOverwrite)
{
overwriteCondition = $" Condition=\"'$({propertyName})' == ''\"";
}
sw.WriteLine($" <{propertyName}{overwriteCondition}>{extraProp.GetMetadata("Version")}</{propertyName}>");
}
foreach (var additionalAsset in additionalAssets)
{
sw.WriteLine($" <{additionalAsset.Name}>{additionalAsset.Version}</{additionalAsset.Name}>");
}
sw.WriteLine(@" </PropertyGroup>");
if (IncludeCreationTimeProperty)
{
sw.WriteLine(@" <PropertyGroup>");
sw.WriteLine($@" <{CreationTimePropertyName}>{DateTime.UtcNow.Ticks}</{CreationTimePropertyName}>");
sw.WriteLine(@" </PropertyGroup>");
}
sw.WriteLine(@"</Project>");
}
return true;
}
public static string GetPropertyName(string id)
{
string formattedId = InvalidElementNameCharRegex.Replace(
id,
match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant()
?? string.Empty);
return $"{formattedId}PackageVersion";
}
public static string GetAlternatePropertyName(string id)
{
string formattedId = InvalidElementNameCharRegex.Replace(
id,
match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant()
?? string.Empty);
return $"{formattedId}Version";
}
}
}

View file

@ -0,0 +1,326 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
namespace Microsoft.DotNet.Build.Tasks
{
public class VersionEntry
{
public string Name;
public string Version;
}
/// <summary>
/// Creates a props file that is used as the input for a repo-level build. The props file
/// includes package version numbers that should be used by the repo build and additional special properties.
///
/// There are two types of input props that can be written:
/// - Versions of union of all packages produced by the builds are added. (AllPackages)
/// - Only versions of packages that are listed as dependencies of a repo are added. (DependenciesOnly)
///
/// The former represents the current way that source build works for most repos. The latter represents the desired
/// methodology (PVP Flow). PVP flow closely matches how the product is built in non-source-build mode.
/// </summary>
public class WritePackageVersionsProps : Microsoft.Build.Utilities.Task
{
private static readonly Regex InvalidElementNameCharRegex = new Regex(@"(^|[^A-Za-z0-9])(?<FirstPartChar>.)");
public const string CreationTimePropertyName = "BuildOutputPropsCreationTime";
public const string VersionPropertySuffix = "Version";
private const string VersionPropertyAlternateSuffix = "PackageVersion";
private const string PinnedAttributeName = "Pinned";
private const string DependencyAttributeName = "Dependency";
private const string NameAttributeName = "Name";
private const string AllPackagesVersionPropsFlowType = "AllPackages";
private const string DependenciesOnlyVersionPropsFlowType = "DependenciesOnly";
private const string DefaultVersionPropsFlowType = AllPackagesVersionPropsFlowType;
/// <summary>
/// Set of input nuget package files to generate version properties for.
/// </summary>
[Required]
public ITaskItem[] NuGetPackages { get; set; }
/// <summary>
/// File where the version properties should be written.
/// </summary>
[Required]
public string OutputPath { get; set; }
/// <summary>
/// Adds a second PropertyGroup to the output XML containing a property with the time of
/// creation in UTC DateTime Ticks. This can be used to track creation time in situations
/// where file metadata isn't reliable or preserved.
/// </summary>
public bool IncludeCreationTimeProperty { get; set; }
/// <summary>
/// Properties to add to the build output props, which may not exist as nupkgs.
/// FOr example, this is used to pass the version of the CLI toolset archives.
///
/// %(Identity): Package identity.
/// %(Version): Package version.
/// </summary>
public ITaskItem[] ExtraProperties { get; set; }
/// <summary>
/// Additional assets to be added to the build output props.
/// i.e. /bin/obj/x64/Release/blobs/Toolset/3.0.100
/// This parameter is the <pathToAsset>/<assetName> portion only, and the asset
/// must be in a <AdditionalAssetDir>/<assetVersion> folder.
/// </summary>
public string[] AdditionalAssetDirs { get; set; }
/// <summary>
/// Indicates which properties will be written into the Version props file.
/// If AllPackages (Default), all packages from previously built repos will be written.
/// If DependenciesOnly, then only those packages appearing as dependencies in
/// Version.Details.xml will show up. The VersionsDetails property must be set to a
/// valid Version.Details.xml path when DependenciesOnly is used.
/// </summary>
public string VersionPropsFlowType { get; set; } = DefaultVersionPropsFlowType;
/// <summary>
/// If VersionPropsFlowType is set to DependenciesOnly, should be the path to the Version.Detail.xml file for the repo.
/// </summary>
public string VersionDetails { get; set; }
/// <summary>
/// Retrieve the set of the dependencies from the repo's Version.Details.Xml file.
/// </summary>
/// <returns>Hash set of dependency names. </returns>
private HashSet<string> GetDependences()
{
XmlDocument document = new XmlDocument();
try
{
document.Load(VersionDetails);
}
catch (Exception e)
{
Log.LogErrorFromException(e);
return null;
}
HashSet<string> dependencyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
// Load the nodes, filter those that are not pinned, and
XmlNodeList dependencyNodes = document.DocumentElement.SelectNodes($"//{DependencyAttributeName}");
foreach (XmlNode dependency in dependencyNodes)
{
if (dependency.NodeType == XmlNodeType.Comment || dependency.NodeType == XmlNodeType.Whitespace)
{
continue;
}
bool isPinned = false;
XmlAttribute pinnedAttribute = dependency.Attributes[PinnedAttributeName];
if (pinnedAttribute != null && !bool.TryParse(pinnedAttribute.Value, out isPinned))
{
Log.LogError($"The '{PinnedAttributeName}' attribute is set but the value " +
$"'{pinnedAttribute.Value}' is not a valid boolean...");
return null;
}
if (isPinned)
{
continue;
}
var name = dependency.Attributes[NameAttributeName]?.Value?.Trim();
if (string.IsNullOrEmpty(name))
{
Log.LogError($"The '{NameAttributeName}' attribute must be specified.");
return null;
}
dependencyNames.Add(name);
}
return dependencyNames;
}
/// <summary>
/// Filter a set of input dependencies to those that appear in <paramref name="dependencies"/>
/// </summary>
/// <param name="input">Input set of entries</param>
/// <param name="dependencies">Set of dependencies</param>
/// <returns>Set of <paramref name="input"/> that appears in <paramref name="dependencies"/></returns>
private IEnumerable<VersionEntry> FilterNonDependencies(IEnumerable<VersionEntry> input, HashSet<string> dependencies)
{
return input.Where(entry => dependencies.Contains(entry.Name));
}
public override bool Execute()
{
if (VersionPropsFlowType != AllPackagesVersionPropsFlowType &&
VersionPropsFlowType != DependenciesOnlyVersionPropsFlowType)
{
Log.LogError($"Valid version flow types are '{DependenciesOnlyVersionPropsFlowType}' and '{AllPackagesVersionPropsFlowType}'");
return !Log.HasLoggedErrors;
}
if (VersionPropsFlowType == DependenciesOnlyVersionPropsFlowType && (string.IsNullOrEmpty(VersionDetails) || !File.Exists(VersionDetails)))
{
Log.LogError($"When version flow type is DependenciesOnly, the VersionDetails task parameter must point to a valid path to the Version.Details.xml file for the repo. " +
"Provided file path '{VersionDetails}' does not exist.");
return !Log.HasLoggedErrors;
}
// First, obtain version information from the packages and additional assets that
// are provided.
var latestPackages = NuGetPackages
.Select(item =>
{
using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath")))
{
return reader.GetIdentity();
}
})
.GroupBy(identity => identity.Id)
.Select(g => g.OrderBy(id => id.Version).Last())
.OrderBy(id => id.Id)
.Select(identity => new VersionEntry()
{
Name = identity.Id,
Version = identity.Version.ToString()
});
var additionalAssets = (AdditionalAssetDirs ?? new string[0])
.Where(Directory.Exists)
.Where(dir => Directory.GetDirectories(dir).Count() > 0)
.Select(dir => new VersionEntry()
{
Name = new DirectoryInfo(dir).Name,
Version = new DirectoryInfo(Directory.EnumerateDirectories(dir).OrderBy(s => s).Last()).Name
});
var packageElementsToWrite = latestPackages;
var additionalAssetElementsToWrite = additionalAssets;
// Then, if version flow type is "DependenciesOnly", filter those
// dependencies that do not appear in the version.details.xml file.
if (VersionPropsFlowType == DependenciesOnlyVersionPropsFlowType)
{
var dependencies = GetDependences();
if (Log.HasLoggedErrors)
{
return false;
}
packageElementsToWrite = FilterNonDependencies(packageElementsToWrite, dependencies);
additionalAssetElementsToWrite = FilterNonDependencies(additionalAssetElementsToWrite, dependencies);
}
Directory.CreateDirectory(Path.GetDirectoryName(OutputPath));
using (var outStream = File.Open(OutputPath, FileMode.Create))
using (var sw = new StreamWriter(outStream, new UTF8Encoding(false)))
{
sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>");
sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
WriteVersionEntries(sw, packageElementsToWrite, "packages");
WriteExtraProperties(sw);
WriteVersionEntries(sw, additionalAssetElementsToWrite, "additional assets");
if (IncludeCreationTimeProperty)
{
sw.WriteLine(@" <PropertyGroup>");
sw.WriteLine($@" <{CreationTimePropertyName}>{DateTime.UtcNow.Ticks}</{CreationTimePropertyName}>");
sw.WriteLine(@" </PropertyGroup>");
}
sw.WriteLine(@"</Project>");
}
return !Log.HasLoggedErrors;
}
/// <summary>
/// Write properties specified in the "ExtraProperties task parameter
/// </summary>
/// <param name="sw">Stream writer</param>
private void WriteExtraProperties(StreamWriter sw)
{
if (ExtraProperties == null)
{
return;
}
sw.WriteLine(@" <!-- Extra properties -->");
sw.WriteLine(@" <PropertyGroup>");
foreach (var extraProp in ExtraProperties ?? Enumerable.Empty<ITaskItem>())
{
string propertyName = extraProp.GetMetadata("Identity");
bool doNotOverwrite = false;
string overwriteCondition = string.Empty;
if (bool.TryParse(extraProp.GetMetadata("DoNotOverwrite"), out doNotOverwrite) && doNotOverwrite)
{
overwriteCondition = $" Condition=\"'$({propertyName})' == ''\"";
}
sw.WriteLine($" <{propertyName}{overwriteCondition}>{extraProp.GetMetadata("Version")}</{propertyName}>");
}
sw.WriteLine(@" </PropertyGroup>");
}
/// <summary>
/// Write properties for the version numbers required for this repo.
/// </summary>
/// <param name="sw">Stream writer</param>
/// <param name="entries">Version entries</param>
private void WriteVersionEntries(StreamWriter sw, IEnumerable<VersionEntry> entries, string entryType)
{
if (!entries.Any())
{
return;
}
sw.WriteLine($" <!-- Versions of {entryType} produced by earlier stages of the build -->");
if (VersionPropsFlowType == DependenciesOnlyVersionPropsFlowType)
{
sw.WriteLine(@" <!-- Only those packages/assets that are explicit dependencies of this repo are included. -->");
}
sw.WriteLine(@" <PropertyGroup>");
foreach (var package in entries)
{
string propertyName = GetPropertyName(package.Name, VersionPropertySuffix);
string alternatePropertyName = GetPropertyName(package.Name, VersionPropertyAlternateSuffix);
sw.WriteLine($" <{propertyName}>{package.Version}</{propertyName}>");
sw.WriteLine($" <{alternatePropertyName}>{package.Version}</{alternatePropertyName}>");
}
sw.WriteLine(@" </PropertyGroup>");
}
public static string GetPropertyName(string id, string suffix)
{
string formattedId = InvalidElementNameCharRegex.Replace(
id,
match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant()
?? string.Empty);
return $"{formattedId}{suffix}";
}
}
}

View file

@ -1,156 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Microsoft.DotNet.Build.Tasks
{
public class WriteRestoreSourceAndVersionProps : Task
{
private static readonly Regex InvalidElementNameCharRegex = new Regex(@"(^|[^A-Za-z0-9])(?<FirstPartChar>.)");
public const string CreationTimePropertyName = "BuildOutputPropsCreationTime";
[Required]
public ITaskItem[] RestoreSources { get; set; }
[Required]
public ITaskItem[] NuGetPackages { get; set; }
[Required]
public string OutputPath { get; set; }
/// <summary>
/// Adds a second PropertyGroup to the output XML containing a property with the time of
/// creation in UTC DateTime Ticks. This can be used to track creation time in situations
/// where file metadata isn't reliable or preserved.
/// </summary>
public bool IncludeCreationTimeProperty { get; set; }
/// <summary>
/// Properties to add to the build output props, which may not exist as nupkgs.
/// FOr example, this is used to pass the version of the CLI toolset archives.
///
/// %(Identity): Package identity.
/// %(Version): Package version.
/// </summary>
public ITaskItem[] ExtraProperties { get; set; }
/// <summary>
/// Additional assets to be added to the build output props.
/// i.e. /bin/obj/x64/Release/blobs/Toolset/3.0.100
/// This parameter is the <pathToAsset>/<assetName> portion only, and the asset
/// must be in a <AdditionalAssetDir>/<assetVersion> folder.
/// </summary>
public string[] AdditionalAssetDirs { get; set; }
public override bool Execute()
{
PackageIdentity[] latestPackages = NuGetPackages
.Select(item =>
{
using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath")))
{
return reader.GetIdentity();
}
})
.GroupBy(identity => identity.Id)
.Select(g => g.OrderBy(id => id.Version).Last())
.OrderBy(id => id.Id)
.ToArray();
var additionalAssets = (AdditionalAssetDirs ?? new string[0])
.Where(Directory.Exists)
.Where(dir => Directory.GetDirectories(dir).Count() > 0)
.Select(dir => new {
Name = new DirectoryInfo(dir).Name + "Version",
Version = new DirectoryInfo(Directory.EnumerateDirectories(dir).OrderBy(s => s).Last()).Name
}).ToArray();
Directory.CreateDirectory(Path.GetDirectoryName(OutputPath));
using (var outStream = File.Open(OutputPath, FileMode.Create))
using (var sw = new StreamWriter(outStream, new UTF8Encoding(false)))
{
sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>");
sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
sw.WriteLine(@" <PropertyGroup>");
sw.WriteLine(@" <DotNetRestoreSources>");
foreach (ITaskItem restoreSourceItem in RestoreSources)
{
sw.WriteLine($" {restoreSourceItem.ItemSpec};");
}
sw.WriteLine(@" </DotNetRestoreSources>");
sw.WriteLine(@" </PropertyGroup>");
sw.WriteLine(@" <PropertyGroup>");
foreach (PackageIdentity packageIdentity in latestPackages)
{
string propertyName = GetPropertyName(packageIdentity.Id);
string shortPropertyName = GetShortPropertyName(packageIdentity.Id);
sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>");
sw.WriteLine($" <{shortPropertyName}>{packageIdentity.Version}</{shortPropertyName}>");
}
foreach (var extraProp in ExtraProperties ?? Enumerable.Empty<ITaskItem>())
{
string propertyName = extraProp.GetMetadata("Identity");
bool doNotOverwrite = false;
string overwriteCondition = string.Empty;
if (bool.TryParse(extraProp.GetMetadata("DoNotOverwrite"), out doNotOverwrite) && doNotOverwrite)
{
overwriteCondition = $" Condition=\"'$({propertyName})' == ''\"";
}
sw.WriteLine($" <{propertyName}{overwriteCondition}>{extraProp.GetMetadata("Version")}</{propertyName}>");
}
foreach (var additionalAsset in additionalAssets)
{
sw.WriteLine($" <{additionalAsset.Name}>{additionalAsset.Version}</{additionalAsset.Name}>");
}
sw.WriteLine(@" </PropertyGroup>");
if (IncludeCreationTimeProperty)
{
sw.WriteLine(@" <PropertyGroup>");
sw.WriteLine($@" <{CreationTimePropertyName}>{DateTime.UtcNow.Ticks}</{CreationTimePropertyName}>");
sw.WriteLine(@" </PropertyGroup>");
}
sw.WriteLine(@"</Project>");
}
return true;
}
public static string GetPropertyName(string id)
{
string formattedId = InvalidElementNameCharRegex.Replace(
id,
match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant()
?? string.Empty);
return $"{formattedId}PackageVersion";
}
public static string GetShortPropertyName(string id)
{
string formattedId = InvalidElementNameCharRegex.Replace(
id,
match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant()
?? string.Empty);
return $"{formattedId}Version";
}
}
}

View file

@ -1,43 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.IO;
using System.Text;
namespace Microsoft.DotNet.Build.Tasks
{
public class WriteRestoreSourceProps : Task
{
[Required]
public ITaskItem[] RestoreSources { get; set; }
[Required]
public string OutputPath { get; set; }
public override bool Execute()
{
Directory.CreateDirectory(Path.GetDirectoryName(OutputPath));
using (var outStream = File.Open(OutputPath, FileMode.Create))
using (var sw = new StreamWriter(outStream, new UTF8Encoding(false)))
{
sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>");
sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
sw.WriteLine(@" <PropertyGroup>");
sw.WriteLine(@" <DotNetRestoreSources>");
foreach (ITaskItem restoreSourceItem in RestoreSources)
{
sw.WriteLine($" {restoreSourceItem.ItemSpec};");
}
sw.WriteLine(@" </DotNetRestoreSources>");
sw.WriteLine(@" </PropertyGroup>");
sw.WriteLine(@"</Project>");
}
return true;
}
}
}

View file

@ -7,7 +7,7 @@ SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
usage() {
echo "usage: $0 [options]"
echo ""
echo " Prepares a tarball to be built by downloading Private.SourceBuilt.Artifacts.*.tar.gz and"
echo " Prepares the environment to be built by downloading Private.SourceBuilt.Artifacts.*.tar.gz and"
echo " installing the version of dotnet referenced in global.json"
echo "options:"
echo " --bootstrap Build a bootstrap version of previously source-built packages archive."

View file

@ -22,6 +22,12 @@
Repo specific semaphore path for incremental build
-->
<RepoCompletedSemaphorePath>$(CompletedSemaphorePath)$(RepositoryName)/</RepoCompletedSemaphorePath>
<!-- Paths to the version props files -->
<CurrentSourceBuiltPackageVersionPropsPath>$(IntermediatePath)PackageVersions.$(RepositoryName).Current.props</CurrentSourceBuiltPackageVersionPropsPath>
<PreviouslySourceBuiltPackageVersionPropsPath>$(IntermediatePath)PackageVersions.$(RepositoryName).Previous.props</PreviouslySourceBuiltPackageVersionPropsPath>
<PackageVersionPropsPath>$(IntermediatePath)PackageVersions.$(RepositoryName).props</PackageVersionPropsPath>
<PackageVersionPropsFlowType>AllPackages</PackageVersionPropsFlowType>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
@ -39,7 +45,7 @@
<!-- A human-readable description of what's building and why. -->
<PropertyGroup>
<ProjectBuildReason>'$(RepositoryName) in tarball'</ProjectBuildReason>
<ProjectBuildReason>'$(RepositoryName)'</ProjectBuildReason>
</PropertyGroup>
<ItemGroup>
@ -68,7 +74,6 @@
<EnvironmentVariables Include="PreReleaseVersionLabel=$(PreReleaseVersionLabel)" />
<EnvironmentVariables Include="PackageVersionStamp=$(PreReleaseVersionLabel)" />
<EnvironmentVariables Include="PB_VersionStamp=$(PreReleaseVersionLabel)" />
<!-- We pass '-ci', but also apply ci mode via env var for edge cases. (E.g. misbehaving inner builds.) -->
<EnvironmentVariables Include="ContinuousIntegrationBuild=true" />

View file

@ -13,14 +13,13 @@
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateJson" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateNuGetConfigPackageSourcesMappings" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ValidateUsageAgainstBaseline" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteBuildOutputProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageVersionsProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageUsageData" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteRestoreSourceProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteRestoreSourceAndVersionProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageReports" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteVersionsFile" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ZipFileExtractToDirectory" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceRegexInFiles" />
<!--
Central property to define that a repo doesn't implement any of the Repo API. If a repo adds an
@ -54,7 +53,6 @@
</PropertyGroup>
<!-- Source override arguments -->
<PropertyGroup Condition="'$(SourceOverrideRepoApiImplemented)' == 'true'">
<RepoApiArgs>$(RepoApiArgs) /p:DotNetRestoreSourcePropsPath=$(RestoreSourcePropsPath)</RepoApiArgs>
<RepoApiArgs>$(RepoApiArgs) /p:DotNetBuildOffline=true</RepoApiArgs>
</PropertyGroup>
<!-- Output placement arguments -->
@ -150,7 +148,7 @@
NewText="_InitializeBuildToolFramework=&quot;%24{_OverrideArcadeInitializeBuildToolFramework-netcoreapp3.1}&quot;" />
<!-- Temporary workaround for when the ci option is specified, non-zero exit are swallowed which prevents builds from failing within
the tarball build preocess. https://github.com/dotnet/source-build/issues/2307 -->
the build process. https://github.com/dotnet/source-build/issues/2307 -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="ExitWithExitCode 0"
NewText="ExitWithExitCode $exit_code" />
@ -170,10 +168,8 @@
<ReferencePackagesNuGetSourceName>reference-packages</ReferencePackagesNuGetSourceName>
<SourceBuiltNuGetSourceName>source-built</SourceBuiltNuGetSourceName>
<ExtraSourcesNuGetSourceName>ExtraSources</ExtraSourcesNuGetSourceName>
<DotNet5InternalTransportNuGetSourceName>dotnet5-internal-transport</DotNet5InternalTransportNuGetSourceName>
<SourceBuildSources>$(PrebuiltNuGetSourceName);$(PreviouslySourceBuiltNuGetSourceName);$(ReferencePackagesNuGetSourceName);$(SourceBuiltNuGetSourceName)</SourceBuildSources>
<SourceBuildSources Condition="'$(ExtraRestoreSourcePath)' != ''">$(SourceBuildSources);$(ExtraSourcesNuGetSourceName)</SourceBuildSources>
<SourceBuildSources Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != '' and '$(SetUpInternalTransportFeed)' == 'true'">$(SourceBuildSources);$(DotNet5InternalTransportNuGetSourceName)</SourceBuildSources>
</PropertyGroup>
<!-- Update the detected or manually specified NuGetConfigFile, but also allow multiple. -->
@ -210,78 +206,11 @@
SourcePath="$(ExtraRestoreSourcePath)"
Condition="'$(ExtraRestoreSourcePath)' != ''" />
<!--
The internal transport feed is dynamically added by Arcade by a script called directly in the
official pipeline, so in some cases we need to do the same here.
-->
<AddSourceToNuGetConfig
Condition="
'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != '' and
'$(SetUpInternalTransportFeed)' == 'true'"
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="$(DotNet5InternalTransportNuGetSourceName)"
SourcePath="https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json" />
<UpdateNuGetConfigPackageSourcesMappings
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
BuildWithOnlineSources="$(BuildWithOnlineSources)"
SourceBuildSources="$(SourceBuildSources)" />
<!-- Update NuGet.Config files that have deprecated myget feeds -->
<ItemGroup>
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/nuget-build/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://www.myget.org/F/nugetbuild/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"
NewFeed="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/vstest/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/mstestv2/auth/1e768268-8c95-4e7e-9fd2-0eb1b1b69b18/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/interactive-window/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/mstestv2/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/vsunittesting/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/msbuild/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json" />
</ItemGroup>
<ReplaceFeedsInNugetConfig InputFile="%(NuGetConfigFiles.Identity)"
FeedMapping="@(LegacyFeedMapping)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateNuGetConfig.complete" Overwrite="true" />
</Target>
@ -303,59 +232,67 @@
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateGlobalJsonVersions.complete" Overwrite="true" />
</Target>
<Target Name="CreateBuildOutputProps"
<!-- Before a repository builds, set up the version property files that override the repo's defaults.
There are 3 files generated -->
<Target Name="CreateBuildInputProps"
BeforeTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CreateBuildOutputProps.complete">
Outputs="$(RepoCompletedSemaphorePath)CreateBuildInputProps.complete">
<ItemGroup>
<_CurrentSourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
<_PreviouslyBuiltSourceBuiltPackages Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
<_CurrentAdditionalAssetDirs Include="$(SourceBuiltToolsetDir)" Condition="Exists('$(SourceBuiltToolsetDir)')" />
</ItemGroup>
<Error Condition="'$(PackageVersionPropsFlowType)' != 'AllPackages' and '$(PackageVersionPropsFlowType)' != 'DependenciesOnly'"
Text="Invalid PackageVersionPropsFlowType '$(PackageVersionPropsFlowType)'. Must be 'AllPackages' or 'DependenciesOnly'." />
<PropertyGroup>
<_PackageVersionPropsBackupPath>$(PackageVersionPropsPath).pre.$(RepositoryName).xml</_PackageVersionPropsBackupPath>
<_VersionDetailsXml Condition="'$(PackageVersionPropsFlowType)' == 'DependenciesOnly'">$(ProjectDirectory)/eng/Version.Details.xml</_VersionDetailsXml>
</PropertyGroup>
<ItemGroup>
<PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
<_AdditionalAssetDirs Include="$(SourceBuiltToolsetDir)" Condition="Exists('$(SourceBuiltToolsetDir)')" />
</ItemGroup>
<WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
<!-- Write the build input properties, then save off a copy that will be used for generating usage reports later -->
<WritePackageVersionsProps NuGetPackages="@(_CurrentSourceBuiltPackages)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
AdditionalAssetDirs="@(_AdditionalAssetDirs)"
VersionPropsFlowType="$(PackageVersionPropsFlowType)"
VersionDetails="$(_VersionDetailsXml)"
AdditionalAssetDirs="@(_CurrentAdditionalAssetDirs)"
OutputPath="$(CurrentSourceBuiltPackageVersionPropsPath)" />
<WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
IncludeCreationTimeProperty="true"
OutputPath="$(_PackageVersionPropsBackupPath)" />
<!-- Create previously source-built inputs info -->
<WritePackageVersionsProps NuGetPackages="@(_PreviouslyBuiltSourceBuiltPackages)"
VersionPropsFlowType="$(PackageVersionPropsFlowType)"
VersionDetails="$(_VersionDetailsXml)"
OutputPath="$(PreviouslySourceBuiltPackageVersionPropsPath)" />
<Message Importance="High" Text="$(RepositoryName) using package version properties saved at $(_PackageVersionPropsBackupPath) " />
<!-- Rename MicrosoftAspNetCoreAppRuntimePackageVersion so it isn't used
Fixes https://github.com/dotnet/installer/issues/14492 -->
<ReplaceRegexInFiles InputFiles="$(PreviouslySourceBuiltPackageVersionPropsPath)"
OldTextRegex="\bMicrosoftAspNetCoreAppRuntimePackageVersion\b"
NewText="__unused" />
<ReadNuGetPackageInfos PackagePaths="@(PreviouslySourceBuiltPackages)">
<Output TaskParameter="PackageInfoItems" ItemName="_PreviouslySourceBuiltPackageInfos" />
</ReadNuGetPackageInfos>
<!-- Write a single file that contains imports for both the current and previously built packages -->
<PropertyGroup>
<PackageVersionsPropsContents>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(PreviouslySourceBuiltPackageVersionPropsPath)" />
<Import Project="$(CurrentSourceBuiltPackageVersionPropsPath)" />
</Project>
]]>
</PackageVersionsPropsContents>
</PropertyGroup>
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CreateBuildOutputProps.complete" Overwrite="true" />
</Target>
<WriteLinesToFile File="$(PackageVersionPropsPath)"
Lines="$(PackageVersionsPropsContents)"
Overwrite="true" />
<Target Name="CreateCombinedRestoreSourceAndVersionProps"
BeforeTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CreateCombinedRestoreSourceAndVersionProps.complete">
<ItemGroup>
<_DotNetRestoreSources Include="$(ExtraRestoreSourcePath)" Condition="'$(ExtraRestoreSourcePath)' != ''"/>
<_DotNetRestoreSources Include="$(SourceBuiltPackagesPath)" />
<_DotNetRestoreSources Include="$(ReferencePackagesDir)"/>
<_DotNetRestoreSources Include="$(PrebuiltPackagesPath)"/>
<_DotNetRestoreSources Include="$(PrebuiltSourceBuiltPackagesPath)"/>
<PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
<_AdditionalAssetDirs Include="$(SourceBuiltToolsetDir)" Condition="Exists('$(SourceBuiltToolsetDir)')" />
</ItemGroup>
<WriteRestoreSourceAndVersionProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
AdditionalAssetDirs="@(_AdditionalAssetDirs)"
RestoreSources="@(_DotNetRestoreSources)"
OutputPath="$(RestoreSourcePropsPath)" />
<Message Importance="High" Text="$(RepositoryName) using package version properties saved at $(CurrentSourceBuiltPackageVersionPropsPath) and $(PreviouslySourceBuiltPackageVersionPropsPath)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CreateCombinedRestoreSourceAndVersionProps.complete" Overwrite="true" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CreateBuildInputProps.complete" Overwrite="true" />
</Target>
<Target Name="Build"
@ -641,7 +578,7 @@
<ItemGroup>
<_PackagesNotCreatedReason Include="^ There may have been a silent failure in the submodule build. To confirm, check the build log file for undetected errors that may have prevented package creation: $(RepoConsoleLogFile)" />
<_PackagesNotCreatedReason Include="^ This error might be a false positive if $(RepositoryName) intentionally builds no nuget packages. If so, set the SkipEnsurePackagesCreated property to true in $(MSBuildProjectFullPath)" />
<_PackagesNotCreatedReason Include="^ The 'bin' directory might be dirty from a previous build and the package files already existed. If so, perform a clean build, or check which packages were already in 'bin' by opening $(_PackageVersionPropsBackupPath)" />
<_PackagesNotCreatedReason Include="^ The 'bin' directory might be dirty from a previous build and the package files already existed. If so, perform a clean build, or check which packages were already in 'bin' by opening $(CurrentSourceBuiltPackageVersionPropsPath)" />
<_PackagesNotCreatedReason Include="^ The packages may have been written to an unexpected directory. For example, some repos used bin/ and changed to artifacts/ to match Arcade. Check PackagesOutput in $(MSBuildProjectFullPath) (currently '$(PackagesOutput)')" />
</ItemGroup>
@ -702,7 +639,7 @@
<AllRestoredPackageFiles Include="$(LocalNuGetPackagesRoot)**/*.nupkg" />
<AllRestoredPackageFiles Include="$(PackagesDir)**/*.nupkg" />
<!-- Only contains packages when building a tarball. -->
<!-- Only contains packages when building. -->
<TarballPrebuiltPackageFiles Include="$(PrebuiltPackagesPath)*.nupkg" />
<SourceBuiltPackageFiles Include="$(SourceBuiltBlobFeedDir)**/*.nupkg" />

View file

@ -6,6 +6,8 @@
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-$(Platform)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(Platform)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-$(Platform)</OverrideTargetRid>
<_portableRidOverridden Condition="'$(TargetRid)' != '$(OverrideTargetRid)'">true</_portableRidOverridden>
<_portableRidOverridden Condition="'$(TargetRid)' == '$(OverrideTargetRid)'">false</_portableRidOverridden>
<!-- StandardSourceBuildArgs include -publish which is not supported by the aspnetcore build script. -->
<BuildCommandArgs>$(StandardSourceBuildArgs.Replace('--publish', ''))</BuildCommandArgs>
@ -14,7 +16,7 @@
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --no-build-nodejs</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(OverrideTargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=$(_portableRidOverridden) /p:TargetRuntimeIdentifier=$(OverrideTargetRid)</BuildCommandArgs>
<!-- Update to 1.0.0 version of reference assemblies which are built in SBRP instead of the preview.2 version
included by Arcade -->
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</BuildCommandArgs>

View file

@ -49,9 +49,6 @@
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<!-- This repo uses text-only template packages from the internal transport feed. -->
<SetUpInternalTransportFeed>true</SetUpInternalTransportFeed>
<!-- CS9057 - Caused by incoherency of analyzer assemblies during pre-release builds. -->
<RepoNoWarns>CS9057</RepoNoWarns>
</PropertyGroup>

View file

@ -53,8 +53,8 @@
<RepositoryReference Include="aspnetcore" />
<RepositoryReference Include="deployment-tools" />
<RepositoryReference Include="format" />
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="templating" />
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="test-templates" />
<!-- Tier 5 -->

View file

@ -39,7 +39,7 @@
The CentralPackageVersions SDK isn't actually source-built. We get it as a text-only prebuilt,
but the NuGet resolver seems flaky so we're using our resolver instead. We only have access to
the nupkg ahead of time when building a tarball, so only enable this workaround then.
the nupkg ahead of time when building, so only enable this workaround then.
-->
<ItemGroup>
<CentralPackageVersionsSdkOverride Include="Microsoft.Build.CentralPackageVersions" Group="CENTRAL_PACKAGE_VERSIONS" />

View file

@ -10,9 +10,6 @@
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<!-- Pass in package version props using the Product Construction (ProdCon) API. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:PB_PackageVersionPropsUrl=file:%2F%2F$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<!-- NuGet SDK resolver only checks nuget.config files. https://github.com/Microsoft/msbuild/issues/2914 -->

View file

@ -14,8 +14,7 @@
</PropertyGroup>
<ItemGroup>
<!-- TODO: Renable once nuget-client is building in tarball -->
<!-- <RepositoryReference Include="nuget-client" /> -->
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="source-build-externals" />
</ItemGroup>

View file

@ -108,7 +108,10 @@
{
"name": "nuget-client",
"defaultRemote": "https://github.com/NuGet/NuGet.Client",
"defaultRef": "dev"
"defaultRef": "dev",
"exclude":[
"src/NuGet.Clients/NuGet.VisualStudio.Client"
]
},
{
"name": "razor",

View file

@ -68,10 +68,10 @@
<PropertyGroup>
<VersionFeature21>30</VersionFeature21>
<VersionFeature31>31</VersionFeature31>
<VersionFeature31>32</VersionFeature31>
<VersionFeature50>17</VersionFeature50>
<VersionFeature60>11</VersionFeature60>
<VersionFeature70>0</VersionFeature70>
<VersionFeature60>13</VersionFeature60>
<VersionFeature70>2</VersionFeature70>
</PropertyGroup>
<Target Name="GenerateBundledVersionsProps" DependsOnTargets="SetupBundledComponents">
@ -515,7 +515,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<KnownFrameworkReference Include="Microsoft.NETCore.App"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.NETCore.App"
DefaultRuntimeFrameworkVersion="$(_NET70RuntimePackVersion)"
DefaultRuntimeFrameworkVersion="7.0.0"
LatestRuntimeFrameworkVersion="$(_NET70RuntimePackVersion)"
TargetingPackName="Microsoft.NETCore.App.Ref"
TargetingPackVersion="$(_NET70TargetingPackVersion)"
@ -561,7 +561,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
DefaultRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
DefaultRuntimeFrameworkVersion="7.0.0"
LatestRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
TargetingPackName="Microsoft.WindowsDesktop.App.Ref"
TargetingPackVersion="$(_WindowsDesktop70TargetingPackVersion)"
@ -573,7 +573,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App.WPF"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
DefaultRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
DefaultRuntimeFrameworkVersion="7.0.0"
LatestRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
TargetingPackName="Microsoft.WindowsDesktop.App.Ref"
TargetingPackVersion="$(_WindowsDesktop70TargetingPackVersion)"
@ -586,7 +586,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
DefaultRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
DefaultRuntimeFrameworkVersion="7.0.0"
LatestRuntimeFrameworkVersion="$(_WindowsDesktop70RuntimePackVersion)"
TargetingPackName="Microsoft.WindowsDesktop.App.Ref"
TargetingPackVersion="$(_WindowsDesktop70TargetingPackVersion)"
@ -599,7 +599,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<KnownFrameworkReference Include="Microsoft.AspNetCore.App"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.AspNetCore.App"
DefaultRuntimeFrameworkVersion="$(_AspNet70RuntimePackVersion)"
DefaultRuntimeFrameworkVersion="7.0.0"
LatestRuntimeFrameworkVersion="$(_AspNet70RuntimePackVersion)"
TargetingPackName="Microsoft.AspNetCore.App.Ref"
TargetingPackVersion="$(_AspNet70TargetingPackVersion)"

View file

@ -70,15 +70,15 @@
<MSBuildExtensionsOutputDirectory>$(LayoutDirectory)MSBuildExtensions</MSBuildExtensionsOutputDirectory>-->
</PropertyGroup>
<Error Condition=" '$(OfficialBuild)' == 'true' AND '$(_PatchNumber)' == '' "
Text="_PatchNumber should not be empty in an official build. Check if there were changes in Arcade." />
<Exec Command="git rev-list --count HEAD"
ConsoleToMSBuild="true"
Condition=" '$(GitCommitCount)' == '' ">
Condition=" '$(GitCommitCount)' == '' AND '$(_PatchNumber)' == '' ">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitCount" />
</Exec>
<Error Condition=" '$(OfficialBuild)' == 'true' And '$(_PatchNumber)' == '' "
Text="_PatchNumber should not be empty in an official build. Check if there were changes in Arcade." />
<PropertyGroup>
<GitCommitCount>$(GitCommitCount.PadLeft(6,'0'))</GitCommitCount>