Skip to content

Commit

Permalink
Cross-compile RemoteExecutor (#2402)
Browse files Browse the repository at this point in the history
* Cross compile RemoteExecutor

* Remove host dependency for NS2.0

* Move RemoteExecutorHost to tools dir

* Upgrade to netcorapp2.1
  • Loading branch information
ViktorHofer authored May 5, 2019
1 parent 77298cf commit 6a34948
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.1;net472;netstandard2.0</TargetFrameworks>
<Description>This package provides support for running tests out-of-process.</Description>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<IsPackable>true</IsPackable>
Expand All @@ -13,18 +13,35 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.DotNet.RemoteExecutorHost\Microsoft.DotNet.RemoteExecutorHost.csproj" PrivateAssets="All" />
<ProjectReference Include="..\Microsoft.DotNet.RemoteExecutorHost\Microsoft.DotNet.RemoteExecutorHost.csproj"
Condition="'$(TargetFramework)' != 'netstandard2.0'"
ReferenceOutputAssembly="false"
OutputItemType="Content"
CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<None Include="$(RepoRoot)LICENSE.txt" PackagePath="LICENSE.txt" Pack="true"/>
<None Include="$(RepoRoot)THIRD-PARTY-NOTICES.txt" PackagePath="THIRD-PARTY-NOTICES.txt" Pack="true"/>
<Content Include="build\$(MSBuildProjectName).targets" PackagePath="build\$(MSBuildProjectName).targets" Pack="true" />
<None Include="$(RepoRoot)LICENSE.txt" PackagePath="LICENSE.txt" Pack="true" />
<None Include="$(RepoRoot)THIRD-PARTY-NOTICES.txt" PackagePath="THIRD-PARTY-NOTICES.txt" Pack="true" />
</ItemGroup>

<Target Name="PackBuildOutputs" DependsOnTargets="ResolveProjectReferences;SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;ResolveAssemblyReferences">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)Microsoft.DotNet.RemoteExecutorHost.dll" PackagePath="lib\$(TargetFramework)\" />
<TfmSpecificPackageFile Include="$(OutputPath)Microsoft.DotNet.RemoteExecutorHost.runtimeconfig.json" PackagePath="lib\$(TargetFramework)\" />
<Target Name="PackBuildOutputs" DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences;CopyFilesToOutputDirectory">
<MSBuild
Projects="@(ProjectReference)"
Targets="GetTargetPath">
<Output TaskParameter="TargetOutputs" ItemName="ProjectReferenceTargetPath" />
</MSBuild>
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
<TfmSpecificPackageFile Include="$(OutputPath)$(TargetName).deps.json" PackagePath="lib\$(TargetFramework)\" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<TfmSpecificPackageFile Include="$(OutputPath)%(ProjectReference.Filename).dll" PackagePath="tools\$(TargetFramework)\" />
<TfmSpecificPackageFile Include="$([System.IO.Path]::GetDirectoryName('%(ProjectReferenceTargetPath.Identity)'))\%(ProjectReferenceTargetPath.Filename).runtimeconfig.json" PackagePath="tools\$(TargetFramework)\" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<TfmSpecificPackageFile Include="$(OutputPath)%(ProjectReference.Filename).exe" PackagePath="tools\$(TargetFramework)\" />
<TfmSpecificPackageFile Include="$([System.IO.Path]::GetDirectoryName('%(ProjectReferenceTargetPath.Identity)'))\%(ProjectReferenceTargetPath.Filename)%(ProjectReferenceTargetPath.Extension).config" PackagePath="tools\$(TargetFramework)\" />
</ItemGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static partial class RemoteExecutor
// The exit code returned when the test process exits successfully.
public const int SuccessExitCode = 42;
// The path of the remote executor.
public static readonly string Path = System.IO.Path.GetFullPath("Microsoft.DotNet.RemoteExecutorHost.dll");
public static readonly string Path;
// The name of the host
public static string HostRunnerName;
// The path of the host
Expand All @@ -35,16 +35,19 @@ static RemoteExecutor()
if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.OrdinalIgnoreCase) || PlatformDetection.IsInAppContainer)
{
// Host is required to have a remote execution feature integrated. Currently applies to uap and *aot.
Path = processFileName;
HostRunner = HostRunnerName;
s_extraParameter = "remote";
}
else if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase))
{
Path = System.IO.Path.Combine(AppContext.BaseDirectory, "Microsoft.DotNet.RemoteExecutorHost.dll");
HostRunner = processFileName;
s_extraParameter = Path;
}
else if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase))
{
Path = System.IO.Path.Combine(AppContext.BaseDirectory, "Microsoft.DotNet.RemoteExecutorHost.exe");
HostRunner = Path;
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\..\tools\net472\*" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)\..\tools\netcoreapp2.1\*" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!--
We generate a netstandard executable image which will be invoked by Microsoft.DotNet.RemoteExecutor.
The SDK defaults to TargetExt dll, nevertheless CreateProcess invokes that assembly directly
on .NET Framework, or with the dotnet host on .NET Core.
-->
<OutputType>Exe</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.1;net472</TargetFrameworks>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<None Update="Microsoft.DotNet.RemoteExecutorHost.runtimeconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rollForwardOnNoCandidateFx": 2
}

0 comments on commit 6a34948

Please sign in to comment.