Fixes part of https://github.com/xamarin/xamarin-macios/issues/4975.
This commit is contained in:
Родитель
a7f4c7011e
Коммит
270d13538d
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
using ObjCRuntime;
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace LinkAnyTest {
|
||||||
|
// This test is included in both the LinkAll and LinkSdk projects for both iOS and macOS.
|
||||||
|
[TestFixture]
|
||||||
|
[Preserve (AllMembers = true)]
|
||||||
|
public class CommonLinkAnyTest {
|
||||||
|
[Test]
|
||||||
|
public void Blocks ()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
string b = null;
|
||||||
|
NSSet s = new NSSet ("a", "b", "c");
|
||||||
|
s.Enumerate (delegate (NSObject obj, ref bool stop) {
|
||||||
|
stop = i++ == 1;
|
||||||
|
b = obj.ToString ();
|
||||||
|
});
|
||||||
|
// test behavior (we did not break anything)
|
||||||
|
Assert.AreEqual ("b", b, "Stop");
|
||||||
|
// test that BlockLiteral is fully preserved
|
||||||
|
int size = Marshal.SizeOf (typeof (BlockLiteral)); // e.g. unused 'reserved' must not be removed
|
||||||
|
Assert.AreEqual (IntPtr.Size == 8 ? 48 : 28, size, "BlockLiteral size");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -198,6 +198,9 @@
|
||||||
<Compile Include="..\..\CommonLinkAllTest.cs">
|
<Compile Include="..\..\CommonLinkAllTest.cs">
|
||||||
<Link>CommonLinkAllTest.cs</Link>
|
<Link>CommonLinkAllTest.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\..\CommonLinkAnyTest.cs">
|
||||||
|
<Link>CommonLinkAnyTest.cs</Link>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<InterfaceDefinition Include="LaunchScreen.storyboard" Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" />
|
<InterfaceDefinition Include="LaunchScreen.storyboard" Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" />
|
||||||
|
|
|
@ -192,6 +192,9 @@
|
||||||
<Compile Include="..\..\CommonLinkSdkTest.cs">
|
<Compile Include="..\..\CommonLinkSdkTest.cs">
|
||||||
<Link>CommonLinkSdkTest.cs</Link>
|
<Link>CommonLinkSdkTest.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\..\CommonLinkAnyTest.cs">
|
||||||
|
<Link>CommonLinkAnyTest.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="BitcodeTest.cs" />
|
<Compile Include="BitcodeTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -92,6 +92,9 @@
|
||||||
<Compile Include="..\LinkAnyTest.cs">
|
<Compile Include="..\LinkAnyTest.cs">
|
||||||
<Link>LinkAnyTest.cs</Link>
|
<Link>LinkAnyTest.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\..\CommonLinkAnyTest.cs">
|
||||||
|
<Link>CommonLinkAnyTest.cs</Link>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_xammac_mobile.csproj">
|
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_xammac_mobile.csproj">
|
||||||
|
|
|
@ -82,6 +82,9 @@
|
||||||
<Compile Include="..\LinkAnyTest.cs">
|
<Compile Include="..\LinkAnyTest.cs">
|
||||||
<Link>LinkAnyTest.cs</Link>
|
<Link>LinkAnyTest.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\..\CommonLinkAnyTest.cs">
|
||||||
|
<Link>CommonLinkAnyTest.cs</Link>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_xammac_mobile.csproj">
|
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_xammac_mobile.csproj">
|
||||||
|
|
|
@ -16,7 +16,6 @@ TESTS_4_0 = \
|
||||||
link-uithread-2 \
|
link-uithread-2 \
|
||||||
link-safe-1 \
|
link-safe-1 \
|
||||||
link-frameworks-1 \
|
link-frameworks-1 \
|
||||||
link-blocks-1 \
|
|
||||||
embedded-mono \
|
embedded-mono \
|
||||||
system-mono \
|
system-mono \
|
||||||
embedded-mono-profile \
|
embedded-mono-profile \
|
||||||
|
|
|
@ -1,22 +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>CFBundleDisplayName</key>
|
|
||||||
<string>link-blocks-1</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.your-company.linkblocks1</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>link-blocks-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,45 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using MonoMac.AppKit;
|
|
||||||
using MonoMac.Foundation;
|
|
||||||
using MonoMac.ObjCRuntime;
|
|
||||||
|
|
||||||
// Test
|
|
||||||
// * application uses Blocks and BlockLiteral fields must be preserved
|
|
||||||
//
|
|
||||||
// Requirement
|
|
||||||
// * Link SDK or Link All must be enabled
|
|
||||||
|
|
||||||
namespace Xamarin.Mac.Linker.Test {
|
|
||||||
|
|
||||||
class NativeBuilder {
|
|
||||||
|
|
||||||
static void Check (string name, MemberInfo mi)
|
|
||||||
{
|
|
||||||
Test.Log.WriteLine ("{0}\t{1}", mi != null ? "[PASS]" : "[FAIL]", name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Main (string[] args)
|
|
||||||
{
|
|
||||||
NSApplication.Init ();
|
|
||||||
|
|
||||||
Test.EnsureLinker (true);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
string b = null;
|
|
||||||
NSSet s = new NSSet ("a", "b", "c");
|
|
||||||
s.Enumerate (delegate (NSObject obj, ref bool stop) {
|
|
||||||
stop = i++ == 1;
|
|
||||||
b = obj.ToString ();
|
|
||||||
});
|
|
||||||
// test behavior (we did not break anything)
|
|
||||||
Test.Log.WriteLine ("[{0}]\tBehavior: Stop at item '{1}'", b == "b" ? "PASS" : "FAIL", b);
|
|
||||||
// test that BlockLiteral is fully preserved
|
|
||||||
int size = Marshal.SizeOf (typeof (BlockLiteral)); // e.g. unused 'reserved' must not be removed
|
|
||||||
Test.Log.WriteLine ("[{0}]\tBlockLiteral is {1} bytes", size == 28 ? "PASS" : "FAIL", size);
|
|
||||||
|
|
||||||
Test.Terminate ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +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)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{26634789-2957-4A78-BBF0-929BCA74440F}</ProjectGuid>
|
|
||||||
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RootNamespace>linkblocks1</RootNamespace>
|
|
||||||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
|
||||||
<AssemblyName>link-blocks-1</AssemblyName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<UseSGen>false</UseSGen>
|
|
||||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
|
||||||
<EnablePackageSigning>false</EnablePackageSigning>
|
|
||||||
<CodeSigningKey>Mac Developer</CodeSigningKey>
|
|
||||||
<EnableCodeSigning>false</EnableCodeSigning>
|
|
||||||
<CreatePackage>false</CreatePackage>
|
|
||||||
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
|
|
||||||
<I18n>
|
|
||||||
</I18n>
|
|
||||||
<LinkMode>Full</LinkMode>
|
|
||||||
<UseRefCounting>false</UseRefCounting>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<LinkMode>Full</LinkMode>
|
|
||||||
<UseSGen>false</UseSGen>
|
|
||||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
|
||||||
<EnablePackageSigning>false</EnablePackageSigning>
|
|
||||||
<CodeSigningKey>Developer ID Application</CodeSigningKey>
|
|
||||||
<EnableCodeSigning>true</EnableCodeSigning>
|
|
||||||
<CreatePackage>true</CreatePackage>
|
|
||||||
<UseRefCounting>false</UseRefCounting>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|AnyCPU' ">
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\AppStore</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<LinkMode>Full</LinkMode>
|
|
||||||
<UseSGen>false</UseSGen>
|
|
||||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
|
||||||
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
|
|
||||||
<CreatePackage>true</CreatePackage>
|
|
||||||
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
|
|
||||||
<EnableCodeSigning>true</EnableCodeSigning>
|
|
||||||
<EnablePackageSigning>true</EnablePackageSigning>
|
|
||||||
<UseRefCounting>false</UseRefCounting>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="XamMac" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Resources\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Info.plist" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\common\Test.cs">
|
|
||||||
<Link>Test.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="LinkBlocks1.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<InterfaceDefinition Include="..\common\MainMenu.xib">
|
|
||||||
<Link>MainMenu.xib</Link>
|
|
||||||
</InterfaceDefinition>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -33,8 +33,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-frameworks-1", "link-f
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-nativebuilder-1", "link-nativebuilder-1\link-nativebuilder-1.csproj", "{D37FC010-0D17-4B68-ABA8-33BA599CD94C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-nativebuilder-1", "link-nativebuilder-1\link-nativebuilder-1.csproj", "{D37FC010-0D17-4B68-ABA8-33BA599CD94C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-blocks-1", "link-blocks-1\link-blocks-1.csproj", "{26634789-2957-4A78-BBF0-929BCA74440F}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-preserve-calendar-1", "link-preserve-calendar-1\link-preserve-calendar-1.csproj", "{910B8B76-46C3-4550-AB5C-BD813F053A98}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-preserve-calendar-1", "link-preserve-calendar-1\link-preserve-calendar-1.csproj", "{910B8B76-46C3-4550-AB5C-BD813F053A98}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-preserve-calendar-2", "link-preserve-calendar-2\link-preserve-calendar-2.csproj", "{88BD48BB-BF1C-40B2-90C0-3C2C644E3037}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-preserve-calendar-2", "link-preserve-calendar-2\link-preserve-calendar-2.csproj", "{88BD48BB-BF1C-40B2-90C0-3C2C644E3037}"
|
||||||
|
@ -72,12 +70,6 @@ Global
|
||||||
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Debug|x86.Build.0 = Debug|x86
|
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Debug|x86.Build.0 = Debug|x86
|
||||||
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Release|x86.ActiveCfg = Release|x86
|
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Release|x86.ActiveCfg = Release|x86
|
||||||
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Release|x86.Build.0 = Release|x86
|
{1F4422A4-C6B2-49B5-BB1D-6CA4676397CA}.Release|x86.Build.0 = Release|x86
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.AppStore|x86.ActiveCfg = AppStore|Any CPU
|
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.AppStore|x86.Build.0 = AppStore|Any CPU
|
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{26634789-2957-4A78-BBF0-929BCA74440F}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.AppStore|x86.ActiveCfg = AppStore|x86
|
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.AppStore|x86.ActiveCfg = AppStore|x86
|
||||||
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.AppStore|x86.Build.0 = AppStore|x86
|
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.AppStore|x86.Build.0 = AppStore|x86
|
||||||
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.Debug|x86.ActiveCfg = Debug|x86
|
{26909B1A-21F0-484A-9DD0-EE5F612FB91B}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
|
Загрузка…
Ссылка в новой задаче