Skip to content

Commit e54019a

Browse files
rolfbjarneTherzok
andauthored
[dotnet] Make it possible to specify the registrar using a 'Registrar' property in MSBuild. (#15483)
Co-authored-by: Marius Ungureanu <[email protected]>
1 parent aaee2bf commit e54019a

File tree

15 files changed

+49
-20
lines changed

15 files changed

+49
-20
lines changed

dotnet/targets/Xamarin.Shared.Sdk.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@
498498
Platform=$(_PlatformName)
499499
PlatformAssembly=$(_PlatformAssemblyName).dll
500500
RelativeAppBundlePath=$(_RelativeAppBundlePath)
501-
Registrar=$(_BundlerRegistrar)
501+
Registrar=$(Registrar)
502502
RequirePInvokeWrappers=$(_RequirePInvokeWrappers)
503503
RuntimeConfigurationFile=$(_RuntimeConfigurationFile)
504504
SdkDevPath=$(_SdkDevPath)

msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
103103
ExtraArgs="$(_BundlerArguments)"
104104
NativeReferences="@(_FrameworkNativeReference);@(_FileNativeReference)"
105105
References="@(ReferencePath);@(_BundlerReferencePath)"
106+
Registrar="$(Registrar)"
106107
ResponseFilePath="$(IntermediateOutputPath)response-file.rsp"
107108
SdkRoot="$(_SdkDevPath)"
108109
IntermediateOutputPath="$(IntermediateOutputPath)mmp-cache"

msbuild/Xamarin.MacDev.Tasks.Core/Tasks/BundlerToolTaskBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public abstract class BundlerToolTaskBase : XamarinToolTask {
5656
[Required]
5757
public ITaskItem [] References { get; set; }
5858

59+
public string Registrar { get; set; }
60+
5961
[Required]
6062
public string ResponseFilePath { get; set; }
6163

@@ -84,6 +86,9 @@ protected CommandLineArgumentBuilder GenerateCommandLineArguments ()
8486
{
8587
var args = new CommandLineArgumentBuilder ();
8688

89+
if (!string.IsNullOrEmpty (Registrar))
90+
args.AddLine ($"--registrar:" + Registrar);
91+
8792
if (bool.TryParse (ArchiveSymbols?.Trim (), out var msym))
8893
args.AddLine ($"--msym={(msym ? "yes" : "no")}");
8994

msbuild/Xamarin.Shared/Xamarin.Shared.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
17901790
NoSymbolStrip="$(NoSymbolStrip)"
17911791
NoDSymUtil="$(NoDSymUtil)"
17921792
PackageDebugSymbols="$(PackageDebugSymbols)"
1793+
Registrar="$(Registrar)"
17931794
Verbosity="$(_BundlerVerbosity)"
17941795
>
17951796
<Output TaskParameter="Aot" ItemName="_AotArguments" />
@@ -1803,7 +1804,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
18031804
<Output TaskParameter="NoDSymUtil" PropertyName="NoDSymUtil"/>
18041805
<Output TaskParameter="Optimize" PropertyName="_BundlerOptimize"/>
18051806
<Output TaskParameter="PackageDebugSymbols" PropertyName="PackageDebugSymbols" />
1806-
<Output TaskParameter="Registrar" PropertyName="_BundlerRegistrar" />
1807+
<Output TaskParameter="Registrar" PropertyName="Registrar" />
18071808
<Output TaskParameter="RequirePInvokeWrappers" PropertyName="_RequirePInvokeWrappers" />
18081809
<Output TaskParameter="Verbosity" PropertyName="_BundlerVerbosity" />
18091810
<Output TaskParameter="XmlDefinitions" ItemName="_BundlerXmlDefinitions" />

msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
258258
Profiling="$(MtouchProfiling)"
259259
ProjectDir="$(MtouchProjectDirectory)"
260260
References="@(ReferencePath);@(_BundlerReferencePath)"
261+
Registrar="$(Registrar)"
261262
ResponseFilePath="$(DeviceSpecificIntermediateOutputPath)response-file.rsp"
262263
SdkRoot="$(_SdkDevPath)"
263264
SdkIsSimulator="$(_SdkIsSimulator)"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<Target Name="ComputeRegistrarConstant" BeforeTargets="BeforeBuild">
4+
<PropertyGroup Condition="'$(_PlatformName)' == 'iOS' Or $(TargetFramework.EndsWith('-ios')) Or '$(_PlatformName)' == 'tvOS' Or $(TargetFramework.EndsWith('-tvos'))">
5+
<IsDynamicRegistrar Condition="'$(ComputedPlatform)' == 'iPhoneSimulator' And '$(Registrar)' == ''">true</IsDynamicRegistrar>
6+
<IsDynamicRegistrar Condition="'$(Registrar)' == 'dynamic'">true</IsDynamicRegistrar>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition="'$(_PlatformName)' == 'macOS' Or $(TargetFramework.EndsWith('-macos')) Or '$(_PlatformName)' == 'MacCatalyst' Or $(TargetFramework.EndsWith('-maccatalyst'))">
10+
<IsDynamicRegistrar Condition="'$(Configuration)' == 'Debug' And '$(Registrar)' == ''">true</IsDynamicRegistrar>
11+
<IsDynamicRegistrar Condition="'$(Registrar)' == 'dynamic'">true</IsDynamicRegistrar>
12+
</PropertyGroup>
13+
14+
<PropertyGroup Condition="'$(IsDynamicRegistrar)' == 'true'">
15+
<DefineConstants>$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
16+
</PropertyGroup>
17+
</Target>
18+
</Project>

tests/common/shared-dotnet.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\..\external\Touch.Unit\Touch.Client\dotnet\$(_PlatformName)\Touch.Client-$(_PlatformName).dotnet.csproj" Condition="'$(ExcludeTouchUnitReference)' != 'true'" />
6464
</ItemGroup>
6565

66+
<Import Project="$(MSBuildThisFileDirectory)/../ComputeRegistrarConstant.targets" />
6667
<Import Project="$(MSBuildThisFileDirectory)/../nunit.framework.targets" />
6768
</Project>

tests/monotouch-test/dotnet/MacCatalyst/monotouch-test.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst</TargetFramework>
5-
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
65
</PropertyGroup>
76

87
<!-- Imports of the form '../shared.csproj' will be inlined by xharness -->

tests/monotouch-test/dotnet/macOS/monotouch-test.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-macos</TargetFramework>
55
<DefineConstants>$(DefineConstants);XAMMAC_TESTS</DefineConstants>
6-
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
76
</PropertyGroup>
87

98
<!-- Imports of the form '../shared.csproj' will be inlined by xharness -->

tests/monotouch-test/dotnet/shared.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@
201201
<DefineConstants Condition="'$(ComputedPlatform)' == 'iPhone'">$(DefineConstants);AOT</DefineConstants>
202202
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'iossimulator-arm64'">$(DefineConstants);AOT</DefineConstants>
203203
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'tvossimulator-arm64'">$(DefineConstants);AOT</DefineConstants>
204-
<DefineConstants Condition="'$(ComputedPlatform)' == 'iPhoneSimulator'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
205204
</PropertyGroup>
206205
</Target>
207206
</Project>

0 commit comments

Comments
 (0)