Merge branch 'release/6.0.2xx' into release/6.0.3xx

This commit is contained in:
Jason Zhai 2022-03-09 22:10:08 -08:00
commit 85a7a87220
22 changed files with 1773 additions and 217 deletions

View file

@ -11,4 +11,4 @@ stages:
jobs:
- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
parameters:
tarballResourceId: installer-build-resource
installerBuildResourceId: installer-build-resource

View file

@ -11,4 +11,4 @@ stages:
jobs:
- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
parameters:
tarballResourceId: installer-build-resource
installerBuildResourceId: installer-build-resource

View file

@ -80,9 +80,12 @@ jobs:
# This prevents allocation of additional agents if the tarball build legs should be skipped.
# Only build the tarball if the PR touches source-build source.
- script: |
if curl "https://api.github.com/repos/dotnet/installer/pulls/$(System.PullRequest.PullRequestNumber)/files" | grep '"filename": "src/SourceBuild/*'
then
echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]true"
fi
# Temporarily disable tarball PR validation until source-build is supported in this channel.
echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]false"
# if curl "https://api.github.com/repos/dotnet/installer/pulls/$(System.PullRequest.PullRequestNumber)/files" | grep '"filename": "src/SourceBuild/*'
# then
# echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]true"
# fi
displayName: Tarball Build Check
name: Tarball_Build_Check

View file

@ -7,13 +7,15 @@ parameters:
# Dependent jobs that must be completed before this job will run
dependsOn:
# The resource id of the tarball to download and build
tarballResourceId: current
# Resource id of the installer build to retrieve source/product tarball's from
installerBuildResourceId: current
# The following parameters aren't expected to be passed in rather they are used for encapsulation
# -----------------------------------------------------------------------------------------------
buildJobTimeout: 300
centOS7Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20210714125450-5d87b80
centOS8Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-source-build-20211118190102-9355e7b
centOSStream9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-20220107135047-4cd394c
debian9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-20211001171226-047508b
fedora33Container: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-33-20210222183538-031e7d2
ubuntu1804Container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20210924170306-047508b
@ -38,37 +40,49 @@ jobs:
strategy:
matrix:
CentOS7-Online:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: true
CentOS7-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: false
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
CentOS7-Offline:
_BootstrapPrep: true
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_RunOnline: false
CentOS8-Offline:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS8Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
CentOSStream9-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOSStream9Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Fedora33-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Ubuntu1804-Offline:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.ubuntu1804Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
timeoutInMinutes: 300
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
@ -79,20 +93,13 @@ jobs:
- checkout: self
clean: true
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- template: /src/SourceBuild/Arcade/eng/common/templates/steps/source-build-build-tarball.yml
parameters:
buildArch: $(_BuildArch)
container: $(_Container)
excludeOmniSharpTests: $(_ExcludeOmniSharpTests)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
platform: $(_Platform)
prepScript: |
set -x
@ -104,7 +111,6 @@ jobs:
docker run --rm -v ${{ parameters.tarballDir }}:/tarball -w /tarball $(_Container) ./prep.sh ${customPrepArgs}
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}
tarballResourceId: ${{ parameters.tarballResourceId }}
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- job: Rebuild_Tarball
@ -121,8 +127,9 @@ jobs:
_PreviousSourceBuildArtifact: Build Tarball Fedora33-Offline_Artifacts
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_Platform: linux
_RunOnline: false
timeoutInMinutes: 180
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
@ -133,15 +140,6 @@ jobs:
- checkout: self
clean: true
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- download: current
artifact: $(_PreviousSourceBuildArtifact)
patterns: '*.tar.gz'
@ -159,6 +157,9 @@ jobs:
additionalBuildArgs: --with-sdk /tarball/.dotnet
buildArch: $(_BuildArch)
container: $(_Container)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
isBootstrapped: true
platform: $(_Platform)
prepScript: |
set -x
@ -168,4 +169,3 @@ jobs:
eval rm -f "$tarballFilePath"
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}
tarballResourceId: ${{ parameters.tarballResourceId }}

View file

@ -13,6 +13,15 @@ parameters:
# Skip running the OmniSharp smoke-tests
excludeOmniSharpTests: false
# Resource id of the installer build to retrieve source/product tarball's from
installerBuildResourceId: null
# Whether or not this is a bootstrapped build
isBootstrapped: false
# Platform the build is running on (linux, osx, win)
platform: null
# Script logic to prep the tarball for building
prepScript: null
@ -22,21 +31,32 @@ parameters:
# Directory to build the tarball in
tarballDir:
# Resource id of the tarball to download and build
tarballResourceId: null
steps:
- download: ${{ parameters.tarballResourceId }}
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- download: ${{ parameters.installerBuildResourceId }}
artifact: BlobArtifacts
patterns: '**/dotnet-sdk-source*.tar.gz'
displayName: Download Tarball
displayName: Download Source Tarball
- download: ${{ parameters.installerBuildResourceId }}
artifact: BlobArtifacts
patterns: '**/dotnet-sdk-!(*-*)-${{ parameters.platform }}-${{ parameters.buildArch }}.tar.gz'
displayName: Download MSFT sdk Tarball
- script: |
set -x
resourceIdPathSegment=
if [ '${{ parameters.tarballResourceId }}' != 'current' ]; then
resourceIdPathSegment='${{ parameters.tarballResourceId }}/'
if [ '${{ parameters.installerBuildResourceId }}' != 'current' ]; then
resourceIdPathSegment='${{ parameters.installerBuildResourceId }}/'
fi
mkdir -p "${{ parameters.tarballDir }}"
@ -70,7 +90,16 @@ steps:
rm -f ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/smoke-tests/online.NuGet.Config
cp NuGet.config ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/smoke-tests/online.NuGet.Config
docker run --rm -v ${{ parameters.tarballDir }}:/tarball -w /tarball -e EXCLUDE_OMNISHARP_TESTS=${{ parameters.excludeOmniSharpTests}} ${{ parameters.container }} ./build.sh --run-smoke-test ${{ parameters.additionalBuildArgs }}
dockerVolumeArgs="-v ${{ parameters.tarballDir }}:/tarball"
dockerEnvArgs="-e EXCLUDE_OMNISHARP_TESTS=${{ parameters.excludeOmniSharpTests}}"
if [ '${{ parameters.isBootstrapped}}' != 'true' && '${{ parameters.installerBuildResourceId }}' != 'current' ]; then
dockerVolumeArgs+=" -v $(PIPELINE.WORKSPACE)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/:/BlobArtifacts"
msftSdkTarballName=$(find "$(PIPELINE.WORKSPACE)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/" -name "dotnet-sdk-*-${{ parameters.Platform }}-${{ parameters.buildArch }}.tar.gz" -exec basename {} \;)
dockerEnvArgs+=" -e MSFT_SDK_TARBALL_PATH=/BlobArtifacts/$msftSdkTarballName"
fi
docker run --rm $dockerVolumeArgs -w /tarball $dockerEnvArgs ${{ parameters.container }} ./build.sh --run-smoke-test ${{ parameters.additionalBuildArgs }}
displayName: Run Tests
# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.

View file

@ -106,9 +106,23 @@
" />
</Target>
<Target Name="CreateSmokeTestPrereqs"
<Target Name="CreateSmokeTestPrereqsTarball"
AfterTargets="RunSmokeTest"
Condition="'$(SkipSmokeTestPrereqsTarballCreation)' != 'true'" >
Condition="'$(SkipSmokeTestPrereqsTarballCreation)' != 'true'"
DependsOnTargets="
CheckIfCreateSmokeTestPrereqsExistToPack;
CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"/>
<Target Name="CheckIfCreateSmokeTestPrereqsExistToPack">
<ItemGroup>
<Prereqs Include="test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/$(Configuration)/net6.0/smoke-tests/prereq-packages/**" />
</ItemGroup>
<Message Text="Found @(Prereqs->Count()) files in prereqs packages dir." Importance="High" />
</Target>
<Target Name="CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"
Condition="'@(Prereqs->Count())' != '0'">
<PropertyGroup>
<SmokeTestPrereqsTarballName>$(OutputPath)dotnet-smoke-test-prereqs.$(installerOutputPackageVersion).tar.gz</SmokeTestPrereqsTarballName>
</PropertyGroup>
@ -116,7 +130,7 @@
<Exec Command="tar --numeric-owner -czf $(SmokeTestPrereqsTarballName) ."
WorkingDirectory="./test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/$(Configuration)/net6.0/smoke-tests/prereq-packages/"/>
<Message Importance="High" Text="Packaged smoke-test prereqs to $(SmokeTestPrereqsTarballName)" />
<Message Importance="High" Text="Packaged smoke-test prereqs in '$(SmokeTestPrereqsTarballName)'" />
</Target>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UploadToAzure" />

