diff --git a/.gitignore b/.gitignore index 23fe40877441..2ce687bb17a1 100644 --- a/.gitignore +++ b/.gitignore @@ -95,8 +95,10 @@ dlldata.c # Build artifacts artifacts/ +artifacts-*/ bin/ .dotnet/ +.dotnet-*/ *_i.c *_p.c diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index ed4f517c97f8..a5f56ff7992c 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SdkResolver", "src\SdkResol EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Dotnet.Sdk.Internal", "src\Microsoft.Dotnet.Sdk.Internal\Microsoft.Dotnet.Sdk.Internal.csproj", "{73F07908-981B-41BB-B9BD-F3420274A6F7}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SdkTests", "test\SdkTests\SdkTests.csproj", "{CB1EE94E-CB83-4071-9DD0-9929AE2B7282}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,6 +51,10 @@ Global {73F07908-981B-41BB-B9BD-F3420274A6F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {73F07908-981B-41BB-B9BD-F3420274A6F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {73F07908-981B-41BB-B9BD-F3420274A6F7}.Release|Any CPU.Build.0 = Release|Any CPU + {CB1EE94E-CB83-4071-9DD0-9929AE2B7282}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB1EE94E-CB83-4071-9DD0-9929AE2B7282}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB1EE94E-CB83-4071-9DD0-9929AE2B7282}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB1EE94E-CB83-4071-9DD0-9929AE2B7282}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -59,6 +65,7 @@ Global {53AF2D01-B69F-4CD0-86A7-8FD95967D23C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {78E15EC1-7732-41E3-8591-934E9F583254} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {7EE15292-2CAD-44FA-8A1F-BAC4688A49E0} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} + {CB1EE94E-CB83-4071-9DD0-9929AE2B7282} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5} diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 67d5d74f4367..13598ad2ab96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -50,9 +50,9 @@ https://github.com/dotnet/standard 2c94a70248b2c4379ceffbade085f8d7eca4fee0 - + https://github.com/dotnet/sdk - d6749cfae26412c188e26c247b15919afccef127 + cda3914e2da64cf48029ac06dc043e039d1d1ee9 https://github.com/dotnet/cli diff --git a/eng/Versions.props b/eng/Versions.props index 48c334627657..ade34fef98aa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ - 3.0.100-preview6.19279.4 + 3.0.100-preview6.19280.4 3.0.0-preview6-27730-01 diff --git a/eng/build.yml b/eng/build.yml index 92add5df4ebb..227d8cf60dc6 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -26,6 +26,8 @@ phases: pool: ${{ parameters.pool }} ${{ if ne(parameters.strategy, '') }}: strategy: ${{ parameters.strategy }} + workspace: + clean: all variables: - _AgentOSName: ${{ parameters.agentOs }} @@ -117,7 +119,7 @@ phases: TestResults/$(_BuildConfig)/**/* TargetFolder: '$(Build.ArtifactStagingDirectory)' continueOnError: true - condition: not(succeeded()) + condition: always() - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS @@ -126,7 +128,7 @@ phases: ArtifactName: '$(_AgentOSName)_$(Agent.JobName)_$(Build.BuildNumber)' publishLocation: Container continueOnError: true - condition: not(succeeded()) + condition: always() - ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: CopyFiles@2 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9ca177b82a34..6b014701fe03 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -128,7 +128,12 @@ function InitializeDotNetCli([bool]$install) { if ((-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { + $dotnetRoot = Join-Path $RepoRoot ".dotnet" + if ($env:ARCADE_PARTITION -ne $null) + { + $dotnetRoot = Join-Path $RepoRoot ".dotnet-$env:ARCADE_PARTITION" + } if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { @@ -553,6 +558,10 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $ArtifactsDir = Join-Path $RepoRoot "artifacts" +if ($env:ARCADE_PARTITION -ne $null) +{ + $ArtifactsDir = Join-Path $RepoRoot "artifacts-$env:ARCADE_PARTITION" +} $ToolsetDir = Join-Path $ArtifactsDir "toolset" $ToolsDir = Join-Path $RepoRoot ".tools" $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration diff --git a/eng/common/tools.sh b/eng/common/tools.sh index df3eb8bce075..ee196afb5980 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -119,7 +119,9 @@ function InitializeDotNetCli { dotnet_root="$DOTNET_INSTALL_DIR" else dotnet_root="$repo_root/.dotnet" - + if [[ -n "${ARCADE_PARTITION:-}" ]]; then + dotnet_root="$repo_root/.dotnet-$ARCADE_PARTITION" + fi export DOTNET_INSTALL_DIR="$dotnet_root" if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then @@ -336,6 +338,11 @@ _script_dir=`dirname "$_ResolvePath"` eng_root=`cd -P "$_script_dir/.." && pwd` repo_root=`cd -P "$_script_dir/../.." && pwd` artifacts_dir="$repo_root/artifacts" +if [[ -n "${ARCADE_PARTITION:-}" ]]; then + artifacts_dir="$repo_root/artifacts-$ARCADE_PARTITION" + export ArtifactsDir="$artifacts_dir/" +fi + toolset_dir="$artifacts_dir/toolset" tools_dir="$repo_root/.tools" log_dir="$artifacts_dir/log/$configuration" diff --git a/eng/core-sdk-build-env.sh b/eng/core-sdk-build-env.sh new file mode 100644 index 000000000000..6b3974e463a4 --- /dev/null +++ b/eng/core-sdk-build-env.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done + +REPO_ROOT="$( cd -P "$( dirname "$SOURCE" )/../" && pwd )" + +arcade_partition= + +while [[ $# > 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -partition) + arcade_partition=$2 + shift + ;; + esac + + shift +done + +export ARCADE_PARTITION=$arcade_partition + +if [[ ! -z "$arcade_partition" ]]; then + arcade_partition_suffix="-$arcade_partition" +fi + +export PATH=$REPO_ROOT/.dotnet$arcade_partition_suffix:$PATH +export DOTNET_INSTALL_DIR=$REPO_ROOT/.dotnet$arcade_partition_suffix +export ArtifactsDir=$REPO_ROOT/artifacts$arcade_partition_suffix/ + +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_MULTILEVEL_LOOKUP=0 \ No newline at end of file diff --git a/eng/dockerrun.ps1 b/eng/dockerrun.ps1 index 48a79ffd9288..17eae39b45e9 100644 --- a/eng/dockerrun.ps1 +++ b/eng/dockerrun.ps1 @@ -55,7 +55,6 @@ docker run $interactiveFlag -t --rm --sig-proxy=true ` -e PB_PACKAGEVERSIONPROPSURL ` -e PB_PUBLISHBLOBFEEDURL ` -e EXTERNALRESTORESOURCES ` - -e ARCADE_DOTNET_DIR="/opt/code/artifacts/docker/${dockerImageName}/.dotnet" ` - -e ARCADE_ARTIFACTS_DIR="/opt/code/artifacts/docker/${dockerImageName}/" ` + -e ARCADE_PARTITION="${dockerImageName}" ` $dockerContainerTag ` /opt/code/run-build.sh @additionalArgs \ No newline at end of file diff --git a/test/SdkTests/SdkTests.csproj b/test/SdkTests/SdkTests.csproj new file mode 100644 index 000000000000..dd7a0225343b --- /dev/null +++ b/test/SdkTests/SdkTests.csproj @@ -0,0 +1,276 @@ + + + + false + false + Library + false + false + false + true + true + true + + + + + + $(MSBuildToolsPath)\Microsoft.CSharp.targets + + false + + false + $(CoreSdkTargetFramework) + + + + $(ArtifactsBinDir)redist\$(Configuration)\dotnet\ + $(ArtifactsBinDir)redist\$(Configuration)\dotnet-with-previous-runtimes\ + $([MSBuild]::NormalizePath($(ArtifactsTmpDir), 'dotnetSdkTests')) + + + + + + + + + + + + + + + true + + + + + + + + + Windows + + + + false + + + + false + + + + false + + + + false + + + + + false + + + + + + + + + + + + + + + + + + $(DotnetToTestPath)%(RecursiveDir)%(Filename)%(Extension) + + + + + + + + + + $(DotnetToTestPath)shared\Microsoft.NETCore.App\$(RuntimeVersionToInstall) + + + powershell -NoLogo -NoProfile -ExecutionPolicy ByPass + $(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.ps1" + $(InstallRuntimeCommand) -Version $(RuntimeVersionToInstall) + $(InstallRuntimeCommand) -InstallDir $(DotnetToTestPath) + $(InstallRuntimeCommand) -Runtime "dotnet" + $(InstallRuntimeCommand) -Architecture "$(Architecture)" + + + /bin/bash + $(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.sh" + $(InstallRuntimeCommand) --version $(RuntimeVersionToInstall) + $(InstallRuntimeCommand) --install-dir "$(DotnetToTestPath)" + $(InstallRuntimeCommand) --runtime "dotnet" + $(InstallRuntimeCommand) --architecture "$(Architecture)" + + + + + + + + + + + + + $(TestExecutionDirectory)\NuGet.config + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + ToolTestName=%(SdkTest.Identity) + + + + + + + + + testSdk$(ToolTestName) + Microsoft.NET.$(ToolTestName).Tests + $(ArtifactsTmpDir)$(ToolCommandName)\ + + + + + + + + + + + $(MicrosoftNETSdkPackageVersion) + https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + + dotnet tool install --local $(ToolCommandName) + + $(InstallToolCommand) --version $(SdkTestPackageVersion) + $(InstallToolCommand) --add-source $(SdkTestPackageFeed) + + + + + + + + + + $(ArtifactsTestResultsDir)$(TestProjectName).xml + $(ArtifactsTestResultsDir)$(TestProjectName).html + $(ArtifactsLogDir)$(TestProjectName).log + + -noautoreporters -noRepoInference + $(TestArgs) -dotnetPath $(DotnetToTestPath)\dotnet + $(TestArgs) -testExecutionDirectory $(TestExecutionDirectory) + $(TestArgs) -testConfigFile "$(MSBuildThisFileDirectory)TestConfig.xml" + $(TestArgs) -xml "$(ResultsXmlPath)" + $(TestArgs) -html "$(ResultsHtmlPath)" $(TestRunnerAdditionalArguments) + $(TestArgs) > $(ResultsStdOutPath) 2>&1 + + + + $(ToolRunPrefix)set MSBuildSDKsPath= && + $(ToolRunPrefix)set DOTNET_HOST_PATH= && + $(ToolRunPrefix)set DOTNET_INSTALLDIR= && + + + $(ToolRunPrefix)unset MSBuildSDKsPath && + $(ToolRunPrefix)unset DOTNET_HOST_PATH && + $(ToolRunPrefix)unset DOTNET_INSTALLDIR && + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/SdkTests/TestConfig.xml b/test/SdkTests/TestConfig.xml new file mode 100644 index 000000000000..6b3aec8bc73e --- /dev/null +++ b/test/SdkTests/TestConfig.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +