[mmptest] Port link-remove-attributes-1 to Unified. Partial fix for #4975. (#6547)

Fixes part of https://github.com/xamarin/xamarin-macios/issues/4975.
This commit is contained in:
Rolf Bjarne Kvinge 2019-07-11 01:21:07 -07:00 коммит произвёл GitHub
Родитель f24e42c61c
Коммит e0f16ffc9c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 32 добавлений и 56 удалений

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

@ -26,7 +26,6 @@ DISABLED_TESTS_MONO_4_2 = \
DISABLED_TESTS_MONO_4_4 = \
link-webclient-1 \
link-webclient-3 \
link-remove-attributes-1
TESTS_UNIFIED = \
custom-bundle-name \
@ -35,6 +34,7 @@ TESTS_UNIFIED = \
link-keep-resources-2 \
link-posix-1 \
link-preserve-assembly \
link-remove-attributes-1 \
DISABLED_4_5_TESTS_MONO_4_2 = \
link-httpclient-async \

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

@ -5,7 +5,7 @@ using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Xml;
using MonoMac.AppKit;
using AppKit;
// Test
// * application use some attributes that the linker will remove (unneeded at runtime)
@ -18,7 +18,7 @@ using MonoMac.AppKit;
// removed in release builds only
[assembly: Debuggable (DebuggableAttribute.DebuggingModes.Default)]
[assembly: MonoMac.Foundation.LinkerSafe]
[assembly: Foundation.LinkerSafe]
// not removed
[assembly: AssemblyCompany ("Xamarin Inc.")]
@ -33,12 +33,12 @@ namespace Xamarin.Mac.Linker.Test {
[System.Obsolete]
// [System.Xml.MonoFIX]
[MonoMac.ObjCRuntime.Availability]
[MonoMac.ObjCRuntime.Lion]
[MonoMac.ObjCRuntime.MountainLion]
[MonoMac.ObjCRuntime.Mavericks]
[MonoMac.ObjCRuntime.Since (5,0)]
[MonoMac.ObjCRuntime.ThreadSafe]
[ObjCRuntime.Availability]
[ObjCRuntime.Deprecated (ObjCRuntime.PlatformName.MacOSX)]
[ObjCRuntime.Obsoleted (ObjCRuntime.PlatformName.MacOSX)]
[ObjCRuntime.Introduced (ObjCRuntime.PlatformName.MacOSX)]
[ObjCRuntime.Unavailable (ObjCRuntime.PlatformName.MacOSX)]
[ObjCRuntime.ThreadSafe]
[DebuggerDisplay ("")]
[DebuggerNonUserCode]
@ -50,12 +50,12 @@ namespace Xamarin.Mac.Linker.Test {
class DebugLinkRemoveAttributes {
// will be removed - but the instance field will be kept
[MonoMac.Foundation.Preserve]
[Foundation.Preserve]
// removed in release builds only
[DebuggerBrowsable (DebuggerBrowsableState.Never)]
XmlDocument document;
[MonoMac.Foundation.Advice ("")]
[Foundation.Advice ("")]
// removed in release builds only
[DebuggerHidden]
[DebuggerStepperBoundary]
@ -88,13 +88,13 @@ namespace Xamarin.Mac.Linker.Test {
try {
var type = typeof (DebugLinkRemoveAttributes);
CheckPresence (type, "System.ObsoleteAttribute", false);
CheckPresence (type, "MonoMac.Foundation.AdviceAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.AvailabilityAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.LionAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.MountainLionAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.MavericksAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.SinceAttribute", false);
CheckPresence (type, "MonoMac.ObjCRuntime.ThreadSafeAttribute", false);
CheckPresence (type, "Foundation.AdviceAttribute", false);
CheckPresence (type, "ObjCRuntime.AvailabilityAttribute", false);
CheckPresence (type, "ObjCRuntime.LionAttribute", false);
CheckPresence (type, "ObjCRuntime.MountainLionAttribute", false);
CheckPresence (type, "ObjCRuntime.MavericksAttribute", false);
CheckPresence (type, "ObjCRuntime.SinceAttribute", false);
CheckPresence (type, "ObjCRuntime.ThreadSafeAttribute", false);
CheckPresence (type, "System.Diagnostics.DebuggerDisplay", debug);
CheckPresence (type, "System.Diagnostics.DebuggerNonUserCode", debug);
CheckPresence (type, "System.Diagnostics.DebuggerTypeProxy", debug);
@ -102,19 +102,19 @@ namespace Xamarin.Mac.Linker.Test {
CheckPresence (type, "System.Runtime.InteropServices.GuidAttribute", true);
var assembly = type.Assembly;
CheckPresence (assembly, "MonoMac.Foundation.LinkerSafeAttribute", false);
CheckPresence (assembly, "Foundation.LinkerSafeAttribute", false);
CheckPresence (assembly, "System.Diagnostics.DebuggableAttribute", debug);
CheckPresence (assembly, "System.Reflection.AssemblyCompanyAttribute", true);
var method = type.GetMethod ("CheckPresence", BindingFlags.Static | BindingFlags.NonPublic);
CheckPresence (method, "MonoMac.Foundation.AdviceAttribute", false);
CheckPresence (method, "Foundation.AdviceAttribute", false);
CheckPresence (method, "System.Diagnostics.DebuggerHiddenAttribute", debug);
CheckPresence (method, "System.Diagnostics.DebuggerStepperBoundaryAttribute", debug);
CheckPresence (method, "System.Diagnostics.DebuggerStepThroughAttribute", debug);
CheckPresence (method, "System.LoaderOptimizationAttribute", true);
var field = type.GetField ("document", BindingFlags.Instance| BindingFlags.NonPublic);
CheckPresence (field, "MonoMac.Foundation.PreserveAttribute", false);
CheckPresence (field, "Foundation.PreserveAttribute", false);
CheckPresence (field, "System.Diagnostics.DebuggerBrowsableAttribute", debug);
}
finally {
@ -122,4 +122,4 @@ namespace Xamarin.Mac.Linker.Test {
}
}
}
}
}

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

@ -6,11 +6,13 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F977D041-B0A5-49DE-815E-B210DBE140A5}</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>linkremoveattributes1</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-remove-attributes-1</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,18 +22,16 @@
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseSGen>false</UseSGen>
<UseSGen>True</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
<I18n>
</I18n>
<I18n></I18n>
<LinkMode>Full</LinkMode>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
@ -39,51 +39,27 @@
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<UseSGen>True</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
<I18n>
</I18n>
<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>
<I18n></I18n>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="XamMac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<ItemGroup>
<Compile Include="..\common\Test.cs">
<Link>Test.cs</Link>