From 326507bb01f589439bf5d69fac35d222b1624e43 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Fri, 11 Sep 2020 19:17:28 -0700 Subject: [PATCH] Correct `$(SharedFxVersion)` and `$(TargetingPackVersion)` values (#25790) * Correct `$(SharedFxVersion)` and `$(TargetingPackVersion)` values - Ensure `$(SharedFxVersion)` doesn't change in `$(NoSemVer20)` projects - Ignore current project's `$(VersionSuffix)` in `$(TargetingPackVersion)` - Never assume `$(AspNetCoreBaselineVersion)` matches released targeting pack - Stabilize both versions correctly - Use these properties more widely - Remove other mechanisms to get the same values - Reduce use of the `_GetPackageVersionInfo` target - Reduce use of `$(SharedFxVersion)` for the targeting pack nits: - Correct comments about old RTMVersions.csproj project - Fix or remove a few other comments * Do not pass package filenames on Helix command Lines - remove parsing of these command-line arguments from `RuntestOptions` - instead craft the names using passed `$(SharedFxVersion)` - restore `$(DotNetRuntimeSourceFeedKey)` on Helix command line - lost somewhere along the line - correct argument count in runtests.sh - treated 11th argument as both Helix timeout and feed credential - count was messed up somewhere alone the line nits: - update C# syntax in `RuntestOptions` e.g. remove unused `public` setters - sort and group properties and their assignments --- Directory.Build.targets | 12 ++-- eng/Dependencies.props | 2 +- eng/Version.Details.xml | 2 +- eng/Versions.props | 4 +- eng/helix/content/RunTests/RunTestsOptions.cs | 67 +++++++++---------- eng/helix/content/runtests.cmd | 10 +-- eng/helix/content/runtests.sh | 8 +-- eng/targets/Helix.targets | 16 ++--- .../Microsoft.AspNetCore.App.UnitTests.csproj | 18 +---- .../InteropWebsite/Directory.Build.targets | 4 +- .../Infrastructure/GenerateTestProps.targets | 26 +------ .../Infrastructure/GenerateTestProps.targets | 26 +------ .../LoggingBranch/Directory.Build.targets | 4 -- src/SiteExtensions/Sdk/SiteExtension.targets | 4 +- 14 files changed, 66 insertions(+), 137 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 58171d37f4..96c4576add 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -36,13 +36,15 @@ $(VersionPrefix)-$(VersionSuffix.Replace('.','-')) $(Version) - $(SiteExtensionPackageVersion) + $(PackageVersion) + $(VersionPrefix) + $(Product) $(SharedFxVersion) Shared Framework - $(TargetingPackVersionPrefix) - $(TargetingPackVersionPrefix)-$(VersionSuffix) + $(SharedFxVersion) + $(TargetingPackVersionPrefix) - $(Product) $(PackageVersion) Shared Framework + $(SiteExtensionPackageVersion) @@ -156,7 +158,7 @@ $(SharedFxVersion) $(SharedFxVersion) - $(SharedFxVersion) + $(TargetingPackVersion) diff --git a/eng/Dependencies.props b/eng/Dependencies.props index c242829120..5fc48ea2c3 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -73,7 +73,7 @@ and are generated based on the last package release. - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b0d3910a7..7e411bdb58 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -241,7 +241,7 @@ https://github.com/dotnet/runtime 7d39776332446d8a84f5d542c80d264fa1cadbe7 - + https://github.com/dotnet/runtime 7d39776332446d8a84f5d542c80d264fa1cadbe7 diff --git a/eng/Versions.props b/eng/Versions.props index 4fb3070112..ba647ca824 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -118,7 +118,7 @@ 5.0.0-rc.2.20461.4 5.0.0-rc.2.20461.4 5.0.0-rc.2.20461.4 - + 5.0.0-rc.2.20461.4 5.0.0-rc.2.20461.4 5.0.0-rc.2.20461.4 @@ -170,7 +170,7 @@ runtime packages for everything else. This is not an issue for assemblies available in Microsoft.NETCore.App.Ref or Microsoft.Extensions.Internal.Transport because it is next to impossible we would service those packages. - System.Security.AccessControl should only be referenced in Dependencies.props and RTMVersions.csproj. Because + System.Security.AccessControl should only be referenced in Dependencies.props and RepoTasks.csproj. Because it's a transitive reference, we reship the ref/ assembly in Microsoft.AspNetCore.App.Ref. dotnet/runtime ships the implementation assemblies in Microsoft.NETCore.App.Runtime.* packages. diff --git a/eng/helix/content/RunTests/RunTestsOptions.cs b/eng/helix/content/RunTests/RunTestsOptions.cs index bd611ef46e..13bd50a80f 100644 --- a/eng/helix/content/RunTests/RunTestsOptions.cs +++ b/eng/helix/content/RunTests/RunTestsOptions.cs @@ -46,16 +46,6 @@ namespace RunTests description: "The version of the EF tool to use") { Argument = new Argument(), Required = true }, - new Option( - aliases: new string[] { "--aspnetruntime" }, - description: "The path to the aspnet runtime nupkg to install") - { Argument = new Argument(), Required = true }, - - new Option( - aliases: new string[] { "--aspnetref" }, - description: "The path to the aspnet ref nupkg to install") - { Argument = new Argument(), Required = true }, - new Option( aliases: new string[] { "--helixTimeout" }, description: "The timeout duration of the Helix job") @@ -63,34 +53,41 @@ namespace RunTests }; var parseResult = command.Parse(args); - var options = new RunTestsOptions(); - options.Target = parseResult.ValueForOption("--target"); - options.RuntimeVersion = parseResult.ValueForOption("--runtime"); - options.HelixQueue = parseResult.ValueForOption("--queue"); - options.Architecture = parseResult.ValueForOption("--arch"); - options.Quarantined = parseResult.ValueForOption("--quarantined"); - options.EfVersion = parseResult.ValueForOption("--ef"); - options.AspNetRuntime = parseResult.ValueForOption("--aspnetruntime"); - options.AspNetRef = parseResult.ValueForOption("--aspnetref"); - options.Timeout = TimeSpan.Parse(parseResult.ValueForOption("--helixTimeout")); - options.HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"); - options.Path = Environment.GetEnvironmentVariable("PATH"); - options.DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT"); + var sharedFxVersion = parseResult.ValueForOption("--runtime"); + var options = new RunTestsOptions + { + Architecture = parseResult.ValueForOption("--arch"), + EfVersion = parseResult.ValueForOption("--ef"), + HelixQueue = parseResult.ValueForOption("--queue"), + Quarantined = parseResult.ValueForOption("--quarantined"), + RuntimeVersion = sharedFxVersion, + Target = parseResult.ValueForOption("--target"), + Timeout = TimeSpan.Parse(parseResult.ValueForOption("--helixTimeout")), + + // When targeting pack builds, it has exactly the same version as the shared framework. + AspNetRef = $"Microsoft.AspNetCore.App.Ref.{sharedFxVersion}.nupkg", + AspNetRuntime = $"Microsoft.AspNetCore.App.Runtime.win-x64.{sharedFxVersion}.nupkg", + + DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT"), + HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), + Path = Environment.GetEnvironmentVariable("PATH"), + }; + return options; } - public string Target { get; set;} - public string SdkVersion { get; set;} - public string RuntimeVersion { get; set;} - public string AspNetRuntime { get; set;} - public string AspNetRef { get; set;} - public string HelixQueue { get; set;} - public string Architecture { get; set;} - public bool Quarantined { get; set;} - public string EfVersion { get; set;} - public string HELIX_WORKITEM_ROOT { get; set;} - public string DotnetRoot { get; set; } + public string Architecture { get; private set; } + public string EfVersion { get; private set; } + public string HelixQueue { get; private set; } + public bool Quarantined { get; private set; } + public string RuntimeVersion { get; private set; } + public string Target { get; private set; } + public TimeSpan Timeout { get; private set; } + + public string AspNetRef { get; private set; } + public string AspNetRuntime { get; private set; } + public string HELIX_WORKITEM_ROOT { get; private set; } + public string DotnetRoot { get; private set; } public string Path { get; set; } - public TimeSpan Timeout { get; set; } } } diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index 1016d25aad..e8091960aa 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -10,12 +10,8 @@ set $queue=%5 set $arch=%6 set $quarantined=%7 set $ef=%8 -set $aspnetruntime=%9 -REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more -shift -set $aspnetref=%9 -shift set $helixTimeout=%9 +REM Batch only supports up to 9 arguments using the %# syntax, need to shift to get more shift set $feedCred=%9 @@ -40,8 +36,8 @@ set exit_code=0 echo "Restore: dotnet restore RunTests\RunTests.csproj --ignore-failed-sources" dotnet restore RunTests\RunTests.csproj --ignore-failed-sources -echo "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%" -dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout% +echo "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --helixTimeout %$helixTimeout%" +dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --helixTimeout %$helixTimeout% if errorlevel neq 0 ( set exit_code=%errorlevel% ) diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index 713f51cab9..2458a7bcfb 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -36,14 +36,14 @@ InstallDotNet $DOTNET_ROOT $dotnet_sdk_version "" "" true || { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code } -if [[ -z "${11:-}" ]]; then +if [[ -z "${10:-}" ]]; then InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true || { exit_code=$? Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code } else - InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${11} || { + InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${10} || { exit_code=$? Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code @@ -65,8 +65,8 @@ exit_code=0 echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources" $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources -echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}" -$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11} +echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9" +$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9 exit_code=$? echo "Finished tests...exit_code=$exit_code" diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 706c407778..ca580d1ed5 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -106,14 +106,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj - - + @@ -139,8 +133,12 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj $(TargetFileName) @(HelixPreCommand) @(HelixPostCommand) - call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(SharedFxVersion).nupkg Microsoft.AspNetCore.App.Ref.$(SharedFxVersion).nupkg $(HelixTimeout) - ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) Microsoft.AspNetCore.App.Runtime.win-x64.$(SharedFxVersion).nupkg Microsoft.AspNetCore.App.Ref.$(SharedFxVersion).nupkg $(HelixTimeout) + + call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey) + ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey) $(HelixCommand) $(HelixTimeout) diff --git a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj index 2d55f9cd50..c40284c6df 100644 --- a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj +++ b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj @@ -70,20 +70,6 @@ - - - - - - - - - - <_Parameter1>TargetingPackDependencies @@ -119,12 +105,12 @@ <_Parameter1>RuntimePackageVersion - <_Parameter2>@(_RuntimePackageVersionInfo->'%(PackageVersion)') + <_Parameter2>$(SharedFxVersion) <_Parameter1>TargetingPackVersion - <_Parameter2>@(_TargetingPackVersionInfo->'%(PackageVersion)') + <_Parameter2>$(TargetingPackVersion) diff --git a/src/Grpc/test/testassets/InteropWebsite/Directory.Build.targets b/src/Grpc/test/testassets/InteropWebsite/Directory.Build.targets index 2f889b40ea..9feb89c407 100644 --- a/src/Grpc/test/testassets/InteropWebsite/Directory.Build.targets +++ b/src/Grpc/test/testassets/InteropWebsite/Directory.Build.targets @@ -4,8 +4,6 @@ $(RestoreAdditionalProjectSources);$(ArtifactsShippingPackagesDir) - $(TargetingPackVersion) - $(AspNetCoreBaselineVersion) @@ -18,7 +16,7 @@ RuntimePackNamePatterns="Microsoft.AspNetCore.App.Runtime.**RID**" DefaultRuntimeFrameworkVersion="$(SharedFxVersion)" LatestRuntimeFrameworkVersion="$(SharedFxVersion)" - TargetingPackVersion="$(MicrosoftAspNetCoreAppRefPackageVersion)" + TargetingPackVersion="$(TargetingPackVersion)" RuntimePackRuntimeIdentifiers="$(SupportedRuntimeIdentifiers)" /> diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/GenerateTestProps.targets b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/GenerateTestProps.targets index 10ce80aec3..ed8f3b941b 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/GenerateTestProps.targets +++ b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/GenerateTestProps.targets @@ -3,28 +3,6 @@ BeforeTargets="CoreCompile" DependsOnTargets="PrepareForTest" Condition="$(DesignTimeBuild) != true"> - - - - - - - - - %(_TargetingPackVersionInfo.PackageVersion) - $(TargetingPackVersionPrefix) - - - - - - - RestoreAdditionalProjectSources=$([MSBuild]::Escape("$(RestoreAdditionalProjectSources);$(ArtifactsShippingPackagesDir);$(ArtifactsNonShippingPackagesDir)")); @@ -33,8 +11,8 @@ MicrosoftNETCoreAppRefPackageVersion=$(MicrosoftNETCoreAppRefPackageVersion); MicrosoftNETCorePlatformsPackageVersion=$(MicrosoftNETCorePlatformsPackageVersion); MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion); - MicrosoftAspNetCoreAppRefPackageVersion=$(MicrosoftAspNetCoreAppRefPackageVersion); - MicrosoftAspNetCoreAppRuntimePackageVersion=@(_RuntimePackageVersionInfo->'%(PackageVersion)'); + MicrosoftAspNetCoreAppRefPackageVersion=$(TargetingPackVersion); + MicrosoftAspNetCoreAppRuntimePackageVersion=$(SharedFxVersion); SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers.Trim()); DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework); RepoRoot=$(RepoRoot); diff --git a/src/ProjectTemplates/test/Infrastructure/GenerateTestProps.targets b/src/ProjectTemplates/test/Infrastructure/GenerateTestProps.targets index 10ce80aec3..ed8f3b941b 100644 --- a/src/ProjectTemplates/test/Infrastructure/GenerateTestProps.targets +++ b/src/ProjectTemplates/test/Infrastructure/GenerateTestProps.targets @@ -3,28 +3,6 @@ BeforeTargets="CoreCompile" DependsOnTargets="PrepareForTest" Condition="$(DesignTimeBuild) != true"> - - - - - - - - - %(_TargetingPackVersionInfo.PackageVersion) - $(TargetingPackVersionPrefix) - - - - - - - RestoreAdditionalProjectSources=$([MSBuild]::Escape("$(RestoreAdditionalProjectSources);$(ArtifactsShippingPackagesDir);$(ArtifactsNonShippingPackagesDir)")); @@ -33,8 +11,8 @@ MicrosoftNETCoreAppRefPackageVersion=$(MicrosoftNETCoreAppRefPackageVersion); MicrosoftNETCorePlatformsPackageVersion=$(MicrosoftNETCorePlatformsPackageVersion); MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion); - MicrosoftAspNetCoreAppRefPackageVersion=$(MicrosoftAspNetCoreAppRefPackageVersion); - MicrosoftAspNetCoreAppRuntimePackageVersion=@(_RuntimePackageVersionInfo->'%(PackageVersion)'); + MicrosoftAspNetCoreAppRefPackageVersion=$(TargetingPackVersion); + MicrosoftAspNetCoreAppRuntimePackageVersion=$(SharedFxVersion); SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers.Trim()); DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework); RepoRoot=$(RepoRoot); diff --git a/src/SiteExtensions/LoggingBranch/Directory.Build.targets b/src/SiteExtensions/LoggingBranch/Directory.Build.targets index bc9e13c2e2..ea37d8fa42 100644 --- a/src/SiteExtensions/LoggingBranch/Directory.Build.targets +++ b/src/SiteExtensions/LoggingBranch/Directory.Build.targets @@ -2,10 +2,6 @@ - - $(PackageVersion) - - diff --git a/src/SiteExtensions/Sdk/SiteExtension.targets b/src/SiteExtensions/Sdk/SiteExtension.targets index 792d83e090..e11ead7af3 100644 --- a/src/SiteExtensions/Sdk/SiteExtension.targets +++ b/src/SiteExtensions/Sdk/SiteExtension.targets @@ -85,7 +85,7 @@ HostingStartupPackageName=%(_HostingStartupPackageReference.Identity); HostingStartupPackageVersion=%(_HostingStartupPackageReference.Version); RuntimeFrameworkVersion=$(HostingStartupRuntimeFrameworkVersion); - MicrosoftAspNetCoreAppPackageVersion=$(MicrosoftAspNetCoreAppPackageVersion); + MicrosoftAspNetCoreAppPackageVersion=$(SharedFxVersion); UseAppHost=false; NoBuild=false; RestoreAdditionalProjectSources=$(_RsRestoreSources)" /> @@ -97,7 +97,7 @@ HostingStartupPackageName=%(_HostingStartupPackageReference.Identity); HostingStartupPackageVersion=%(_HostingStartupPackageReference.Version); RuntimeFrameworkVersion=$(HostingStartupRuntimeFrameworkVersion); - MicrosoftAspNetCoreAppPackageVersion=$(MicrosoftAspNetCoreAppPackageVersion); + MicrosoftAspNetCoreAppPackageVersion=$(SharedFxVersion); UseAppHost=false; NoBuild=false; IncludeMainProjectInDepsFile=false" />