Merge pull request #8980 from rolfbjarne/dotnet-xharness-introspection

[dotnet] Make the introspection tests pass in the 64-bit iOS simulator.
This commit is contained in:
Rolf Bjarne Kvinge 2020-07-06 11:14:40 +02:00 коммит произвёл GitHub
Родитель 46b6d3787d 4dabb46d92
Коммит 739ab8dfd4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
46 изменённых файлов: 700 добавлений и 97 удалений

Просмотреть файл

@ -87,7 +87,9 @@
<!-- We re-use ComputeFilesToPublish & CopyFilesToPublishDirectory to copy files to the .app -->
<!-- ComputeFilesToPublish will run ILLink -->
<CreateAppBundleDependsOn>
_CollectBundleResources;
_DetectAppManifest;
_CopyResourcesToBundle;
_CompileAppManifest;
_ComputeLinkerArguments;
ComputeFilesToPublish;
@ -118,13 +120,20 @@
<_CustomLinkerOptions>
AssemblyName=$(AssemblyName).dll
CacheDirectory=$(_LinkerCacheDirectory)
DeploymentTarget=$(_MinimumOSVersion)
ItemsDirectory=$(_LinkerItemsDirectory)
IsSimulatorBuild=$(_SdkIsSimulator)
Platform=$(_PlatformName)
PlatformAssembly=$(_PlatformAssemblyName).dll
SdkVersion=$(_SdkVersion)
TargetArchitectures=$(TargetArchitectures)
</_CustomLinkerOptions>
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data "LinkerOptionsFile=$(_CustomLinkerOptionsFile)"</_ExtraTrimmerArgs>
<!-- Work around a linker issue: https://github.com/mono/linker/issues/1304 -->
<!-- System.Runtime.dll isn't always copied to the .app -->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) -p copy "System.Runtime"</_ExtraTrimmerArgs>
<!-- Verbose output, so that we get something to stdout when something goes wrong -->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose</_ExtraTrimmerArgs>
</PropertyGroup>
@ -138,6 +147,10 @@
<!-- At the end of the pipeline -->
<Type>Xamarin.GenerateMainStep</Type>
</_TrimmerCustomSteps>
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)">
<!-- At the end of the pipeline -->
<Type>Xamarin.GatherFrameworksStep</Type>
</_TrimmerCustomSteps>
</ItemGroup>
<!-- Create the file with our custom linker options -->
@ -149,6 +162,10 @@
<ReadItemsFromFile File="$(_LinkerItemsDirectory)/_MainFile.items" Condition="Exists('$(_LinkerItemsDirectory)/_MainFile.items')">
<Output TaskParameter="Items" ItemName="_MainFile" />
</ReadItemsFromFile>
<!-- Load _LinkerFrameworks -->
<ReadItemsFromFile File="$(_LinkerItemsDirectory)/_LinkerFrameworks.items" Condition="Exists('$(_LinkerItemsDirectory)/_LinkerFrameworks.items')">
<Output TaskParameter="Items" ItemName="_LinkerFrameworks" />
</ReadItemsFromFile>
</Target>
<!-- Native code -->
@ -254,9 +271,8 @@
<_XamarinMainLibraries Include="$(_XamarinNativeLibraryDirectory)/$(_LibXamarinName)" />
<!-- Link with the libraries shipped with the mono runtime pack -->
<_XamarinMainLibraries Include="@(_MonoLibrary)" />
<!-- Hardcode a few frameworks for now -->
<_NativeExecutableFrameworks Include="Foundation" />
<_NativeExecutableFrameworks Include="CoreFoundation" />
<!-- The frameworks we need to link with (both weakly and normally) -->
<_NativeExecutableFrameworks Include="@(_LinkerFrameworks)" />
</ItemGroup>
<LinkNativeCode
@ -270,7 +286,6 @@
SdkIsSimulator="$(_SdkIsSimulator)"
SdkRoot="$(_SdkRoot)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
WeakFrameworks="@(_NativeExecutableWeakFrameworks)"
/>
<ItemGroup>

2
external/Touch.Unit поставляемый

@ -1 +1 @@
Subproject commit 6c5bb930b35cf326d1f650eac0a5ac9e679a4e09
Subproject commit b4e8606a85255f2456b0b20d5a0732298fa1ad36

Просмотреть файл

@ -29,7 +29,6 @@ namespace Xamarin.MacDev.Tasks {
public string MinimumOSVersion { get; set; }
public ITaskItem[] Frameworks { get; set; }
public ITaskItem [] WeakFrameworks { get; set; }
#endregion
public override bool Execute ()
@ -78,14 +77,8 @@ namespace Xamarin.MacDev.Tasks {
if (Frameworks != null) {
foreach (var fw in Frameworks) {
arguments.Add ("-framework");
arguments.Add (fw.ItemSpec);
}
}
if (WeakFrameworks != null) {
foreach (var fw in WeakFrameworks) {
arguments.Add ("-weak_framework");
var is_weak = fw.GetMetadata ("IsWeak") == "true";
arguments.Add (is_weak ? "-weak_framework" : "-framework");
arguments.Add (fw.ItemSpec);
}
}

Просмотреть файл

@ -28,7 +28,8 @@ namespace EmbeddedResources {
public void Embedded ()
{
#if __TVOS__
#if __TVOS__ && !NET
// Don't know if this might fail with .NET, so don't disable it until we know otherwise (the TestRuntime.CheckExecutingWithInterpreter is not available for .NET, so if that's the case we might need different logic)
if (TestRuntime.CheckExecutingWithInterpreter ())
Assert.Ignore ("This test is disabled on TVOS."); // Randomly crashed on tvOS -> https://github.com/xamarin/maccore/issues/1909

Просмотреть файл

@ -96,6 +96,9 @@ partial class TestRuntime
NUnit.Framework.Assert.Ignore (message);
}
#if NET
// error CS1061: 'AppDomain' does not contain a definition for 'DefineDynamicAssembly' and no accessible extension method 'DefineDynamicAssembly' accepting a first argument of type 'AppDomain' could be found (are you missing a using directive or an assembly reference?)
#else
static AssemblyName assemblyName = new AssemblyName ("DynamicAssemblyExample");
public static bool CheckExecutingWithInterpreter ()
{
@ -110,6 +113,7 @@ partial class TestRuntime
return false;
}
}
#endif
public static void AssertXcodeVersion (int major, int minor, int build = 0)
{

Просмотреть файл

@ -225,6 +225,12 @@ namespace Introspection {
case "CGColorConverter":
case "OSLog": // c api, no need to check
return true;
#if NET
case "SecTrust": // System.EntryPointNotFoundException : AppleCryptoNative_X509ImportCertificate
case "SecTrust2": // System.EntryPointNotFoundException : AppleCryptoNative_X509ImportCertificate
// Filed here: https://github.com/dotnet/runtime/issues/36897
return true;
#endif
default:
return false;
}

Просмотреть файл

@ -318,6 +318,13 @@ namespace Introspection {
{
var cstr = ctor.ToString ();
#if NET
// .NET 5 has an unusual take on how a ConstructorInfo should be converted to a string
// See also: https://github.com/dotnet/runtime/issues/36688
if (cstr.StartsWith (".ctorVoid ", StringComparison.Ordinal))
cstr = "Void .ctor" + cstr.Substring (".ctorVoid ".Length);
#endif
switch (type.Name) {
case "MKTileOverlayRenderer":
// NSInvalidArgumentEception Expected a MKTileOverlay

Просмотреть файл

@ -209,7 +209,21 @@ namespace Introspection
case "__Internal":
// load from executable
path = null;
#if NET
// Globalization hasn't been implemented yet: https://github.com/xamarin/xamarin-macios/issues/8906
if (name.StartsWith ("GlobalizationNative_", StringComparison.Ordinal))
continue;
#endif
break;
#if NET
case "libhostpolicy":
// There's no libhostpolicy library.
// https://github.com/dotnet/runtime/issues/38543
continue;
case "libSystem.Native":
path += ".dylib";
break;
#endif
case "libc":
// we still have some rogue/not-fully-qualified DllImport
path = "/usr/lib/libSystem.dylib";

Просмотреть файл

@ -143,6 +143,9 @@ namespace Introspection {
Assert.AreEqual (0, Errors, "{0} errors found in {1} native delegate validated: {2}", Errors, n, string.Join (", ", failed_api));
}
#if NET
[Ignore ("We don't ship NUnitLite in .NET 5")]
#endif
[Test]
public void NUnitLite ()
{
@ -153,6 +156,9 @@ namespace Introspection {
#if !__WATCHOS__
[Test]
#if NET
[Ignore ("We don't ship MonoTouch.Dialog in .NET 5")]
#endif
public void MonoTouchDialog ()
{
// there's no direct reference to MTD - but it's there

Просмотреть файл

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.iOS.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>ios-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<DefineConstants>NET</DefineConstants>
<LangVersion>latest</LangVersion>
<RootNamespace>Introspection</RootNamespace>
<AssemblyName>introspection</AssemblyName>
<MtouchLink>None</MtouchLink>
<AssetTargetFallback>xamarinios10;$(AssetTargetFallback)</AssetTargetFallback>
<!-- This is needed because the packages/ directory might be in the same folder as this project file, and some some packages might have C# files, which would then automatically be included -->
<DefaultItemExcludes>$(DefaultItemExcludes);packages/**;</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnitLite" Version="3.12.0" />
<PackageReference Include="MonoTouch.Dialog" Version="2.0.0-pre1" />
<ProjectReference Include="..\..\..\external\Touch.Unit\Touch.Client\Touch.Client-iOS.dotnet.csproj" />
<!-- MonoTouch.Dialog references System.Json, which isn't shipped with .NET5, so reference the NuGet instead -->
<PackageReference Include="System.Json" Version="4.7.1" />
<!-- The linker resolves some assembly references too eagerly, and fails when it can't find them, so work around this by referencing the missing assemblies-->
<!-- ref: https://github.com/mono/linker/issues/1139 -->
<PackageReference Include="System.Security.Permissions" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Threading.AccessControl" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.CodeDom" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Diagnostics.EventLog" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.IO.Ports" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Data.SqlClient" Version="5.0.0-alpha1.19523.8" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\ApiBaseTest.cs">
<Link>ApiBaseTest.cs</Link>
</Compile>
<Compile Include="..\ApiClassPtrTest.cs">
<Link>ApiClassPtrTest.cs</Link>
</Compile>
<Compile Include="..\ApiCMAttachmentTest.cs">
<Link>ApiCMAttachmentTest.cs</Link>
</Compile>
<Compile Include="..\ApiCoreImageFiltersTest.cs">
<Link>ApiCoreImageFiltersTest.cs</Link>
</Compile>
<Compile Include="..\ApiCtorInitTest.cs">
<Link>ApiCtorInitTest.cs</Link>
</Compile>
<Compile Include="..\ApiFieldTest.cs">
<Link>ApiFieldTest.cs</Link>
</Compile>
<Compile Include="..\ApiPInvokeTest.cs">
<Link>ApiPInvokeTest.cs</Link>
</Compile>
<Compile Include="..\ApiProtocolTest.cs">
<Link>ApiProtocolTest.cs</Link>
</Compile>
<Compile Include="..\ApiSelectorTest.cs">
<Link>ApiSelectorTest.cs</Link>
</Compile>
<Compile Include="..\ApiSignatureTest.cs">
<Link>ApiSignatureTest.cs</Link>
</Compile>
<Compile Include="..\ApiStructTest.cs">
<Link>ApiStructTest.cs</Link>
</Compile>
<Compile Include="..\ApiTypoTest.cs">
<Link>ApiTypoTest.cs</Link>
</Compile>
<Compile Include="..\ApiWeakPropertyTest.cs">
<Link>ApiWeakPropertyTest.cs</Link>
</Compile>
<Compile Include="..\CoreSelectorTest.cs">
<Link>CoreSelectorTest.cs</Link>
</Compile>
<Compile Include="..\EnvironmentVariable.cs">
<Link>EnvironmentVariable.cs</Link>
</Compile>
<Compile Include="..\..\common\MonoNativeConfig.cs">
<Link>MonoNativeConfig.cs</Link>
</Compile>
<Compile Include="..\..\common\PlatformInfo.cs">
<Link>PlatformInfo.cs</Link>
</Compile>
<Compile Include="..\..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\ApiAvailabilityTest.cs">
<Link>ApiAvailabilityTest.cs</Link>
</Compile>
<Compile Include="..\..\..\tools\common\Frameworks.cs">
<Link>Frameworks.cs</Link>
</Compile>
<Compile Include="..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\ApiFrameworkTest.cs">
<Link>ApiFrameworkTest.cs</Link>
</Compile>
<Compile Include="..\ApiTypeTest.cs">
<Link>ApiTypeTest.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\xamarin1.png">
<Link>xamarin1.png</Link>
</BundleResource>
<BundleResource Include="..\..\..\tools\mtouch\simlauncher64-sgen.frameworks">
<Link>simlauncher64-sgen.frameworks</Link>
</BundleResource>
</ItemGroup>
</Project>

Просмотреть файл

@ -207,7 +207,7 @@ namespace Xharness {
if (string.IsNullOrEmpty (SdkRoot))
SdkRoot = config ["XCODE_DEVELOPER_ROOT"] ?? configuration.SdkRoot;
processManager = new ProcessManager (XcodeRoot, MlaunchPath);
processManager = new ProcessManager (XcodeRoot, MlaunchPath, GetDotNetExecutable, XIBuildPath);
TunnelBore = new TunnelBore (processManager);
}
@ -389,6 +389,7 @@ namespace Xharness {
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj")), false) { Name = p });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios.csproj"))) { Name = "introspection" });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios-dotnet.csproj"))) { Name = "introspection", IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = true, SkipiOS32Variation = true, });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "link all.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
@ -518,17 +519,21 @@ namespace Xharness {
TemplateProjectPath = file,
Harness = this,
TestProject = proj,
ShouldSkipProjectGeneration = proj.IsDotNetProject,
};
unified.Execute ();
unified_targets.Add (unified);
var today = new TodayExtensionTarget {
TemplateProjectPath = file,
Harness = this,
TestProject = proj,
};
today.Execute ();
today_targets.Add (today);
if (!proj.SkipTodayExtensionVariation) {
var today = new TodayExtensionTarget {
TemplateProjectPath = file,
Harness = this,
TestProject = proj,
ShouldSkipProjectGeneration = proj.IsDotNetProject,
};
today.Execute ();
today_targets.Add (today);
}
}
}

Просмотреть файл

@ -19,6 +19,9 @@ namespace Xharness.Jenkins {
if (!project.IsExecutableProject)
continue;
if (project.SkipDeviceVariations)
continue;
bool ignored = !jenkins.IncludeDevice;
if (!jenkins.IsIncluded (project))
ignored = true;
@ -59,23 +62,25 @@ namespace Xharness.Jenkins {
useTcpTunnel: jenkins.Harness.UseTcpTunnel,
candidates: jenkins.Devices.Connected32BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.IncludeiOS32 });
var todayProject = project.AsTodayExtensionProject ();
var buildToday = new MSBuildTask (jenkins: jenkins, testProject: todayProject, processManager: processManager) {
ProjectConfiguration = "Debug64",
ProjectPlatform = "iPhone",
Platform = TestPlatform.iOS_TodayExtension64,
TestName = project.Name,
};
buildToday.CloneTestProject (jenkins.MainLog, processManager, todayProject);
projectTasks.Add (new RunDeviceTask (
jenkins: jenkins,
devices: jenkins.Devices,
buildTask: buildToday,
processManager: processManager,
tunnelBore: jenkins.TunnelBore,
errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
useTcpTunnel: jenkins.Harness.UseTcpTunnel,
candidates: jenkins.Devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.IncludeiOSExtensions, BuildOnly = jenkins.ForceExtensionBuildOnly });
if (!project.SkipTodayExtensionVariation) {
var todayProject = project.AsTodayExtensionProject ();
var buildToday = new MSBuildTask (jenkins: jenkins, testProject: todayProject, processManager: processManager) {
ProjectConfiguration = "Debug64",
ProjectPlatform = "iPhone",
Platform = TestPlatform.iOS_TodayExtension64,
TestName = project.Name,
};
buildToday.CloneTestProject (jenkins.MainLog, processManager, todayProject);
projectTasks.Add (new RunDeviceTask (
jenkins: jenkins,
devices: jenkins.Devices,
buildTask: buildToday,
processManager: processManager,
tunnelBore: jenkins.TunnelBore,
errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
useTcpTunnel: jenkins.Harness.UseTcpTunnel,
candidates: jenkins.Devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.IncludeiOSExtensions, BuildOnly = jenkins.ForceExtensionBuildOnly });
}
}
if (!project.SkiptvOSVariation) {

Просмотреть файл

@ -39,14 +39,18 @@ namespace Xharness.Jenkins {
configurations = new string [] { "Debug" };
foreach (var config in configurations) {
foreach (var pair in ps) {
var derived = new MSBuildTask (jenkins: jenkins, testProject: project, processManager: processManager) {
ProjectConfiguration = config,
ProjectPlatform = "iPhoneSimulator",
Platform = pair.Item2,
Ignored = pair.Item3,
TestName = project.Name,
Dependency = project.Dependency,
};
MSBuildTask derived;
if (project.IsDotNetProject) {
derived = new DotNetBuildTask (jenkins: jenkins, testProject: project, processManager: processManager);
} else {
derived = new MSBuildTask (jenkins: jenkins, testProject: project, processManager: processManager);
}
derived.ProjectConfiguration = config;
derived.ProjectPlatform = "iPhoneSimulator";
derived.Platform = pair.Item2;
derived.Ignored = pair.Item3;
derived.TestName = project.Name;
derived.Dependency = project.Dependency;
derived.CloneTestProject (jenkins.MainLog, processManager, pair.Item1);
var simTasks = CreateAsync (jenkins, processManager, derived);
runSimulatorTasks.AddRange (simTasks);
@ -100,8 +104,21 @@ namespace Xharness.Jenkins {
ignored = new [] { false };
break;
case TestPlatform.iOS_Unified:
platforms = new TestPlatform [] { TestPlatform.iOS_Unified32, TestPlatform.iOS_Unified64 };
ignored = new [] { !jenkins.IncludeiOS32, false };
var iOSProject = (iOSTestProject) buildTask.TestProject;
if (iOSProject.SkipiOS32Variation && iOSProject.SkipiOS64Variation) {
return runtasks;
} else if (iOSProject.SkipiOS32Variation) {
targets = new TestTarget [] { TestTarget.Simulator_iOS64 };
platforms = new TestPlatform [] { TestPlatform.iOS_Unified64 };
ignored = new [] { false };
} else if (iOSProject.SkipiOS64Variation) {
targets = new TestTarget [] { TestTarget.Simulator_iOS32 };
platforms = new TestPlatform [] { TestPlatform.iOS_Unified32 };
ignored = new [] { !jenkins.IncludeiOS32 };
} else {
platforms = new TestPlatform [] { TestPlatform.iOS_Unified32, TestPlatform.iOS_Unified64 };
ignored = new [] { !jenkins.IncludeiOS32, false };
}
break;
case TestPlatform.iOS_TodayExtension64:
targets = new TestTarget [] { TestTarget.Simulator_iOS64 };

Просмотреть файл

@ -106,6 +106,8 @@ namespace Xharness.Jenkins {
yield return new TestData { Variation = "Debug (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all,-remove-uithread-checks", Debug = true, Profiling = false, LinkMode = "Full", Defines = "OPTIMIZEALL", Undefines = "DYNAMIC_REGISTRAR", Ignored = !jenkins.IncludeAll };
break;
case "introspection":
if (test.TestProject.IsDotNetProject)
break; // Our .NET 5 code hasn't implemented building using static libraries yet, and the iOS 10.3 simulator requires dylibs to be signed, which we don't do yet, thus this doesn't quite work yet for the iOS 10.3 simulator.
foreach (var target in test.Platform.GetAppRunnerTargets ())
yield return new TestData {
Variation = $"Debug ({test.Platform.GetSimulatorMinVersion ()})",
@ -141,6 +143,9 @@ namespace Xharness.Jenkins {
foreach (var task in tests) {
if (string.IsNullOrEmpty (task.Variation))
task.Variation = task.ProjectConfiguration.Contains ("Debug") ? "Debug" : "Release";
if (task.TestProject.IsDotNetProject)
task.Variation += " [dotnet]";
}
var rv = new List<T> (tests);
@ -159,6 +164,9 @@ namespace Xharness.Jenkins {
var known_failure = test_data.KnownFailure;
var candidates = test_data.Candidates;
if (task.TestProject.IsDotNetProject)
variation += " [dotnet]";
if (known_failure.HasValue)
ignored = true;
@ -211,13 +219,18 @@ namespace Xharness.Jenkins {
clone.Xml.Save (clone.Path);
});
var build = new MSBuildTask (jenkins: jenkins, testProject: clone, processManager: processManager) {
ProjectConfiguration = configuration,
ProjectPlatform = task.ProjectPlatform,
Platform = task.Platform,
InitialTask = clone_task,
TestName = clone.Name,
};
MSBuildTask build;
if (clone.IsDotNetProject) {
build = new DotNetBuildTask (jenkins: jenkins, testProject: clone, processManager: processManager);
} else {
build = new MSBuildTask (jenkins: jenkins, testProject: clone, processManager: processManager);
}
build.ProjectConfiguration = configuration;
build.ProjectPlatform = task.ProjectPlatform;
build.Platform = task.Platform;
build.InitialTask = clone_task;
build.TestName = clone.Name;
T newVariation = creator (build, task, candidates);
newVariation.Variation = variation;
newVariation.Ignored = ignored ?? task.Ignored;

Просмотреть файл

@ -227,6 +227,9 @@ namespace Xharness
allTargets.AddRange (watchos_targets);
allTargets.AddRange (today_targets);
// Don't generate makefile targets for .NET projects for now.
allTargets.RemoveAll (v => v.TestProject.IsDotNetProject);
// build/[install/]run targets for specific test projects.
foreach (var target in allTargets) {
if (!target.IsExe || target.Name.IndexOf ("bcl-test", 0, StringComparison.Ordinal) != -1)

Просмотреть файл

@ -40,7 +40,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tests.Execution {
stdoutLog = new LogFile ("my stdout log", stdoutLogPath);
stderrLog = new LogFile ("my stderr log", stderrLogPath);
dummyProcess = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "DummyTestProcess.exe");
manager = new ProcessManager ("/path/to/xcode", "/path/to/mlaunch");
manager = new ProcessManager ("/path/to/xcode", "/path/to/mlaunch", (v) => "/path/to/dotnet", "/path/to/msbuild");
testProcess = new Process ();
testProcess.StartInfo.FileName = "mono";
}

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
}
public class AppBundleInformationParser : IAppBundleInformationParser {
public Task<AppBundleInformation> ParseFromProjectAsync (ILog log, IProcessManager processManager, string projectFilePath, TestTarget target, string buildConfiguration)
public async Task<AppBundleInformation> ParseFromProjectAsync (ILog log, IProcessManager processManager, string projectFilePath, TestTarget target, string buildConfiguration)
{
var csproj = new XmlDocument ();
csproj.LoadWithoutNetworkAccess (projectFilePath);
@ -34,9 +34,17 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
var platform = target.IsSimulator () ? "iPhoneSimulator" : "iPhone";
string appPath = Path.Combine (Path.GetDirectoryName (projectFilePath),
csproj.GetOutputPath (platform, buildConfiguration).Replace ('\\', Path.DirectorySeparatorChar),
appName + (extension != null ? ".appex" : ".app"));
string appBundlePath;
if (csproj.IsDotNetProject ()) {
var properties = new Dictionary<string, string> {
{ "Configuration", buildConfiguration },
{ "Platform", platform },
};
appBundlePath = await csproj.GetPropertyByMSBuildEvaluationAsync (log, processManager, projectFilePath, "OutputPath", "_GenerateAppBundleName;_GenerateAppExBundleName", properties);
} else {
appBundlePath = csproj.GetOutputPath (platform, buildConfiguration).Replace ('\\', Path.DirectorySeparatorChar);
}
var appPath = Path.Combine (Path.GetDirectoryName (projectFilePath), appBundlePath, appName + (extension != null ? ".appex" : ".app"));
if (!Directory.Exists (appPath))
throw new DirectoryNotFoundException ($"The app bundle directory `{appPath}` does not exist");
@ -45,7 +53,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
? Directory.GetDirectories (Path.Combine (appPath, "Watch"), "*.app") [0]
: appPath;
return Task.FromResult (new AppBundleInformation (appName, bundleIdentifier, appPath, launchAppPath, extension));
return new AppBundleInformation (appName, bundleIdentifier, appPath, launchAppPath, extension);
}
}
}

Просмотреть файл

@ -15,10 +15,14 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Execution {
public bool Succeeded => !TimedOut && ExitCode == 0;
}
public delegate string GetDotNetExecutableDelegate (string project_directory);
// interface that helps to manage the different processes in the app.
public interface IProcessManager {
string XcodeRoot { get; }
string MlaunchPath { get; }
GetDotNetExecutableDelegate GetDotNetExecutable { get; }
string MSBuildPath { get; }
Version XcodeVersion { get; }
Task<ProcessExecutionResult> ExecuteCommandAsync (string filename, IList<string> args, ILog log, TimeSpan timeout, Dictionary<string, string> environment_variables = null, CancellationToken? cancellation_token = null);

Просмотреть файл

@ -19,6 +19,8 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Execution {
readonly string xcodeRoot;
public string XcodeRoot => xcodeRoot ?? autoDetectedXcodeRoot.Value;
public string MlaunchPath { get; }
public GetDotNetExecutableDelegate GetDotNetExecutable { get; private set; }
public string MSBuildPath { get; private set; }
Version xcode_version;
public Version XcodeVersion {
@ -32,10 +34,12 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Execution {
}
}
public ProcessManager (string xcodeRoot = null, string mlaunchPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch")
public ProcessManager (string xcodeRoot = null, string mlaunchPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch", GetDotNetExecutableDelegate dotNetPath = null, string msBuildPath = null)
{
this.xcodeRoot = xcodeRoot;
MlaunchPath = mlaunchPath;
GetDotNetExecutable = dotNetPath;
MSBuildPath = msBuildPath;
}
public async Task<ProcessExecutionResult> ExecuteCommandAsync (string filename,

Просмотреть файл

@ -57,6 +57,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
Stopwatch DurationStopWatch { get; }
IEnumerable<string> ReferencedNunitAndXunitTestAssemblies { get; }
string ProgressMessage { get; }
string RootDirectory { get; }
Task RunAsync ();

Просмотреть файл

@ -252,7 +252,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Tasks {
// So we clone the project file to a separate directory and build there instead.
// This is done asynchronously to speed to the initial test load.
TestProject = project.Clone ();
InitialTask = TestProject.CreateCopyAsync (log, processManager);
InitialTask = TestProject.CreateCopyAsync (log, processManager, this);
}
protected Stopwatch waitingDuration = new Stopwatch ();

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Xml;
@ -18,6 +19,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
public string Name;
public bool IsExecutableProject;
public bool IsNUnitProject;
public bool IsDotNetProject;
public string [] Configurations;
public Func<Task> Dependency;
public string FailureMessage;
@ -55,6 +57,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
TestProject rv = (TestProject) Activator.CreateInstance (GetType ());
rv.Path = Path;
rv.IsExecutableProject = IsExecutableProject;
rv.IsDotNetProject = IsDotNetProject;
rv.RestoreNugetsInProject = RestoreNugetsInProject;
rv.Name = Name;
rv.MTouchExtraArgs = MTouchExtraArgs;
@ -69,7 +72,7 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
return rv;
}
public async Task CreateCopyAsync (ILog log, IProcessManager processManager, ITestTask test = null)
public async Task CreateCopyAsync (ILog log, IProcessManager processManager, ITestTask test)
{
var directory = DirectoryUtilities.CreateTemporaryDirectory (test?.TestName ?? System.IO.Path.GetFileNameWithoutExtension (Path));
Directory.CreateDirectory (directory);
@ -91,6 +94,65 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
}
doc.ResolveAllPaths (original_path);
if (doc.IsDotNetProject ()) {
// Many types of files below the csproj directory are included by default,
// which means that we have to include them manually in the cloned csproj,
// because the cloned project is stored in a very different directory.
var test_dir = System.IO.Path.GetDirectoryName (original_path);
// Get all the files in the project directory from git
using var process = new Process ();
process.StartInfo.FileName = "git";
process.StartInfo.Arguments = "ls-files";
process.StartInfo.WorkingDirectory = test_dir;
var stdout = new MemoryLog () { Timestamp = false };
var result = await processManager.RunAsync (process, log, stdout, stdout, timeout: TimeSpan.FromSeconds (15));
if (!result.Succeeded)
throw new Exception ($"Failed to list the files in the directory {test_dir} (TimedOut: {result.TimedOut} ExitCode: {result.ExitCode}):\n{stdout}");
var files = stdout.ToString ().Split ('\n');
foreach (var file in files) {
var ext = System.IO.Path.GetExtension (file);
var full_path = System.IO.Path.Combine (test_dir, file);
var windows_file = full_path.Replace ('/', '\\');
if (file.Contains (".xcasset")) {
doc.AddInclude ("ImageAsset", file, windows_file, true);
continue;
}
switch (ext.ToLowerInvariant ()) {
case ".cs":
doc.AddInclude ("Compile", file, windows_file, true);
break;
case ".plist":
doc.AddInclude ("None", file, windows_file, true);
break;
case ".storyboard":
doc.AddInclude ("InterfaceDefinition", file, windows_file, true);
break;
case ".gitignore":
case ".csproj":
case ".props": // Directory.Build.props
case "": // Makefile
break; // ignore these files
default:
Console.WriteLine ($"Unknown file: {file} (extension: {ext}). There might be a default inclusion behavior for this file.");
break;
}
}
// The global.json and NuGet.config files make sure we use the locally built packages.
var dotnet_test_dir = System.IO.Path.Combine (test.RootDirectory, "dotnet");
var global_json = System.IO.Path.Combine (dotnet_test_dir, "global.json");
var nuget_config = System.IO.Path.Combine (dotnet_test_dir, "NuGet.config");
var target_directory = directory;
File.Copy (global_json, System.IO.Path.Combine (target_directory, System.IO.Path.GetFileName (global_json)), true);
log.WriteLine ($"Copied {global_json} to {target_directory}");
File.Copy (nuget_config, System.IO.Path.Combine (target_directory, System.IO.Path.GetFileName (nuget_config)), true);
log.WriteLine ($"Copied {nuget_config} to {target_directory}");
}
var projectReferences = new List<TestProject> ();
foreach (var pr in doc.GetProjectReferences ()) {
var tp = new TestProject (pr.Replace ('\\', '/'));

Просмотреть файл

@ -1,9 +1,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using Microsoft.DotNet.XHarness.iOS.Shared.Execution;
using Microsoft.DotNet.XHarness.iOS.Shared.Logging;
namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities {
public static class ProjectFileExtensions {
const string MSBuild_Namespace = "http://schemas.microsoft.com/developer/msbuild/2003";
@ -262,10 +267,15 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities {
public static void AddCompileInclude (this XmlDocument csproj, string link, string include, bool prepend = false)
{
var compile_node = csproj.SelectSingleNode ("//*[local-name() = 'Compile']");
var item_group = compile_node.ParentNode;
AddInclude (csproj, "Compile", link, include, prepend);
}
var node = csproj.CreateElement ("Compile", csproj.GetNamespace ());
public static void AddInclude (this XmlDocument csproj, string type, string link, string include, bool prepend = false)
{
var type_node = csproj.SelectSingleNode ($"//*[local-name() = '{type}']");
var item_group = type_node?.ParentNode ?? csproj.SelectSingleNode ($"//*[local-name() = 'ItemGroup'][last()]");
var node = csproj.CreateElement (type, csproj.GetNamespace ());
var include_attribute = csproj.CreateAttribute ("Include");
include_attribute.Value = include;
node.Attributes.Append (include_attribute);
@ -925,6 +935,58 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities {
}
}
}
// Retrieves a property from an MSBuild project file by executing MSBuild and getting MSBuild to print the property.
// We do this by creating a custom MSBuild file which:
// * Will import the project file we're inspecting
// * Has a target that will print a given property
// and then executing MSBuild on this custom MSBuild file.
public static async Task<string> GetPropertyByMSBuildEvaluationAsync (this XmlDocument csproj, ILog log, IProcessManager processManager, string projectPath, string evaluateProperty, string dependsOnTargets = "", Dictionary<string, string> properties = null)
{
var xml =
@"<Project DefaultTargets='WriteProperty' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<!-- Import the project we want to inspect -->
<Import Project='$(ProjectFile)' Condition=""'$(ProjectFile)' != ''"" />
<!-- Target to write out the property we want -->
<Target Name='WriteProperty' DependsOnTargets='%DEPENDSONTARGETS%'>
<PropertyGroup>
<_Properties>$(%PROPERTY%)</_Properties>
</PropertyGroup>
<Error Text='The ProjectFile variable must be set.' Condition=""'$(ProjectFile)' == ''"" />
<Error Text='The OutputFile variable must be set.' Condition=""'$(OutputFile)' == ''"" />
<WriteLinesToFile File='$(OutputFile)' Lines='$(_Properties)' Overwrite='true' />
</Target>
</Project>
";
var dir = Path.GetDirectoryName (projectPath);
var inspector = Path.Combine (dir, "PropertyInspector.csproj");
var output = Path.Combine (dir, "PropertyInspector.txt");
try {
File.WriteAllText (inspector, xml.Replace ("%PROPERTY%", evaluateProperty).Replace ("%DEPENDSONTARGETS%", dependsOnTargets));
using (var proc = new Process ()) {
var isDotNetProject = csproj.IsDotNetProject ();
proc.StartInfo.FileName = isDotNetProject ? processManager.GetDotNetExecutable (projectPath) : processManager.MSBuildPath;
var args = new List<string> ();
if (isDotNetProject)
args.Add ("build");
args.Add ("/p:ProjectFile=" + projectPath);
args.Add ("/p:OutputFile=" + output);
foreach (var prop in properties)
args.Add ($"/p:{prop.Key}={prop.Value}");
args.Add (inspector);
proc.StartInfo.Arguments = StringUtils.FormatArguments (args);
proc.StartInfo.WorkingDirectory = dir;
var rv = await processManager.RunAsync (proc, log, timeout: TimeSpan.FromSeconds (15));
if (!rv.Succeeded)
throw new Exception ($"Unable to evaluate the property {evaluateProperty}.");
return File.ReadAllText (output).Trim ();
}
} finally {
File.Delete (inspector);
File.Delete (output);
}
}
}
}

Просмотреть файл

@ -6,10 +6,14 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
public class iOSTestProject : TestProject
{
public bool SkipiOSVariation;
public bool SkipiOS32Variation;
public bool SkipiOS64Variation;
public bool SkipwatchOSVariation; // skip both
public bool SkipwatchOSARM64_32Variation;
public bool SkipwatchOS32Variation;
public bool SkiptvOSVariation;
public bool SkipTodayExtensionVariation;
public bool SkipDeviceVariations;
public bool BuildOnly;
public iOSTestProject ()
@ -29,5 +33,21 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared {
var min_version = MonoNativeHelper.GetMinimumOSVersion (devicePlatform, MonoNativeInfo.Flavor);
return Version.Parse (productVersion) >= Version.Parse (min_version);
}
public override TestProject Clone ()
{
var rv = (iOSTestProject) base.Clone ();
rv.SkipiOSVariation = SkipiOSVariation;
rv.SkipiOS32Variation = SkipiOS32Variation;
rv.SkipiOS64Variation = SkipiOS64Variation;
rv.SkipwatchOSVariation = SkipwatchOSVariation;
rv.SkipwatchOSARM64_32Variation = SkipwatchOSARM64_32Variation;
rv.SkipwatchOS32Variation = SkipwatchOS32Variation;
rv.SkiptvOSVariation = SkiptvOSVariation;
rv.SkipTodayExtensionVariation = SkipTodayExtensionVariation;
rv.SkipDeviceVariations = SkipDeviceVariations;
rv.BuildOnly = BuildOnly;
return rv;
}
}
}

Просмотреть файл

@ -118,6 +118,11 @@ namespace Xamarin.Bundler {
}
}
public string GetProductName ()
{
return ProductName;
}
// If we're targetting a 64 bit arch.
bool? is64bits;
public bool Is64Build {

Просмотреть файл

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
#if MTOUCH || MMP
#if MTOUCH || MMP || BUNDLER
using Mono.Cecil;
using Xamarin.Bundler;
using Registrar;
#endif
using Xamarin.Utils;
@ -17,6 +16,19 @@ public class Framework
public Version Version;
public Version VersionAvailableInSimulator;
public bool AlwaysWeakLinked;
#if MTOUCH || MMP || BUNDLER
public bool IsFrameworkAvailableInSimulator (Application app)
{
if (VersionAvailableInSimulator == null)
return false;
if (VersionAvailableInSimulator > app.SdkVersion)
return false;
return true;
}
#endif
}
public class Frameworks : Dictionary <string, Framework>
@ -497,8 +509,8 @@ public class Frameworks : Dictionary <string, Framework>
}
}
#if MMP
public static void Gather (Application app, AssemblyDefinition product_assembly, HashSet<string> frameworks, HashSet<string> weak_frameworks)
#if MTOUCH || MMP || BUNDLER
static void Gather (Application app, AssemblyDefinition product_assembly, HashSet<string> frameworks, HashSet<string> weak_frameworks, Func<Framework, bool> include_framework)
{
var namespaces = new HashSet<string> ();
@ -508,25 +520,57 @@ public class Frameworks : Dictionary <string, Framework>
namespaces.Add (td.Namespace);
// Iterate over all the namespaces and check which frameworks we need to link with.
var all_frameworks = GetFrameworks (app.Platform, app.IsSimulatorBuild);
foreach (var nspace in namespaces) {
switch (nspace) {
case "QTKit":
if (Driver.LinkProhibitedFrameworks) {
ErrorHelper.Warning (5221, Errors.MM5221, nspace);
} else {
ErrorHelper.Warning (5220, Errors.MM5220, nspace);
continue;
}
break;
}
if (Driver.GetFrameworks (app).TryGetValue (nspace, out var framework)) {
if (app.SdkVersion >= framework.Version) {
var add_to = app.DeploymentTarget >= framework.Version ? frameworks : weak_frameworks;
add_to.Add (framework.Name);
continue;
}
if (!all_frameworks.TryGetValue (nspace, out var framework))
continue;
if (!include_framework (framework))
continue;
if (app.SdkVersion < framework.Version) {
// We're building with an old sdk, and the framework doesn't exist there.
continue;
}
if (app.IsSimulatorBuild && !framework.IsFrameworkAvailableInSimulator (app))
continue;
var add_to = app.DeploymentTarget >= framework.Version ? frameworks : weak_frameworks;
add_to.Add (framework.Name);
}
}
static bool FilterFrameworks (Application app, Framework framework)
{
switch (app.Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
break; // Include all frameworks by default
case ApplePlatform.MacOSX:
switch (framework.Name) {
case "QTKit":
#if MMP
if (Driver.LinkProhibitedFrameworks) {
ErrorHelper.Warning (5221, Errors.MM5221, framework.Name);
} else {
ErrorHelper.Warning (5220, Errors.MM5220, framework.Name);
return false;
}
#endif
return true;
}
return true;
default:
throw ErrorHelper.CreateError (71, Errors.MX0071 /* "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case." */, app.Platform, app.GetProductName ());
}
return true;
}
public static void Gather (Application app, AssemblyDefinition product_assembly, HashSet<string> frameworks, HashSet<string> weak_frameworks)
{
Gather (app, product_assembly, frameworks, weak_frameworks, (framework) => FilterFrameworks (app, framework));
}
#endif // MTOUCH || MMP || BUNDLER
}

Просмотреть файл

@ -1,10 +1,51 @@
// Compat.cs: might not be ideal but it eases code sharing with existing code during the initial implementation.
using System;
using Xamarin.Linker;
using Xamarin.Utils;
namespace Xamarin.Bundler {
public class Application {
public LinkerConfiguration Configuration { get; private set; }
public Application (LinkerConfiguration configuration)
{
this.Configuration = configuration;
}
// This method is needed for ErrorHelper.tools.cs to compile.
public void LoadSymbols ()
{
}
public string GetProductName ()
{
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return "Xamarin.iOS";
case ApplePlatform.MacOSX:
return "Xamarin.Mac";
default:
throw ErrorHelper.CreateError (177, Errors.MX0177 /* "Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case." */, Platform);
}
}
public Version SdkVersion {
get { return Configuration.SdkVersion; }
}
public Version DeploymentTarget {
get { return Configuration.DeploymentTarget; }
}
public bool IsSimulatorBuild {
get { return Configuration.IsSimulatorBuild; }
}
public ApplePlatform Platform {
get { return Configuration.Platform; }
}
}
}

Просмотреть файл

@ -15,13 +15,18 @@ namespace Xamarin.Linker {
public List<Abi> Abis;
// This is the AssemblyName MSBuild property for the main project (which is also the root/entry assembly)
public string AssemblyName { get; private set; }
public string CacheDirectory { get; private set; }
public Version DeploymentTarget { get; private set; }
public string ItemsDirectory { get; private set; }
public bool IsSimulatorBuild { get; private set; }
public ApplePlatform Platform { get; private set; }
public string PlatformAssembly { get; private set; }
public string CacheDirectory { get; private set; }
public Version SdkVersion { get; private set; }
static ConditionalWeakTable<LinkContext, LinkerConfiguration> configurations = new ConditionalWeakTable<LinkContext, LinkerConfiguration> ();
public Application Application { get; private set; }
public static LinkerConfiguration GetInstance (LinkContext context)
{
if (!configurations.TryGetValue (context, out var instance)) {
@ -58,9 +63,17 @@ namespace Xamarin.Linker {
case "CacheDirectory":
CacheDirectory = value;
break;
case "DeploymentTarget":
if (!Version.TryParse (value, out var deployment_target))
throw new InvalidOperationException ($"Unable to parse the {key} value: {value} in {linker_file}");
DeploymentTarget = deployment_target;
break;
case "ItemsDirectory":
ItemsDirectory = value;
break;
case "IsSimulatorBuild":
IsSimulatorBuild = string.Equals ("true", value, StringComparison.OrdinalIgnoreCase);
break;
case "Platform":
switch (value) {
case "iOS":
@ -82,6 +95,11 @@ namespace Xamarin.Linker {
case "PlatformAssembly":
PlatformAssembly = Path.GetFileNameWithoutExtension (value);
break;
case "SdkVersion":
if (!Version.TryParse (value, out var sdk_version))
throw new InvalidOperationException ($"Unable to parse the {key} value: {value} in {linker_file}");
SdkVersion = sdk_version;
break;
case "TargetArchitectures":
if (!Enum.TryParse<Abi> (value, out var arch))
throw new InvalidOperationException ($"Unknown target architectures: {value} in {linker_file}");
@ -99,6 +117,8 @@ namespace Xamarin.Linker {
}
ErrorHelper.Platform = Platform;
Application = new Application (this);
}
public void Write ()
@ -107,9 +127,12 @@ namespace Xamarin.Linker {
Console.WriteLine ($" ABIs: {string.Join (", ", Abis.Select (v => v.AsArchString ()))}");
Console.WriteLine ($" AssemblyName: {AssemblyName}");
Console.WriteLine ($" CacheDirectory: {CacheDirectory}");
Console.WriteLine ($" DeploymentTarget: {DeploymentTarget}");
Console.WriteLine ($" ItemsDirectory: {ItemsDirectory}");
Console.WriteLine ($" IsSimulatorBuild: {IsSimulatorBuild}");
Console.WriteLine ($" Platform: {Platform}");
Console.WriteLine ($" PlatformAssembly: {PlatformAssembly}.dll");
Console.WriteLine ($" SdkVersion: {SdkVersion}");
}
public void WriteOutputForMSBuild (string itemName, List<MSBuildItem> items)

Просмотреть файл

@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Xamarin.Linker;
namespace Xamarin {
public class GatherFrameworksStep : ConfigurationAwareStep {
HashSet<string> Frameworks = new HashSet<string> ();
HashSet<string> WeakFrameworks = new HashSet<string> ();
protected override void ProcessAssembly (AssemblyDefinition assembly)
{
base.ProcessAssembly (assembly);
if (Configuration.PlatformAssembly != assembly.Name.Name)
return;
global::Frameworks.Gather (Configuration.Application, assembly, Frameworks, WeakFrameworks);
}
protected override void EndProcess ()
{
base.EndProcess ();
// Remove duplicates. WeakFrameworks takes precedence
Frameworks.ExceptWith (WeakFrameworks);
// Write out the frameworks we found and pass them to the MSBuild tasks
var items = new List<MSBuildItem> ();
foreach (var fw in Frameworks.OrderBy (v => v)) {
items.Add (new MSBuildItem {
Include = fw,
Metadata = {
{ "IsWeak", "false" },
},
});
}
foreach (var fw in WeakFrameworks.OrderBy (v => v)) {
items.Add (new MSBuildItem {
Include = fw,
Metadata = {
{ "IsWeak", "true" },
},
});
}
Configuration.WriteOutputForMSBuild ("_LinkerFrameworks", items);
}
}
}

Просмотреть файл

@ -28,6 +28,9 @@
<Link>external\Errors.designer.cs</Link>
<DependentUpon>Errors.resx</DependentUpon>
</Compile>
<Compile Include="..\common\Frameworks.cs">
<Link>external\Frameworks.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="external\" />

6
tools/mtouch/Errors.designer.cs сгенерированный
Просмотреть файл

@ -1079,6 +1079,12 @@ namespace Xamarin.Bundler {
}
}
internal static string MX0177 {
get {
return ResourceManager.GetString("MX0177", resourceCulture);
}
}
internal static string MX1009 {
get {
return ResourceManager.GetString("MX1009", resourceCulture);

Просмотреть файл

@ -902,6 +902,10 @@
</value>
</data>
<data name="MX0177" xml:space="preserve">
<value>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</value>
</data>
<data name="MX1009" xml:space="preserve">
<value>Could not copy the assembly '{0}' to '{1}': {2}
</value>

Просмотреть файл

@ -1229,13 +1229,7 @@ namespace Xamarin.Bundler
if (!GetFrameworks (app).TryGetValue (framework, out var fw))
return true; // Unknown framework, assume it's valid for the simulator
if (fw.VersionAvailableInSimulator == null)
return false;
if (fw.VersionAvailableInSimulator > app.SdkVersion)
return false;
return true;
return fw.IsFrameworkAvailableInSimulator (app);
}
}
}

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>

Просмотреть файл

@ -2927,6 +2927,11 @@
<note>
</note>
</trans-unit>
<trans-unit id="MX0177">
<source>Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</source>
<target state="new">Unknown platform: {0}. This usually indicates a bug; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.</target>
<note />
</trans-unit>
<trans-unit id="MX1009">
<source>Could not copy the assembly '{0}' to '{1}': {2}
</source>