[dotnet-linker] Add ProcessExportedFields to the list of steps we execute. Fixes #20061. (#20066)

Fixes https://github.com/xamarin/xamarin-macios/issues/20061.
This commit is contained in:
Rolf Bjarne Kvinge 2024-02-20 16:46:47 +01:00 коммит произвёл GitHub
Родитель 0cdeeb1fb0
Коммит dd363191cc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 20 добавлений и 0 удалений

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

@ -684,6 +684,7 @@
<!-- This would not be needed if LinkContext.GetAssemblies () was exposed to us. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.Linker.CollectAssembliesStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.CoreTypeMapStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.ProcessExportedFields" />
<!-- The final decision to remove/keep the dynamic registrar must be done before the linking step -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.RegistrarRemovalTrackingStep" />
<!-- TODO: these steps should probably run after mark. -->

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

@ -18,6 +18,12 @@ namespace Bindings.Test {
}
#endif
[Static]
interface Globals {
[Field ("x_GlobalString", "__Internal")]
NSString GlobalString { get; }
}
[BaseType (typeof (NSObject))]
public interface UltimateMachine {
[Export ("getAnswer")]

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

@ -12,6 +12,12 @@ namespace Xamarin.Tests {
[TestFixture]
[Preserve (AllMembers = true)]
public class RuntimeTest {
[Test]
public void GlobalStringTest ()
{
Assert.AreEqual ("There's nothing cruvus here!", (string) Globals.GlobalString, "Global string");
}
[Test]
public void WrapperTypeLookupTest ()
{

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

@ -7,6 +7,8 @@
#include <zlib.h>
#include "libtest.h"
NSString *x_GlobalString = @"There's nothing cruvus here!";
int
theUltimateAnswer ()
{

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

@ -72,6 +72,7 @@
#define x_SCNMatrix4MakeTranslation object_x_SCNMatrix4MakeTranslation
#define x_SCNMatrix4MakeScale object_x_SCNMatrix4MakeScale
#define x_SCNMatrix4Translate object_x_SCNMatrix4Translate
#define x_GlobalString object_x_GlobalString
#elif PREFIX == 2
#define theUltimateAnswer ar_theUltimateAnswer
#define useZLib ar_useZLib
@ -145,6 +146,7 @@
#define x_SCNMatrix4MakeTranslation ar_x_SCNMatrix4MakeTranslation
#define x_SCNMatrix4MakeScale ar_x_SCNMatrix4MakeScale
#define x_SCNMatrix4Translate ar_x_SCNMatrix4Translate
#define x_GlobalString ar_x_GlobalString
#else
// keep original names
#endif

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

@ -183,6 +183,9 @@
<Compile Include="..\linker\MonoTouch.Tuner\PreserveSmartEnumConversions.cs">
<Link>external\tools\linker\MonoTouch.Tuner\PreserveSmartEnumConversions.cs</Link>
</Compile>
<Compile Include="..\linker\MonoTouch.Tuner\ProcessExportedFields.cs">
<Link>external\tools\linker\MonoTouch.Tuner\ProcessExportedFields.cs</Link>
</Compile>
<Compile Include="..\linker\MobileExtensions.cs">
<Link>external\tools\linker\MobileExtensions.cs</Link>
</Compile>