PR feedback
- Integrate runtime host config settings instead of EnvVars - Move version to Versions.props
This commit is contained in:
parent
c592d1b570
commit
01e368ff71
4 changed files with 54 additions and 34 deletions
|
@ -32,5 +32,6 @@
|
|||
<MicrosoftExtensionsLoggingVersion>9.0.0-preview.2.24128.5</MicrosoftExtensionsLoggingVersion>
|
||||
<!-- command-line-api -->
|
||||
<SystemCommandLineVersion>2.0.0-beta4.24126.1</SystemCommandLineVersion>
|
||||
<Microsoft_Extensions_FileSystemGlobbingVersion>7.0.0</Microsoft_Extensions_FileSystemGlobbingVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -9,24 +9,33 @@
|
|||
AfterTargets="Build"
|
||||
DependsOnTargets="DetermineSourceBuiltSdkVersion">
|
||||
|
||||
<ItemGroup>
|
||||
<_UnifiedBuildValidationEnvVar Include="UNIFIED_BUILD_VALIDATION_SDK_TARBALL_PATH" Value="$(SdkTarballPath)" />
|
||||
<_UnifiedBuildValidationEnvVar Include="UNIFIED_BUILD_VALIDATION_TARGET_RID" Value="$(TargetRid)" />
|
||||
<_UnifiedBuildValidationEnvVar Include="UNIFIED_BUILD_VALIDATION_PORTABLE_RID" Value="$(PortableRid)" />
|
||||
<_UnifiedBuildValidationEnvVar Include="UNIFIED_BUILD_VALIDATION_BUILD_VERSION" Value="$(SourceBuiltSdkVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SdkTarballPath>%(SdkTarballItem.Identity)</SdkTarballPath>
|
||||
<EnvironmentVariableRunSettings>@(_UnifiedBuildValidationEnvVar->'%(Identity)=%(Value)')</EnvironmentVariableRunSettings>
|
||||
<runSettings>RunConfiguration.EnvironmentVariables.UNIFIED_BUILD_VALIDATION_ARGS=$([MSBuild]::Escape($(EnvironmentVariableRunSettings)))</runSettings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.UbSdkArchivePath">
|
||||
<Value>$(SdkTarballPath)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.TargetRid">
|
||||
<Value>$(TargetRid)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.PortableRid">
|
||||
<Value>$(PortableRid)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.UbBuildVersion">
|
||||
<Value>$(SourceBuiltSdkVersion)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
</ItemGroup>
|
||||
|
||||
<MSBuild Projects="$(UnifiedBuildValidationTestsProject)"
|
||||
Targets="VSTest"
|
||||
Properties="VsTestUseMSBuildOutput=true;
|
||||
VSTestLogger=trx;
|
||||
VSTestCLIRunSettings=$(runSettings)" />
|
||||
Microsoft_DotNet_UnifiedBuild_Tests_UbSdkArchivePath=$(SdkTarballPath);
|
||||
Microsoft_DotNet_UnifiedBuild_Tests_TargetRid=$(TargetRid);
|
||||
Microsoft_DotNet_UnifiedBuild_Tests_PortableRid=$(PortableRid);
|
||||
Microsoft_DotNet_UnifiedBuild_Tests_SourceBuiltSdkVersion=$(SourceBuiltSdkVersion);" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -18,29 +18,24 @@ public class Config : IDisposable
|
|||
public Config(IMessageSink sink)
|
||||
{
|
||||
_sink = sink;
|
||||
sink.OnMessage(new DiagnosticMessage($"Environment: '{Environment.GetEnvironmentVariable("UNIFIED_BUILD_VALIDATION_ARGS")}'"));
|
||||
var env = Environment.GetEnvironmentVariable("UNIFIED_BUILD_VALIDATION_ARGS") ?? throw new InvalidOperationException("UNIFIED_BUILD_VALIDATION_ARGS must be specified");
|
||||
var envDict = env.Split(';').Select(s => s.Split('=')).ToDictionary(s => s[0], s => s[1]);
|
||||
|
||||
BuildVersion = envDict[BuildVersionEnv];
|
||||
PortableRid = envDict[PortableRidEnv];
|
||||
UbSdkArchivePath = envDict[UbSdkTarballPathEnv];
|
||||
TargetRid = envDict[TargetRidEnv];
|
||||
UbBuildVersion = AppContext.GetSwitch(BuildVersionSwitch);
|
||||
ConfigPrefix = AppContext.GetSwitch(ConfigPrefixSwitch);
|
||||
TargetRid = AppContext.GetSwitch(TargetRidSwitch);
|
||||
PortableRid = AppContext.GetSwitch(PortableRidSwitch);
|
||||
UbSdkArchivePath = AppContext.GetSwitch(UbSdkArchivePathSwitch);
|
||||
TargetArchitecture = TargetRid.Split('-')[1];
|
||||
MsftSdkArchivePath = envDict.TryGetValue(MsftSdkTarballPathEnv, out var msftSdkPath) ? msftSdkPath : DownloadMsftSdkArchive().Result;
|
||||
MsftSdkArchivePath = AppContext.GetSwitch(MsftSdkArchivePathSwitch) ?? DownloadMsftSdkArchive().Result;
|
||||
}
|
||||
|
||||
public const string BuildVersionEnv = "UNIFIED_BUILD_VALIDATION_BUILD_VERSION";
|
||||
public const string MsftSdkTarballPathEnv = "UNIFIED_BUILD_VALIDATION_MSFT_SDK_TARBALL_PATH";
|
||||
public const string PortableRidEnv = "UNIFIED_BUILD_VALIDATION_PORTABLE_RID";
|
||||
public const string PrereqsPathEnv = "UNIFIED_BUILD_VALIDATION_PREREQS_PATH";
|
||||
public const string UbSdkTarballPathEnv = "UNIFIED_BUILD_VALIDATION_SDK_TARBALL_PATH";
|
||||
public const string SourceBuiltArtifactsPathEnv = "UNIFIED_BUILD_VALIDATION_SOURCEBUILT_ARTIFACTS_PATH";
|
||||
public const string TargetRidEnv = "UNIFIED_BUILD_VALIDATION_TARGET_RID";
|
||||
public const string WarnSdkContentDiffsEnv = "UNIFIED_BUILD_VALIDATION_WARN_SDK_CONTENT_DIFFS";
|
||||
public const string ConfigSwitchPrefix = "Microsoft.DotNet.UnifiedBuild.Tests.";
|
||||
public const string BuildVersionSwitch = ConfigSwitchPrefix + nameof(UbBuildVersion);
|
||||
public const string TargetRidSwitch = ConfigSwitchPrefix + nameof(TargetRid);
|
||||
public const string PortableRidSwitch = ConfigSwitchPrefix + nameof(PortableRid);
|
||||
public const string UbSdkArchivePathSwitch = ConfigSwitchPrefix + nameof(UbSdkArchivePath);
|
||||
public const string MsftSdkArchivePathSwitch = ConfigSwitchPrefix + nameof(MsftSdkArchivePath);
|
||||
|
||||
public string? MsftSdkArchivePath { get; }
|
||||
public string BuildVersion { get; }
|
||||
public string UbBuildVersion { get; }
|
||||
public string PortableRid { get; }
|
||||
public string UbSdkArchivePath { get; }
|
||||
public string TargetRid { get; }
|
||||
|
@ -60,7 +55,7 @@ public class Config : IDisposable
|
|||
public async Task<string> DownloadMsftSdkArchive()
|
||||
{
|
||||
var client = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false });
|
||||
var channel = BuildVersion[..5] + "xx";
|
||||
var channel = UbBuildVersion[..5] + "xx";
|
||||
var akaMsUrl = $"https://aka.ms/dotnet/{channel}/daily/dotnet-sdk-{TargetRid}{GetArchiveExtension(UbSdkArchivePath)}";
|
||||
_sink.OnMessage(new DiagnosticMessage($"Downloading latest sdk from '{akaMsUrl}'"));
|
||||
var redirectResponse = await client.GetAsync(akaMsUrl);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(NetCurrent)</TargetFramework>
|
||||
|
@ -7,14 +7,29 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(Microsoft_Extensions_FileSystemGlobbingVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="assets\**"
|
||||
CopyToOutputDirectory="Always" />
|
||||
<Content Include="assets\**" CopyToOutputDirectory="Always" />
|
||||
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.TargetRid">
|
||||
<Value>$(Microsoft_DotNet_UnifiedBuild_Tests_TargetRid)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.PortableRid">
|
||||
<Value>$(Microsoft_DotNet_UnifiedBuild_Tests_PortableRid)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.UbBuildVersion">
|
||||
<Value>$(Microsoft_DotNet_UnifiedBuild_Tests_UbBuildVersion)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.UbSdkArchivePath">
|
||||
<Value>$(Microsoft_DotNet_UnifiedBuild_Tests_UbSdkArchivePath)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
<RuntimeHostConfigurationOption Include="Microsoft.DotNet.UnifiedBuild.Tests.MsftSdkArchivePath">
|
||||
<Value>$(Microsoft_DotNet_UnifiedBuild_Tests_MsftSdkArchivePath)</Value>
|
||||
</RuntimeHostConfigurationOption>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue