[mmptest] Port link-posix-1 to Unified, and remove the link-posix-2 test. Partial fix for #4975. (#6509)

link-posix-2 depends on Mono.Posix.dll and the behavior of the linker, but
it's only possible to link XM Modern projects, but the Modern profile doesn't
contain Mono.Posix.dll.

Fixes part of https://github.com/xamarin/xamarin-macios/issues/4975.
This commit is contained in:
Rolf Bjarne Kvinge 2019-07-08 08:21:38 -07:00 коммит произвёл GitHub
Родитель 820f0cd94a
Коммит 740c3724e7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 12 добавлений и 202 удалений

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

@ -11,8 +11,6 @@ export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.fra
TESTS_4_0 = \
link-posix-1 \
link-posix-2 \
link-keep-resources-1 \
link-preserve-assembly \
link-uithread-1 \
@ -36,6 +34,7 @@ DISABLED_TESTS_MONO_4_4 = \
link-remove-attributes-1
TESTS_UNIFIED = \
link-posix-1 \
custom-bundle-name
TESTS_4_5 = \

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

@ -4,9 +4,9 @@ using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using Foundation;
using AppKit;
using ObjCRuntime;
// Test
// * application does not reference assembly Mono.Posix.dll
@ -44,4 +44,4 @@ namespace Xamarin.Mac.Linker.Test {
Test.Terminate ();
}
}
}
}

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

@ -6,11 +6,13 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BB0442BD-28A5-4F1E-8101-F5060AB9E8D2}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>linkposix1</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-posix-1</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
@ -25,14 +27,9 @@
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>False</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<I18n>
</I18n>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
@ -41,39 +38,17 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LinkMode>Full</LinkMode>
<IncludeMonoRuntime>False</IncludeMonoRuntime>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<EnablePackageSigning>False</EnablePackageSigning>
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>False</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|x86' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\x86\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LinkMode>Full</LinkMode>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<EnablePackageSigning>True</EnablePackageSigning>
<CreatePackage>True</CreatePackage>
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
<EnableCodeSigning>True</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="XamMac">
<HintPath>..\..\..\..\src\build\compat\XamMac.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Compile Include="LinkPosix1.cs" />
@ -84,11 +59,10 @@
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<ItemGroup>
<InterfaceDefinition Include="..\common\MainMenu.xib">
<Link>MainMenu.xib</Link>
</InterfaceDefinition>
</ItemGroup>
</Project>
</Project>

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

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.link-posix-2</string>
<key>CFBundleName</key>
<string>link-posix-1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>

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

@ -1,40 +0,0 @@
using System;
using System.IO;
using System.Reflection;
using Mono.Posix;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
// Test
// * application references Mono.Posix
// * application call method which pinvoke into libc
// * linker does not include libMonoPosixHelper.dylib in the application bundle
//
// Requirement
// * Link SDK or Link All must be enabled
namespace Xamarin.Mac.Linker.Test {
class Posix2 {
static void Main (string[] args)
{
NSApplication.Init ();
Test.EnsureLinker (true);
#pragma warning disable 618
var host = Syscall.GetHostName ();
#pragma warning restore 618
Test.Log.WriteLine ("{0}\t{1} {2}", !String.IsNullOrEmpty (host) ? "[PASS]" : "[FAIL]", "Syscall.GetHostName returned", host);
string path = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
string dylib = Path.Combine (path, "libMonoPosixHelper.dylib");
bool bundled = File.Exists (dylib);
Test.Log.WriteLine ("{0}\t{1} : {2}", !bundled ? "[PASS]" : "[FAIL]", "MonoPosixHelper not present in bundle", dylib);
Test.Terminate ();
}
}
}

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

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{141239A4-4094-4349-A3F3-00CD16643226}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>linkposix2</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-posix-2</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<EnablePackageSigning>False</EnablePackageSigning>
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>False</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<I18n>
</I18n>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LinkMode>Full</LinkMode>
<IncludeMonoRuntime>False</IncludeMonoRuntime>
<EnablePackageSigning>False</EnablePackageSigning>
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>False</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|x86' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\x86\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LinkMode>Full</LinkMode>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<EnablePackageSigning>True</EnablePackageSigning>
<CreatePackage>True</CreatePackage>
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
<EnableCodeSigning>True</EnableCodeSigning>
<ConsolePause>False</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Mono.Posix" />
<Reference Include="XamMac">
<HintPath>..\..\..\..\src\build\compat\XamMac.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<ItemGroup>
<Compile Include="LinkPosix2.cs" />
<Compile Include="..\common\Test.cs">
<Link>Test.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="..\common\MainMenu.xib">
<Link>MainMenu.xib</Link>
</InterfaceDefinition>
</ItemGroup>
</Project>

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

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-posix-1", "link-posix-1\link-posix-1.csproj", "{BB0442BD-28A5-4F1E-8101-F5060AB9E8D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-posix-2", "link-posix-2\link-posix-2.csproj", "{141239A4-4094-4349-A3F3-00CD16643226}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-webclient-1", "link-webclient-1\link-webclient-1.csproj", "{148DC17B-B29F-48A7-97CD-EECE26015B25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-webclient-2", "link-webclient-2\link-webclient-2.csproj", "{FA5882C9-C02D-4C7B-963B-AEA929D01390}"
@ -64,12 +62,6 @@ Global
{0A4EBB71-92E1-448C-BAA6-DFFB9491D8A0}.Debug|x86.Build.0 = Debug|x86
{0A4EBB71-92E1-448C-BAA6-DFFB9491D8A0}.Release|x86.ActiveCfg = Release|x86
{0A4EBB71-92E1-448C-BAA6-DFFB9491D8A0}.Release|x86.Build.0 = Release|x86
{141239A4-4094-4349-A3F3-00CD16643226}.AppStore|x86.ActiveCfg = AppStore|x86
{141239A4-4094-4349-A3F3-00CD16643226}.AppStore|x86.Build.0 = AppStore|x86
{141239A4-4094-4349-A3F3-00CD16643226}.Debug|x86.ActiveCfg = Debug|x86
{141239A4-4094-4349-A3F3-00CD16643226}.Debug|x86.Build.0 = Debug|x86
{141239A4-4094-4349-A3F3-00CD16643226}.Release|x86.ActiveCfg = Release|x86
{141239A4-4094-4349-A3F3-00CD16643226}.Release|x86.Build.0 = Release|x86
{148DC17B-B29F-48A7-97CD-EECE26015B25}.AppStore|x86.ActiveCfg = AppStore|x86
{148DC17B-B29F-48A7-97CD-EECE26015B25}.AppStore|x86.Build.0 = AppStore|x86
{148DC17B-B29F-48A7-97CD-EECE26015B25}.Debug|x86.ActiveCfg = Debug|x86