Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string][Alias('c')]$configuration = "Debug",
[string]$platform = $null,
[string] $projects,
[string][Alias('v')]$verbosity = "minimal",
[string] $msbuildEngine = $null,
Expand Down Expand Up @@ -29,6 +30,7 @@ Param(
function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
Write-Host " -platform <value> Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild"
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
Write-Host " -binaryLog Output binary log (short: -bl)"
Write-Host " -help Print help and exit"
Expand Down Expand Up @@ -77,6 +79,7 @@ function Build {
InitializeCustomToolset

$bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" }
$platformArg = if ($platform) { "/p:Platform=$platform" } else { "" }

if ($projects) {
# Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons.
Expand All @@ -88,6 +91,7 @@ function Build {

MSBuild $toolsetBuildProj `
$bl `
$platformArg `
/p:Configuration=$configuration `
/p:RepoRoot=$RepoRoot `
/p:Restore=$restore `
Expand Down
11 changes: 8 additions & 3 deletions eng/common/dotnet-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ Param(

. $PSScriptRoot\tools.ps1

$dotnetRoot = Join-Path $RepoRoot ".dotnet"

$installdir = $dotnetRoot
try {
$dotnetRoot = Join-Path $RepoRoot ".dotnet"
InstallDotNet $dotnetRoot $version $architecture $runtime $true
if ($architecture -and $architecture.Trim() -eq "x86") {
$installdir = Join-Path $installdir "x86"
}
InstallDotNet $installdir $version $architecture $runtime $true
}
catch {
Write-Host $_
Expand All @@ -19,4 +24,4 @@ catch {
ExitWithExitCode 1
}

ExitWithExitCode 0
ExitWithExitCode 0
26 changes: 22 additions & 4 deletions src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class InstallDotNetCore : Task
public string DotNetInstallScript { get; set; }
[Required]
public string GlobalJsonPath { get; set; }
[Required]
public string Platform { get; set; }

public override bool Execute()
{
Expand Down Expand Up @@ -55,7 +57,14 @@ public override bool Execute()
foreach (var runtime in dotnetLocalElement.EnumerateObject())
{
var items = GetItemsFromJsonElementArray(runtime, out string runtimeName);
runtimeItems.Add(runtimeName, items);
if (runtimeItems.ContainsKey(runtimeName))
{
runtimeItems[runtimeName] = runtimeItems[runtimeName].Concat(items);
}
else
{
runtimeItems.Add(runtimeName, items);
}
}
if (runtimeItems.Count > 0)
{
Expand Down Expand Up @@ -96,16 +105,25 @@ public override bool Execute()
if(version != null)
{
string arguments = $"-runtime \"{runtimeItem.Key}\" -version \"{version.ToNormalizedString()}\"";

string architecture = item.Value;
if (!string.IsNullOrWhiteSpace(architecture))
{
arguments += $" -architecture {architecture}";
}
else if (RuntimeInformation.OSArchitecture == Architecture.X86 ||
RuntimeInformation.OSArchitecture == Architecture.X64)
else
{
arguments += " -architecture x64";
if (!string.IsNullOrWhiteSpace(Platform) && !string.Equals(Platform, "AnyCpu", StringComparison.OrdinalIgnoreCase))
{
arguments += $" -architecture {Platform}";
}
else if (RuntimeInformation.OSArchitecture == Architecture.X86 ||
RuntimeInformation.OSArchitecture == Architecture.X64)
{
arguments += " -architecture x64";
}
}

Log.LogMessage(MessageImportance.Low, $"Executing: {DotNetInstallScript} {arguments}");
var process = Process.Start(new ProcessStartInfo()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<InstallDotNetCore
VersionsPropsPath="$(RepoRoot)eng\Versions.props"
GlobalJsonPath="$(RepoRoot)global.json"
DotNetInstallScript="$(_DotNetInstallScript)"/>
DotNetInstallScript="$(_DotNetInstallScript)"
Platform="$(Platform)"/>
</Target>

</Project>
5 changes: 4 additions & 1 deletion src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
<_TargetDir>$([System.IO.Path]::GetDirectoryName('$(_TestAssembly)'))\</_TargetDir>
<_CoreRuntimeConfigPath>$(_TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json</_CoreRuntimeConfigPath>
<_CoreDepsPath>$(_TargetDir)$(_TargetFileNameNoExt).deps.json</_CoreDepsPath>
<_TestRunner>$(DotNetTool)</_TestRunner>

<_TestRunner Condition="'%(TestToRun.Architecture)'=='x86' And Exists('$(DotNetRoot)x86\dotnet.exe')">$(DotNetRoot)x86\dotnet.exe</_TestRunner>
<_TestRunner Condition="'$(_TestRunner)'==''">$(DotNetTool)</_TestRunner>

<_TestRunnerArgs>exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" $(TestRuntimeAdditionalArguments) "$(NuGetPackageRoot)xunit.runner.console/$(XUnitVersion)/tools/$(_TestRunnerTargetFramework)/xunit.console.dll" "$(_TestAssembly)" -noautoreporters -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments)</_TestRunnerArgs>
</PropertyGroup>

Expand Down