View file

@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "6.0.200-preview.21603.2"
"dotnet": "6.0.200"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions": "2.0.1",

View file

@ -154,5 +154,6 @@
<ArcadeSharedFrameworkSdkOverride Include="Microsoft.DotNet.SharedFramework.Sdk" Group="ARCADE_SHARED_FX_SDK" Version="$(arcadeOutputPackageVersion)"/>
<ILSdkOverride Include="Microsoft.NET.Sdk.IL" Group="IL" />
<MsBuildTraversalSdkOverride Include="Microsoft.Build.Traversal" Group="MSBUILD_TRAVERSAL" Version="2.0.2"/>
<WindowsDesktopSdkOverride Include="Microsoft.Net.Sdk.WindowsDesktop" Group="WINDOWS_DESKTOP" Location="$(ToolsLocalDir)EmptySdk"/>
</ItemGroup>
</Project>

View file

@ -45,6 +45,7 @@
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
<UseSourceBuiltSdkOverride Include="@(WindowsDesktopSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

View file

@ -4,9 +4,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
@ -32,6 +34,35 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests
Assert.Null(message);
}
public static void Compare(string baselineFileName, string actual, ITestOutputHelper outputHelper)
{
string baselineFilePath = GetBaselineFilePath(baselineFileName);
string baseline = File.ReadAllText(baselineFilePath);
string? message = null;
if (baseline != actual)
{
string actualBaselineFilePath = Path.Combine(Environment.CurrentDirectory, $"{baselineFileName}");
File.WriteAllText(actualBaselineFilePath, actual);
// Retrieve a diff in order to provide a UX which calls out the diffs.
string diff = DiffFiles(baselineFilePath, actualBaselineFilePath, outputHelper);
message = $"{Environment.NewLine}Baseline '{baselineFilePath}' does not match actual '{actualBaselineFilePath}`. {Environment.NewLine}"
+ $"{diff}{Environment.NewLine}";
}
Assert.Null(message);
}
public static string DiffFiles(string file1Path, string file2Path, ITestOutputHelper outputHelper)
{
(Process Process, string StdOut, string StdErr) diffResult =
ExecuteHelper.ExecuteProcess("git", $"diff --no-index {file1Path} {file2Path}", outputHelper);
Assert.Equal(1, diffResult.Process.ExitCode);
return diffResult.StdOut;
}
private static string GetBaselineFilePath(string baselineFileName) => Path.Combine(Directory.GetCurrentDirectory(), "baselines", baselineFileName);
}
}

View file

@ -3,17 +3,21 @@
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal static class Config
{
public static string DotNetDirectory { get; } = Environment.GetEnvironmentVariable("DOTNET_DIR") ?? "./.dotnet";
public static string DotNetDirectory { get; } =
Environment.GetEnvironmentVariable("DOTNET_DIR") ?? Path.Combine(Directory.GetCurrentDirectory(), ".dotnet");
public static string DotNetTarballPath { get; } = Environment.GetEnvironmentVariable(DotNetTarballPathEnv) ?? string.Empty;
public const string DotNetTarballPathEnv = "DOTNET_TARBALL_PATH";
public static bool ExcludeOmniSharpTests { get; } =
bool.TryParse(Environment.GetEnvironmentVariable("EXCLUDE_OMNISHARP_TESTS"), out bool excludeOmniSharpTests) ? excludeOmniSharpTests : false;
public static bool ExcludeOnlineTests { get; } =
bool.TryParse(Environment.GetEnvironmentVariable("EXCLUDE_ONLINE_TESTS"), out bool excludeOnlineTests) ? excludeOnlineTests : false;
public static string MsftSdkTarballPath { get; } = Environment.GetEnvironmentVariable(MsftSdkTarballPathEnv) ?? string.Empty;
public const string MsftSdkTarballPathEnv = "MSFT_SDK_TARBALL_PATH";
public static string TargetRid { get; } = Environment.GetEnvironmentVariable("TARGET_RID") ?? string.Empty;
}

