[mtouch/mmp] Simplify and unify the code to select/create the static registrar. (#3461)

There's only one static registrar now, so there's no need for code to select
which one, just create the one and only.

Also unify this code between mtouch and mmp.
This commit is contained in:
Rolf Bjarne Kvinge 2018-02-12 14:42:19 +01:00 коммит произвёл GitHub
Родитель 4422045626
Коммит 0561618460
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 19 добавлений и 23 удалений

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

@ -397,6 +397,8 @@ namespace Xamarin.Bundler {
public void InitializeCommon ()
{
SelectRegistrar ();
if (RequiresXcodeHeaders && SdkVersion < SdkVersions.GetVersion (Platform)) {
throw ErrorHelper.CreateError (91, "This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or {4} (to try to avoid the new APIs).", ProductName, PlatformName, SdkVersions.GetVersion (Platform), SdkVersions.Xcode, Error91LinkerSuggestion);
}

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

@ -59,6 +59,7 @@ namespace Xamarin.Bundler {
public Target (Application app)
{
this.App = app;
this.StaticRegistrar = new StaticRegistrar (this);
}
public void ExtractNativeLinkInfo (List<Exception> exceptions)

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

@ -17,5 +17,10 @@ namespace Xamarin.Bundler {
if (DeploymentTarget == null)
DeploymentTarget = new Version (10, 7);
}
void SelectRegistrar ()
{
Driver.SelectRegistrar ();
}
}
}

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

@ -690,14 +690,9 @@ namespace Xamarin.Bundler {
}
}
static void Pack (IList<string> unprocessed)
public static void SelectRegistrar ()
{
string fx_dir = null;
string root_assembly = null;
var native_libs = new Dictionary<string, List<MethodDefinition>> ();
if (Registrar == RegistrarMode.Default)
{
if (Registrar == RegistrarMode.Default) {
if (!App.EnableDebug)
Registrar = RegistrarMode.Static;
else if (IsUnified && App.LinkMode == LinkMode.None && embed_mono && App.IsDefaultMarshalManagedExceptionMode && File.Exists (PartialStaticLibrary))
@ -706,7 +701,14 @@ namespace Xamarin.Bundler {
Registrar = RegistrarMode.Dynamic;
Log (1, $"Defaulting registrar to '{Registrar}'");
}
}
static void Pack (IList<string> unprocessed)
{
string fx_dir = null;
string root_assembly = null;
var native_libs = new Dictionary<string, List<MethodDefinition>> ();
if (no_executable) {
if (unprocessed.Count != 0) {
var exceptions = new List<Exception> ();

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

@ -823,9 +823,9 @@ namespace Xamarin.Bundler {
void BuildInitialize ()
{
SelectRegistrar ();
Initialize ();
ValidateAbi ();
SelectRegistrar ();
ExtractNativeLinkInfo ();
SelectNativeCompiler ();
}
@ -1363,9 +1363,6 @@ namespace Xamarin.Bundler {
Registrar = RegistrarMode.Dynamic;
}
}
foreach (var target in Targets)
target.SelectStaticRegistrar ();
}
// Select all abi from the list matching the specified mask.

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

@ -872,17 +872,6 @@ namespace Xamarin.Bundler
}
}
public void SelectStaticRegistrar ()
{
switch (App.Registrar) {
case RegistrarMode.Static:
case RegistrarMode.Dynamic:
case RegistrarMode.Default:
StaticRegistrar = new StaticRegistrar (this);
break;
}
}
void AOTCompile ()
{
if (App.IsSimulatorBuild)