Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
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
8 changes: 8 additions & 0 deletions build_projects/dotnet-host-build/CompileTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class CompileTargets
// Key: Current platform RID. Value: The actual publishable (non-dummy) package name produced by the build system for this RID.
{ "win7-x64", "win7-x64" },
{ "win7-x86", "win7-x86" },
{ "win8-arm", "win8-arm" },
{ "win10-arm64", "win10-arm64" },
{ "osx.10.10-x64", "osx.10.10-x64" },
{ "osx.10.11-x64", "osx.10.10-x64" },
Expand Down Expand Up @@ -193,6 +194,7 @@ public static BuildTargetResult CompileCoreHost(BuildTargetContext c)
string cmakeHostFxrVer = $"-DCLI_CMAKE_HOST_FXR_VER:STRING={hostVersion.LatestHostFxrVersion.ToString()}";
string cmakeCommitHash = $"-DCLI_CMAKE_COMMIT_HASH:STRING={commitHash}";
string cmakeResourceDir = $"-DCLI_CMAKE_RESOURCE_DIR:STRING={resourceDir}";
string cmakeExtraArgs = "";

switch (platform.ToLower())
{
Expand All @@ -202,6 +204,12 @@ public static BuildTargetResult CompileCoreHost(BuildTargetContext c)
archMacro = "-DCLI_CMAKE_PLATFORM_ARCH_I386=1";
arch = "x86";
break;
case "arm":
cmakeBaseRid = "-DCLI_CMAKE_PKG_RID:STRING=win8-arm";
visualStudio = "Visual Studio 14 2015 ARM";
archMacro = "-DCLI_CMAKE_PLATFORM_ARCH_ARM=1 -DCMAKE_SYSTEM_VERSION=10.0";
arch = "arm";
break;
case "arm64":
cmakeBaseRid = "-DCLI_CMAKE_PKG_RID:STRING=win10-arm64";
visualStudio = "Visual Studio 14 2015 Win64";
Expand Down
28 changes: 23 additions & 5 deletions build_projects/dotnet-host-build/MsiTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ private static string WixRoot

private static string DisplayVersion { get; set; }

private static string Arch { get; } = CurrentArchitecture.Current.ToString();
// Processor Architecture of MSI's contents
private static string TargetArch { get; set; }

// Processor Architecture of MSI itself
private static string MSIBuildArch { get; set; }

private static void AcquireWix(BuildTargetContext c)
{
Expand Down Expand Up @@ -87,6 +91,20 @@ public static BuildTargetResult InitMsi(BuildTargetContext c)
MsiVersion = buildVersion.GenerateMsiVersion();
DisplayVersion = buildVersion.SimpleVersion;

TargetArch = c.BuildContext.Get<string>("Platform");

MSIBuildArch = CurrentArchitecture.Current.ToString();

// If we are building the MSI for Arm32 or Arm64, then build it as x86 or x64 for now.
if (String.Compare(TargetArch, "arm", true) == 0)
{
MSIBuildArch = "x86";
}
else if (String.Compare(TargetArch, "arm64", true) == 0)
{
MSIBuildArch = "x64";
}

AcquireWix(c);
return c.Success();
}
Expand Down Expand Up @@ -128,7 +146,7 @@ public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c

Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"),
inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, Arch, wixObjRoot)
inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, MSIBuildArch, TargetArch, wixObjRoot)
.Execute()
.EnsureSuccessful();
return c.Success();
Expand All @@ -153,7 +171,7 @@ public static BuildTargetResult GenerateDotnetHostFxrMsi(BuildTargetContext c)

Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "hostfxr", "generatemsi.ps1"),
inputDir, HostFxrMsi, WixRoot, hostFxrBrandName, hostFxrMsiVersion, hostFxrNugetVersion, Arch, wixObjRoot)
inputDir, HostFxrMsi, WixRoot, hostFxrBrandName, hostFxrMsiVersion, hostFxrNugetVersion, MSIBuildArch, TargetArch, wixObjRoot)
.Execute()
.EnsureSuccessful();
return c.Success();
Expand All @@ -179,7 +197,7 @@ public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetCont

Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"),
inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot)
inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, MSIBuildArch, TargetArch, wixObjRoot)
.Execute()
.EnsureSuccessful();
return c.Success();
Expand All @@ -196,7 +214,7 @@ public static BuildTargetResult GenerateSharedFxBundle(BuildTargetContext c)

Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"),
SharedFrameworkMsi, SharedHostMsi, HostFxrMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, DisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch)
SharedFrameworkMsi, SharedHostMsi, HostFxrMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, DisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, TargetArch, MSIBuildArch)
.Execute()
.EnsureSuccessful();
return c.Success();
Expand Down
2 changes: 2 additions & 0 deletions build_projects/dotnet-host-build/PublishTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static BuildTargetResult FinalizeBuild(BuildTargetContext c)
{
"win.x86.version",
"win.x64.version",
"win.arm.version",
"win.arm64.version",
"ubuntu.x64.version",
"ubuntu.16.04.x64.version",
Expand Down Expand Up @@ -180,6 +181,7 @@ private static bool CheckIfAllBuildsHavePublished()
{
{ "sharedfx_Windows_x86", false },
{ "sharedfx_Windows_x64", false },
{ "sharedfx_Windows_arm", false },
{ "sharedfx_Windows_arm64", false },
{ "sharedfx_Ubuntu_x64", false },
{ "sharedfx_Ubuntu_16_04_x64", false },
Expand Down
22 changes: 22 additions & 0 deletions build_projects/dotnet-host-build/TestTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,30 @@ private static List<string> RunDotnetTestOnTestProjects(BuildTargetContext c, Do
{
var failingTests = new List<string>();

// Fetch the target RID to determine if we support running tests or not.
string rid = c.BuildContext.Get<string>("TargetRID");
bool fIsCrossArch = false;
if (!String.IsNullOrEmpty(rid))
{
if ((String.Compare(rid, "win8-arm", true) == 0) || (String.Compare(rid, "win10-arm64", true) == 0))
{
// We dont support running native tests for cross-architecture builds yet.
fIsCrossArch = true;
}
}

foreach (var project in TestProjects)
{
// Explicitly checking for the host tests since they are the only ones running native code.
if (String.Compare("HostActivationTests", project) == 0)
{
if (fIsCrossArch)
{
c.Info($"Skipping tests in: {project} since cross-arch test runs are not yet supported for {rid}.");
continue;
}
}

c.Info($"Running tests in: {project}");

var result = dotnet.Test("--configuration", configuration, "-xml", $"{project}-testResults.xml", "-notrait", "category=failing")
Expand Down
6 changes: 5 additions & 1 deletion build_projects/dotnet-host-build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if($Help)
Write-Host "Options:"
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
Write-Host " -Architecture <ARCHITECTURE> Build on the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
Write-Host " -TargetArch <ARCHITECTURE> Build for the specified architecture (x64, x86 (supported only on Windows), or arm64, default: x64)"
Write-Host " -TargetArch <ARCHITECTURE> Build for the specified architecture (x64, x86 (supported only on Windows), arm, or arm64, default: x64)"
Write-Host " -ToolsetDir <TOOLSETDIR> Temporary variable specifying a path to a toolset to use when building the native host for ARM64. To be removed when the toolset is publicly available. )"
Write-Host " -Framework <FRAMEWORK> Build the specified framework (netcoreapp1.0 or netcoreapp1.1, default: netcoreapp1.0)"
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
Expand Down Expand Up @@ -63,6 +63,10 @@ if($TargetArch -eq "x64" -and $Architecture -ne "x64")
{
$env:TARGETRID = "win7-x64";
}
if($TargetArch -eq "arm")
{
$env:TARGETRID = "win8-arm";
}

if($NoPackage)
{
Expand Down
37 changes: 30 additions & 7 deletions build_projects/shared-build-targets-utils/Utils/Crossgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,27 @@ public Crossgen(string coreClrVersion, string jitVersion, string targetRID = nul
private string GetCrossgenPathForVersion()
{
var crossgenPackagePath = GetCrossGenPackagePathForVersion();
string ridCrossgen = null;

if (crossgenPackagePath == null)
{
return null;
return ridCrossgen;
}

if (_targetRID == "win8-arm")
{
ridCrossgen = Path.Combine(crossgenPackagePath, "tools", "x86_arm", $"crossgen{Constants.ExeSuffix}");
}
else if (_targetRID == "win10-arm64")
{
ridCrossgen = Path.Combine(crossgenPackagePath, "tools", "x64_arm64", $"crossgen{Constants.ExeSuffix}");
}
else
{
ridCrossgen = Path.Combine(crossgenPackagePath, "tools", $"crossgen{Constants.ExeSuffix}");
}
return (_targetRID == "win10-arm64") ?
Path.Combine(crossgenPackagePath, "tools", "x64_arm64", $"crossgen{Constants.ExeSuffix}") :
Path.Combine(crossgenPackagePath, "tools", $"crossgen{Constants.ExeSuffix}");

return ridCrossgen;
}

private string GetLibCLRJitPathForVersion()
Expand All @@ -57,9 +70,19 @@ private string GetLibCLRJitPathForVersion()
{
return null;
}
return (_targetRID == "win10-arm64") ?
Path.Combine(jitPackagePath, "runtimes", "x64_arm64", "native", $"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}") :
Path.Combine(jitPackagePath, "runtimes", jitRid, "native", $"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");

string jitPath = Path.Combine(jitPackagePath, "runtimes", jitRid, "native", $"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");

if (_targetRID == "win8-arm")
{
jitPath = Path.Combine(jitPackagePath, "runtimes", "x86_arm", "native", $"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");
}
else if (_targetRID == "win10-arm64")
{
jitPath = Path.Combine(jitPackagePath, "runtimes", "x64_arm64", "native", $"{Constants.DynamicLibPrefix}clrjit{Constants.DynamicLibSuffix}");
}

return jitPath;
}

private string GetJitPackagePathForVersion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ public SharedFrameworkPublisher(
_corehostLockedDirectory = corehostLockedDirectory;
_corehostLatestDirectory = corehostLatestDirectory;
_corehostPackageSource = corehostPackageSource;
_crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion, sharedFrameworkRid == "win10-arm64" ? sharedFrameworkRid : null);

string crossgenRID = null;

// If we are dealing with cross-targeting compilation, then specify the
// correct RID for crossgen to use when compiling SharedFramework.
if ((sharedFrameworkRid == "win8-arm") || (sharedFrameworkRid == "win10-arm64"))
{
crossgenRID = sharedFrameworkRid;
}
_crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion, crossgenRID);

_sharedFrameworkTemplateSourceRoot = Path.Combine(repoRoot, "src", "sharedframework", "framework");
_sharedFrameworkNugetVersion = sharedFrameworkNugetVersion;
Expand Down
2 changes: 2 additions & 0 deletions packaging/windows/host/generatemsi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ param(
[Parameter(Mandatory=$true)][string]$SharedHostMSIVersion,
[Parameter(Mandatory=$true)][string]$SharedHostNugetVersion,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$TargetArchitecture,
[Parameter(Mandatory=$true)][string]$WixObjRoot
)

Expand All @@ -31,6 +32,7 @@ function RunCandle
-dProductMoniker="$ProductMoniker" `
-dBuildVersion="$SharedHostMSIVersion" `
-dNugetVersion="$SharedHostNugetVersion" `
-dTargetArchitecture="$TargetArchitecture" `
-arch $Architecture `
"$AuthWsxRoot\host.wxs" `
"$AuthWsxRoot\provider.wxs" `
Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/host/variables.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<?define Dotnet_ProductVersion = "$(var.BuildVersion)" ?>
<?define Dotnet_BuildVersion = "$(var.BuildVersion)" ?>
<?define Manufacturer = "Microsoft Corporation" ?>
<?define ProductName = "$(var.ProductMoniker) ($(sys.BUILDARCH))" ?>
<?define ProductName = "$(var.ProductMoniker) ($(var.TargetArchitecture))" ?>
<?define ProductLanguage = "1033" ?>
<?define ProductVersion = "$(var.Dotnet_ProductVersion)" ?>
<?define LCID = "$(var.ProductLanguage)"?>
Expand Down
2 changes: 2 additions & 0 deletions packaging/windows/hostfxr/generatemsi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ param(
[Parameter(Mandatory=$true)][string]$HostFxrMSIVersion,
[Parameter(Mandatory=$true)][string]$HostFxrNugetVersion,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$TargetArchitecture,
[Parameter(Mandatory=$true)][string]$WixObjRoot
)

Expand Down Expand Up @@ -63,6 +64,7 @@ function RunCandle
-dBuildVersion="$HostFxrMSIVersion" `
-dNugetVersion="$HostFxrNugetVersion" `
-dComponentVersion="$ComponentVersion" `
-dTargetArchitecture="$TargetArchitecture" `
-arch $Architecture `
-ext WixDependencyExtension.dll `
"$AuthWsxRoot\hostfxr.wxs" `
Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/hostfxr/variables.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?define HostFxr_ProductVersion = "$(var.BuildVersion)" ?>
<?define HostFxr_BuildVersion = "$(var.BuildVersion)" ?>
<?define Manufacturer = "Microsoft Corporation" ?>
<?define ProductName = "$(var.ProductMoniker) ($(sys.BUILDARCH))" ?>
<?define ProductName = "$(var.ProductMoniker) ($(var.TargetArchitecture))" ?>
<?define ProductLanguage = "1033" ?>
<?define ProductVersion = "$(var.HostFxr_ProductVersion)" ?>
<?define LCID = "$(var.ProductLanguage)"?>
Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/sharedframework/bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<swid:Tag Regid="microsoft.com" InstallPath="[DOTNETHOME]" />

<Variable Name="DOTNETHOME" Type="string" Value="[ProgramFiles6432Folder]dotnet" bal:Overridable="no" />
<Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker)" bal:Overridable="no" />
<Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker) ($(var.TargetArchitecture))" bal:Overridable="no" />

<Chain DisableSystemRestore="yes" ParallelCache="yes">
<ExePackage Name="VC_redist.$(var.Platform).exe"
Expand Down
2 changes: 2 additions & 0 deletions packaging/windows/sharedframework/generatebundle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ param(
[Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName,
[Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion,
[Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode,
[Parameter(Mandatory=$true)][string]$TargetArchitecture,
[Parameter(Mandatory=$true)][string]$Architecture
)

Expand Down Expand Up @@ -40,6 +41,7 @@ function RunCandleForBundle
-dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" `
-dFrameworkComponentVersion="$SharedFrameworkComponentVersion" `
-dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" `
-dTargetArchitecture="$TargetArchitecture" `
-arch "$Architecture" `
-ext WixBalExtension.dll `
-ext WixUtilExtension.dll `
Expand Down
2 changes: 2 additions & 0 deletions packaging/windows/sharedframework/generatemsi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ param(
[Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion,
[Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$TargetArchitecture,
[Parameter(Mandatory=$true)][string]$WixObjRoot
)

Expand Down Expand Up @@ -66,6 +67,7 @@ function RunCandle
-dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" `
-dFrameworkComponentVersion="$SharedFrameworkComponentVersion" `
-dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" `
-dTargetArchitecture="$TargetArchitecture" `
-dBuildVersion="$DotnetMSIVersion" `
-arch $Architecture `
-ext WixDependencyExtension.dll `
Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/sharedframework/variables.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<?define Servicing_Key_SPIndex = "0" ?>
<?define Servicing_Key_SPName = "Beta" ?>
<?define Manufacturer = "Microsoft Corporation" ?>
<?define ProductName = "$(var.ProductMoniker) ($(sys.BUILDARCH))" ?>
<?define ProductName = "$(var.ProductMoniker) ($(var.TargetArchitecture))" ?>
<?define ProductLanguage = "1033" ?>
<?define ProductVersion = "$(var.BuildVersion)" ?>
<?define LCID = "$(var.ProductLanguage)"?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>x86</Platform>
</Project>
<Project Condition="'$(TargetsWindows)' == 'true'" Include="win/Microsoft.NETCore.DotNetHost.pkgproj">
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsWindows)' == 'true'" Include="win/Microsoft.NETCore.DotNetHost.pkgproj">
<OSGroup>Windows_NT</OSGroup>
<Platform>arm64</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Version>$(HostVersion)</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
<PackagePlatforms>x64;x86;arm64;</PackagePlatforms>
<PackagePlatforms>x64;x86;arm;arm64;</PackagePlatforms>
<OutputPath>$(PackagesOutputPath)</OutputPath>
<IncludeRuntimeJson>true</IncludeRuntimeJson>
<Serviceable>true</Serviceable>
Expand All @@ -19,6 +19,9 @@
<ProjectReference Include="win\Microsoft.NETCore.DotNetHost.pkgproj">
<Platform>x86</Platform>
</ProjectReference>
<ProjectReference Include="win\Microsoft.NETCore.DotNetHost.pkgproj">
<Platform>arm</Platform>
</ProjectReference>
<ProjectReference Include="win\Microsoft.NETCore.DotNetHost.pkgproj">
<Platform>arm64</Platform>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<OSGroup>Windows_NT</OSGroup>
<Platform>x86</Platform>
</Project>
<Project Condition="'$(TargetsWindows)' == 'true'" Include="win/Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<OSGroup>Windows_NT</OSGroup>
<Platform>arm</Platform>
</Project>
<Project Condition="'$(TargetsWindows)' == 'true'" Include="win/Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<OSGroup>Windows_NT</OSGroup>
<Platform>arm64</Platform>
Expand Down
Loading