View file

@ -12,24 +12,27 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal class DotNetHelper
{
private static readonly object s_lockObj = new object();
public string DotNetPath { get; }
public string DotNetInstallDirectory { get; }
public DotNetHelper(ITestOutputHelper outputHelper)
{
if (!Directory.Exists(Config.DotNetDirectory))
lock (s_lockObj)
{
if (!File.Exists(Config.DotNetTarballPath))
if (!Directory.Exists(Config.DotNetDirectory))
{
throw new InvalidOperationException($"Tarball path '{Config.DotNetTarballPath}' specified in {Config.DotNetTarballPathEnv} does not exist.");
}
if (!File.Exists(Config.DotNetTarballPath))
{
throw new InvalidOperationException($"Tarball path '{Config.DotNetTarballPath}' specified in {Config.DotNetTarballPathEnv} does not exist.");
}
Directory.CreateDirectory(Config.DotNetDirectory);
ExecuteHelper.ExecuteProcess("tar", $"xzf {Config.DotNetTarballPath} -C {Config.DotNetDirectory}", outputHelper);
Directory.CreateDirectory(Config.DotNetDirectory);
ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"xzf {Config.DotNetTarballPath} -C {Config.DotNetDirectory}", outputHelper);
}
}
DotNetInstallDirectory = Path.Combine(Directory.GetCurrentDirectory(), Config.DotNetDirectory);
DotNetPath = Path.Combine(DotNetInstallDirectory, "dotnet");
DotNetPath = Path.Combine(Config.DotNetDirectory, "dotnet");
}
public void ExecuteDotNetCmd(string args, ITestOutputHelper outputHelper)

View file

@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.Linq;
using System.Text;
@ -12,7 +13,7 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal static class ExecuteHelper
{
public static (Process Process, string StdOut, string StdErr) ExecuteProcess(
string fileName, string args, ITestOutputHelper outputHelper)
string fileName, string args, ITestOutputHelper outputHelper, bool logOutput = false)
{
outputHelper.WriteLine($"Executing: {fileName} {args}");
@ -47,17 +48,33 @@ internal static class ExecuteHelper
process.WaitForExit();
string output = stdOutput.ToString().Trim();
if (outputHelper != null && !string.IsNullOrWhiteSpace(output))
if (logOutput && !string.IsNullOrWhiteSpace(output))
{
outputHelper.WriteLine(output);
}
string error = stdError.ToString().Trim();
if (outputHelper != null && !string.IsNullOrWhiteSpace(error))
if (logOutput && !string.IsNullOrWhiteSpace(error))
{
outputHelper.WriteLine(error);
}
return (process, output, error);
}
public static string ExecuteProcessValidateExitCode(string fileName, string args, ITestOutputHelper outputHelper)
{
(Process Process, string StdOut, string StdErr) result = ExecuteHelper.ExecuteProcess(fileName, args, outputHelper);
if (result.Process.ExitCode != 0)
{
ProcessStartInfo startInfo = result.Process.StartInfo;
string msg = $"Failed to execute {startInfo.FileName} {startInfo.Arguments}" +
$"{Environment.NewLine}Exit code: {result.Process.ExitCode}" +
$"{Environment.NewLine}Standard Error: {result.StdErr}";
throw new InvalidOperationException(msg);
}
return result.StdOut;
}
}

View file

