Skip to content

Commit

Permalink
[dotnet] Add support for specifying the VM with the _XamarinRuntime p…
Browse files Browse the repository at this point in the history
…roperty. (#10881)

Use a private property (prefixed with underscore) for now, until we can decide
on a better/general name.

Also add a variation to xharness to build monotouch-test with CoreCLR
(building works fine, but it crashes at startup, which is expected at this
point).
  • Loading branch information
rolfbjarne authored Mar 16, 2021
1 parent ddf1645 commit 32e4d05
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
The problem is that by default we get the 'Microsoft.NETCore.App.Runtime.osx-x64' runtime pack (the core clr version), when we want the 'Microsoft.NETCore.App.Mono.Runtime.osx-x64' runtime pack.
This works around that by declaring a new known framework for mono's runtime pack, removing the default 'Microsoft.NETCore.App' framework reference, and adding the mono one.
-->
<ItemGroup Condition="'$(_PlatformName)' == 'macOS'">
<ItemGroup Condition="'$(_PlatformName)' == 'macOS' And '$(_XamarinRuntime)' != 'CoreCLR'">
<KnownFrameworkReference Include="Microsoft.NETCore.App.Mono"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.NETCore.App.Mono"
Expand Down
9 changes: 6 additions & 3 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
TargetArchitectures=$(TargetArchitectures)
TargetFramework=$(_ComputedTargetFrameworkMoniker)
Verbosity=$(_BundlerVerbosity)
XamarinRuntime=$(_XamarinRuntime)
</_CustomLinkerOptions>
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data "LinkerOptionsFile=$(_CustomLinkerOptionsFile)"</_ExtraTrimmerArgs>

Expand Down Expand Up @@ -379,8 +380,9 @@

<Target Name="_ComputeFrameworkVariables" DependsOnTargets="ResolveRuntimePackAssets">
<PropertyGroup>
<_MonoNugetPackageId Condition="'$(_PlatformName)' != 'macOS'">Microsoft.NETCore.App.Runtime.$(RuntimeIdentifier)</_MonoNugetPackageId>
<_MonoNugetPackageId Condition="'$(_PlatformName)' == 'macOS'">Microsoft.NETCore.App.Runtime.Mono.$(RuntimeIdentifier)</_MonoNugetPackageId>
<_PackageIdInfix Condition="'$(_XamarinRuntime)' != 'CoreCLR' And '$(_PlatformName)' == 'macOS'">Mono.</_PackageIdInfix>

<_MonoNugetPackageId>Microsoft.NETCore.App.Runtime.$(_PackageIdInfix)$(RuntimeIdentifier)</_MonoNugetPackageId>
</PropertyGroup>
<ItemGroup>
<!-- Look in the ResolvedFrameworkReference for our Microsoft.* package. This should only find a single package. -->
Expand Down Expand Up @@ -428,8 +430,9 @@
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == ''">static</_LibXamarinLinkMode>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'dylib'">dylib</_LibXamarinExtension>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'static'">a</_LibXamarinExtension>
<_LibXamarinRuntime Condition="'$(_XamarinRuntime)' == 'CoreCLR'">-coreclr</_LibXamarinRuntime>
<_LibXamarinDebug Condition="'$(_BundlerDebug)' == 'true'">-debug</_LibXamarinDebug>
<_LibXamarinName Condition="'$(_LibXamarinName)' == ''">libxamarin-dotnet$(_LibXamarinDebug).$(_LibXamarinExtension)</_LibXamarinName>
<_LibXamarinName Condition="'$(_LibXamarinName)' == ''">libxamarin-dotnet$(_LibXamarinRuntime)$(_LibXamarinDebug).$(_LibXamarinExtension)</_LibXamarinName>

</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions tests/xharness/Harness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ int AutoConfigureMac (bool generate_projects)
Name = "monotouch-test",
IsDotNetProject = true,
TargetFrameworkFlavors = MacFlavors.DotNet,
Platform = "AnyCPU",
});

foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified }) {
Expand Down
1 change: 1 addition & 0 deletions tests/xharness/Jenkins/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class TestData
public bool? Ignored;
public bool EnableSGenConc;
public bool UseThumb;
public string XamarinRuntime;
public MonoNativeLinkMode MonoNativeLinkMode;
public IEnumerable<IDevice> Candidates;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/xharness/Jenkins/TestVariationsFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ IEnumerable<TestData> GetTestData (RunTestTask test)
case "AnyCPU":
case "x86":
switch (test.TestName) {
case "monotouch-test":
if (test.TestProject.IsDotNetProject)
yield return new TestData { Variation = "Debug (CoreCLR)", Debug = true, XamarinRuntime = "CoreCLR", Ignored = true, };
break;
case "xammac tests":
switch (test.ProjectConfiguration) {
case "Release":
Expand Down Expand Up @@ -157,6 +161,7 @@ public IEnumerable<T> CreateTestVariations<T> (IEnumerable<T> tests, Func<MSBuil
var ignored = test_data.Ignored;
var known_failure = test_data.KnownFailure;
var candidates = test_data.Candidates;
var xamarin_runtime = test_data.XamarinRuntime;

if (task.TestProject.IsDotNetProject)
variation += " [dotnet]";
Expand Down Expand Up @@ -210,6 +215,8 @@ public IEnumerable<T> CreateTestVariations<T> (IEnumerable<T> tests, Func<MSBuil
if (!debug && !isMac)
clone.Xml.SetMtouchUseLlvm (true, task.ProjectPlatform, configuration);
if (!string.IsNullOrEmpty (xamarin_runtime))
clone.Xml.SetTopLevelPropertyGroupValue ("_XamarinRuntime", xamarin_runtime);
clone.Xml.Save (clone.Path);
});

Expand Down
1 change: 1 addition & 0 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public bool IsDefaultMarshalManagedExceptionMode {
public bool? DisableOmitFramePointer = null; // Only applicable to Xamarin.Mac
public string CustomBundleName = "MonoBundle"; // Only applicable to Xamarin.Mac and Mac Catalyst

public XamarinRuntime XamarinRuntime;
public bool? UseMonoFramework;

// The bitcode mode to compile to.
Expand Down
3 changes: 2 additions & 1 deletion tools/common/Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ void GenerateIOSMain (StringWriter sw, Abi abi)
sw.WriteLine ("\txamarin_gc_pump = {0};", app.DebugTrack.Value ? "TRUE" : "FALSE");
sw.WriteLine ("\txamarin_init_mono_debug = {0};", app.PackageManagedDebugSymbols ? "TRUE" : "FALSE");
sw.WriteLine ("\txamarin_executable_name = \"{0}\";", assembly_name);
sw.WriteLine ("\tmono_use_llvm = {0};", enable_llvm ? "TRUE" : "FALSE");
if (app.XamarinRuntime == XamarinRuntime.MonoVM)
sw.WriteLine ("\tmono_use_llvm = {0};", enable_llvm ? "TRUE" : "FALSE");
sw.WriteLine ("\txamarin_log_level = {0};", Driver.Verbosity.ToString (CultureInfo.InvariantCulture));
sw.WriteLine ("\txamarin_arch_name = \"{0}\";", abi.AsArchString ());
if (!app.IsDefaultMarshalManagedExceptionMode)
Expand Down
6 changes: 6 additions & 0 deletions tools/common/XamarinRuntime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Xamarin.Bundler {
public enum XamarinRuntime {
MonoVM,
CoreCLR,
}
}
6 changes: 6 additions & 0 deletions tools/dotnet-linker/LinkerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ public static LinkerConfiguration GetInstance (LinkContext context, bool createI
throw new InvalidOperationException ($"Invalid Verbosity '{value}' in {linker_file}");
Driver.Verbosity += verbosity;
break;
case "XamarinRuntime":
if (!Enum.TryParse<XamarinRuntime> (value, out var rv))
throw new InvalidOperationException ($"Invalid XamarinRuntime '{value}' in {linker_file}");
Application.XamarinRuntime = rv;
break;
default:
throw new InvalidOperationException ($"Unknown key '{key}' in {linker_file}");
}
Expand Down Expand Up @@ -291,6 +296,7 @@ public void Write ()
Console.WriteLine ($" SdkVersion: {SdkVersion}");
Console.WriteLine ($" UseInterpreter: {Application.UseInterpreter}");
Console.WriteLine ($" Verbosity: {Verbosity}");
Console.WriteLine ($" XamarinRuntime: {Application.XamarinRuntime}");
}
}

Expand Down
3 changes: 3 additions & 0 deletions tools/dotnet-linker/dotnet-linker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
<Compile Include="..\common\DlsymOptions.cs">
<Link>external\tools\common\DlsymOptions.cs</Link>
</Compile>
<Compile Include="..\common\XamarinRuntime.cs">
<Link>tools\common\XamarinRuntime.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\mtouch\Errors.resx">
Expand Down
3 changes: 3 additions & 0 deletions tools/mmp/mmp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@
<Compile Include="..\common\DlsymOptions.cs">
<Link>tools\common\DlsymOptions.cs</Link>
</Compile>
<Compile Include="..\common\XamarinRuntime.cs">
<Link>tools\common\XamarinRuntime.cs</Link>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions tools/mtouch/mtouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@
<Compile Include="..\common\DlsymOptions.cs">
<Link>tools\common\DlsymOptions.cs</Link>
</Compile>
<Compile Include="..\common\XamarinRuntime.cs">
<Link>tools\common\XamarinRuntime.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Core" />
Expand Down

6 comments on commit 32e4d05

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on Build. ✅

Tests passed on Build.

API diff

✅ API Diff from stable

View API diff

Packages generated

View packages

🎉 All 182 tests passed 🎉

Pipeline on Agent XAMBOT-1028'

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests iOS32b (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests iOS (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests tvOS (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • apitest
  • xammac_tests

Pipeline on Agent

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac High Sierra (10.13) ❌

Tests failed on Mac High Sierra (10.13).

Failed tests are:

  • apitest
  • xammac_tests

Pipeline on Agent

Please sign in to comment.