@ -0,0 +1,92 @@
// 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 System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public class SdkContentTests
{
private ITestOutputHelper OutputHelper { get; }
private DotNetHelper DotNetHelper { get; }
public SdkContentTests(ITestOutputHelper outputHelper)
{
OutputHelper = outputHelper;
DotNetHelper = new DotNetHelper(outputHelper);
}
/// <Summary>
/// Verifies the file layout of the source built sdk tarball to the Microsoft build.
/// The differences are captured in baselines/MsftToSbSdkDiff.txt.
/// Version numbers that appear in paths are compared but are stripped from the baseline.
/// This makes the baseline durable between releases. This does mean however, entries
/// in the baseline may appear identical if the diff is version specific.
/// </Summary>
[Fact]
public void CompareMsftToSb()
{
if (string.IsNullOrWhiteSpace(Config.MsftSdkTarballPath))
{
OutputHelper.WriteLine($"skipping {nameof(CompareMsftToSb)} because {Config.MsftSdkTarballPathEnv} was not specified.");
return;
}
if (!File.Exists(Config.MsftSdkTarballPath))
{
throw new InvalidOperationException($"Tarball path '{Config.MsftSdkTarballPath}' specified in {Config.MsftSdkTarballPathEnv} does not exist.");
}
const string msftFileListingFileName = "msftSdkFiles.txt";
const string sbFileListingFileName = "sbSdkFiles.txt";
WriteTarballFileList(Config.MsftSdkTarballPath, msftFileListingFileName);
WriteTarballFileList(Config.DotNetTarballPath, sbFileListingFileName);
string diff = BaselineHelper.DiffFiles(msftFileListingFileName, sbFileListingFileName, OutputHelper);
diff = RemoveVersionedPaths(diff);
diff = RemoveDiffMarkers(diff);
diff = RemoveRids(diff);
BaselineHelper.Compare("MsftToSbSdk.diff", diff, OutputHelper);
}
private void WriteTarballFileList(string tarballPath, string outputFileName)
{
string fileListing = ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"tf {tarballPath}", OutputHelper);
IEnumerable<string> files = fileListing.Split(Environment.NewLine).OrderBy(path => path);
File.WriteAllLines(outputFileName, files);
}
private static string RemoveDiffMarkers(string source)
{
Regex indexRegex = new("^index .*", RegexOptions.Multiline);
string result = indexRegex.Replace(source, "index ------------");
Regex diffSegmentRegex = new("^@@ .* @@", RegexOptions.Multiline);
return diffSegmentRegex.Replace(result, "@@ ------------ @@");
}
private string RemoveRids(string diff) => diff.Replace(Config.TargetRid, "bannana.rid");
private static string RemoveVersionedPaths(string source)
{
// Remove semantic version path segments
string pathSeparator = Regex.Escape(Path.DirectorySeparatorChar.ToString());
// Regex source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
Regex semanticVersionRegex = new(
$"{pathSeparator}(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)"
+ $"(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))"
+ $"?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?{pathSeparator}");
string result = semanticVersionRegex.Replace(source, $"{Path.DirectorySeparatorChar}x.y.z{Path.DirectorySeparatorChar}");
// Remove net.x.y path segments
Regex netTfmRegex = new($"{pathSeparator}net[1-9]*.[0-9]{pathSeparator}");
return netTfmRegex.Replace(result, $"{Path.DirectorySeparatorChar}netx.y{Path.DirectorySeparatorChar}");
}
}

View file

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.IO;
using Xunit;
using Xunit.Abstractions;
using System;
using System.Linq;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
@ -31,7 +30,7 @@ public class XmlDocTests
{
List<string> missingXmlDoc = new();
string targetingPacksDirectory = Path.Combine(DotNetHelper.DotNetInstallDirectory, "packs");
string targetingPacksDirectory = Path.Combine(Config.DotNetDirectory, "packs");
foreach (string targetingPackAssembly in Directory.EnumerateFiles(targetingPacksDirectory, "*.dll", SearchOption.AllDirectories))
{
if (targetingPackAssembly.EndsWith("resources.dll"))
@ -42,8 +41,8 @@ public class XmlDocTests
string xmlFile = Path.ChangeExtension(targetingPackAssembly, ".xml");
if (!File.Exists(xmlFile))
{
string pathWithoutPacksPrefix = xmlFile.Substring(targetingPacksDirectory.Length + 1);
String[] pathParts = pathWithoutPacksPrefix.Split(Path.DirectorySeparatorChar);
string pathWithoutPacksPrefix = xmlFile[(targetingPacksDirectory.Length + 1)..];
string[] pathParts = pathWithoutPacksPrefix.Split(Path.DirectorySeparatorChar);
string pathWithoutVersion = string.Join(Path.DirectorySeparatorChar, pathParts.Take(1).Concat(pathParts.Skip(2)));
missingXmlDoc.Add(pathWithoutVersion);
}

View file

@ -250,12 +250,14 @@ function doCommand() {
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
"${dotnetCmd}" publish --self-contained true -r "$targetRid" /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-R2R-portable.binlog" /p:PublishTrimmed=true /p:PublishReadyToRun=true
}
else
runPublishScenarios() {
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
"${dotnetCmd}" publish --self-contained true -r "$targetRid" /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-R2R-portable.binlog" /p:PublishTrimmed=true /p:PublishReadyToRun=true
}
fi
if [ "$projectOutput" == "true" ]; then
@ -350,6 +352,8 @@ function runWebTests() {
doCommand C# razor "$@" new restore build run multi-rid-publish
doCommand C# blazorwasm "$@" new restore build run publish
doCommand C# blazorserver "$@" new restore build run publish
doCommand C# worker new restore
doCommand C# angular new restore
doCommand F# web "$@" new restore build run multi-rid-publish
doCommand F# mvc "$@" new restore build run multi-rid-publish

View file

@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<RepoRoot Condition="'$(RepoRoot)' == ''">$([MSBuild]::NormalizeDirectory('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'global.json'))'))</RepoRoot>
<RepositoryEngineeringDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'eng'))</RepositoryEngineeringDir>
</PropertyGroup>
<PropertyGroup>
<!-- Skip importing NuGet Pack targets which are imported from the Microsoft.NET.Sdk targets -->
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,9 @@
<Project>
<Target Name="_IsProjectRestoreSupported"/>
<Target Name="Restore"/>
<Target Name="Build"/>
<Target Name="Test"/>
<Target Name="Pack"/>
<Target Name="Publish"/>
</Project>

View file

@ -1,146 +0,0 @@
From 110fc28ea7c17d57bbd5ce8ed3fc4e2b0274c5b3 Mon Sep 17 00:00:00 2001
From: dseefeld <dseefeld@microsoft.com>
Date: Fri, 22 Oct 2021 22:17:37 +0000
Subject: [PATCH] Build a subset of roslyn projects
Some projects use Microsoft.NET.Sdk.WindowsDesktop sdk
which cannot be built using a boostrapped source-build
sdk, since WindowsDesktop is not supported. These cannot
be ignored using ExcludeFromSourceBuild because the project
still needs to be loaded and the sdk cannot be found.
See https://github.com/dotnet/roslyn/issues/57342
---
Roslyn.SourceBuild.slnf | 105 ++++++++++++++++++++++++++++++++++++++++
eng/SourceBuild.props | 2 +-
2 files changed, 106 insertions(+), 1 deletion(-)
create mode 100644 Roslyn.SourceBuild.slnf
diff --git a/Roslyn.SourceBuild.slnf b/Roslyn.SourceBuild.slnf
new file mode 100644
index 00000000000..e6f8eb315bf
--- /dev/null
+++ b/Roslyn.SourceBuild.slnf
@@ -0,0 +1,105 @@
+{
+ "solution": {
+ "path": "Roslyn.sln",
+ "projects": [
+ "src\\Deployment\\RoslynDeployment.csproj",
+ "src\\Compilers\\Core\\Portable\\Microsoft.CodeAnalysis.csproj",
+ "src\\Compilers\\Server\\VBCSCompiler\\VBCSCompiler.csproj",
+ "src\\Compilers\\CSharp\\csc\\csc.csproj",
+ "src\\Compilers\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.csproj",
+ "src\\Compilers\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.vbproj",
+ "src\\Workspaces\\Core\\Portable\\Microsoft.CodeAnalysis.Workspaces.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\BoundTreeGenerator\\CompilersBoundTreeGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\CSharpErrorFactsGenerator\\CSharpErrorFactsGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\CSharpSyntaxGenerator\\CSharpSyntaxGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\VisualBasicSyntaxGenerator\\VisualBasicSyntaxGenerator.vbproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\VisualBasicErrorFactsGenerator\\VisualBasicErrorFactsGenerator.vbproj",
+ "src\\Workspaces\\Core\\Desktop\\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj",
+ "src\\Workspaces\\Core\\MSBuild\\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj",
+ "src\\Workspaces\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj",
+ "src\\Workspaces\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj",
+ "src\\Features\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj",
+ "src\\Features\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.Features.csproj",
+ "src\\Features\\Core\\Portable\\Microsoft.CodeAnalysis.Features.csproj",
+ "src\\Scripting\\VisualBasic\\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj",
+ "src\\Scripting\\Core\\Microsoft.CodeAnalysis.Scripting.csproj",
+ "src\\Scripting\\CSharp\\Microsoft.CodeAnalysis.CSharp.Scripting.csproj",
+ "src\\ExpressionEvaluator\\Package\\ExpressionEvaluatorPackage.csproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.csproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.vbproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.ExpressionCompiler.csproj",
+ "src\\Compilers\\Core\\AnalyzerDriver\\AnalyzerDriver.shproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\BasicResultProvider.shproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\NetFX20\\BasicResultProvider.NetFX20.vbproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.vbproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\CSharpResultProvider.shproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\NetFX20\\CSharpResultProvider.NetFX20.csproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.CSharp.ResultProvider.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\ResultProvider.shproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\NetFX20\\ResultProvider.NetFX20.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.ResultProvider.csproj",
+ "src\\Compilers\\VisualBasic\\vbc\\vbc.csproj",
+ "src\\Compilers\\VisualBasic\\BasicAnalyzerDriver\\BasicAnalyzerDriver.shproj",
+ "src\\Compilers\\CSharp\\CSharpAnalyzerDriver\\CSharpAnalyzerDriver.shproj",
+ "src\\Compilers\\Core\\CommandLine\\CommandLine.shproj",
+ "src\\Compilers\\Extension\\Roslyn.Compilers.Extension.csproj",
+ "src\\Dependencies\\CodeAnalysis.Debugging\\Microsoft.CodeAnalysis.Debugging.shproj",
+ "src\\Dependencies\\PooledObjects\\Microsoft.CodeAnalysis.PooledObjects.shproj",
+ "src\\Workspaces\\Remote\\Core\\Microsoft.CodeAnalysis.Remote.Workspaces.csproj",
+ "src\\Workspaces\\Remote\\ServiceHub\\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj",
+ "src\\Compilers\\Core\\MSBuildTask\\Microsoft.Build.Tasks.CodeAnalysis.csproj",
+ "src\\Tools\\BuildBoss\\BuildBoss.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\FunctionResolver\\Microsoft.CodeAnalysis.FunctionResolver.csproj",
+ "src\\CodeStyle\\Core\\Analyzers\\Microsoft.CodeAnalysis.CodeStyle.csproj",
+ "src\\CodeStyle\\Core\\CodeFixes\\Microsoft.CodeAnalysis.CodeStyle.Fixes.csproj",
+ "src\\CodeStyle\\CSharp\\Analyzers\\Microsoft.CodeAnalysis.CSharp.CodeStyle.csproj",
+ "src\\CodeStyle\\CSharp\\CodeFixes\\Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes.csproj",
+ "src\\CodeStyle\\VisualBasic\\Analyzers\\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.vbproj",
+ "src\\CodeStyle\\VisualBasic\\CodeFixes\\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes.vbproj",
+ "src\\Tools\\AnalyzerRunner\\AnalyzerRunner.csproj",
+ "src\\Dependencies\\CodeAnalysis.Debugging\\Microsoft.CodeAnalysis.Debugging.Package.csproj",
+ "src\\Dependencies\\PooledObjects\\Microsoft.CodeAnalysis.PooledObjects.Package.csproj",
+ "src\\NuGet\\Microsoft.Net.Compilers\\Microsoft.Net.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.NETCore.Compilers\\Microsoft.NETCore.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Scripting.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.EditorFeatures.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Package.csproj",
+ "src\\Setup\\DevDivVsix\\CompilersPackage\\Microsoft.CodeAnalysis.Compilers.Setup.csproj",
+ "src\\Setup\\Installer\\Installer.Package.csproj",
+ "src\\Setup\\DevDivInsertionFiles\\DevDivInsertionFiles.csproj",
+ "src\\Tools\\ExternalAccess\\FSharp\\Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj",
+ "src\\Tools\\ExternalAccess\\Razor\\Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj",
+ "src\\NuGet\\Microsoft.Net.Compilers.Toolset\\Microsoft.Net.Compilers.Toolset.Package.csproj",
+ "src\\Features\\LanguageServer\\Protocol\\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj",
+ "src\\Tools\\ExternalAccess\\Debugger\\Microsoft.CodeAnalysis.ExternalAccess.Debugger.csproj",
+ "src\\Tools\\ExternalAccess\\Xamarin.Remote\\Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote.csproj",
+ "src\\Tools\\ExternalAccess\\Apex\\Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj",
+ "src\\Tools\\IdeBenchmarks\\IdeBenchmarks.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\IOperationGenerator\\CompilersIOperationGenerator.csproj",
+ "src\\Features\\Lsif\\Generator\\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\Core\\CompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\Core\\WorkspaceExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\CSharp\\CSharpCompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\CSharp\\CSharpWorkspaceExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\VisualBasic\\VisualBasicCompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\VisualBasic\\VisualBasicWorkspaceExtensions.shproj",
+ "src\\Analyzers\\Core\\Analyzers\\Analyzers.shproj",
+ "src\\Analyzers\\Core\\CodeFixes\\CodeFixes.shproj",
+ "src\\Analyzers\\CSharp\\Analyzers\\CSharpAnalyzers.shproj",
+ "src\\Analyzers\\CSharp\\CodeFixes\\CSharpCodeFixes.shproj",
+ "src\\Analyzers\\VisualBasic\\Analyzers\\VisualBasicAnalyzers.shproj",
+ "src\\Analyzers\\VisualBasic\\CodeFixes\\VisualBasicCodeFixes.shproj",
+ "src\\Tools\\IdeCoreBenchmarks\\IdeCoreBenchmarks.csproj",
+ "src\\Tools\\BuildValidator\\BuildValidator.csproj",
+ "src\\Tools\\BuildActionTelemetryTable\\BuildActionTelemetryTable.csproj",
+ "src\\CodeStyle\\Tools\\CodeStyleConfigFileGenerator.csproj",
+ "src\\Dependencies\\Collections\\Microsoft.CodeAnalysis.Collections.shproj",
+ "src\\Dependencies\\Collections\\Microsoft.CodeAnalysis.Collections.Package.csproj",
+ "src\\Compilers\\Core\\Rebuild\\Microsoft.CodeAnalysis.Rebuild.csproj",
+ "src\\Tools\\ExternalAccess\\OmniSharp\\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.csproj",
+ "src\\Tools\\ExternalAccess\\OmniSharp.CSharp\\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp.csproj",
+ "src\\Workspaces\\Remote\\ServiceHub.CoreComponents\\Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 92e316a4744..9905b35467e 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -11,7 +11,7 @@
-->
<Target Name="ConfigureInnerBuildArg" BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
- <InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.sln"</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.SourceBuild.slnf"</InnerBuildArgs>
</PropertyGroup>
</Target>
--
2.31.1

View file

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
@ -217,4 +216,4 @@ namespace Microsoft.DotNet.Cli.Build
}
}
}
#endif
#endif

View file

@ -15,7 +15,8 @@
<PackageReference Include="NuGet.Versioning" Version="$(NuGetVersioningPackageVersion)" />
<PackageReference Include="NuGet.Packaging" Version="$(NuGetVersioningPackageVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Include="WindowsAzure.Storage" Version="8.4.0" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">