[XM] Add partial static registrar support (#1191)

This commit is contained in:
Chris Hamons 2016-12-01 10:18:30 -06:00 коммит произвёл GitHub
Родитель eb79a11317
Коммит c67bd9096c
10 изменённых файлов: 300 добавлений и 77 удалений

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

@ -123,6 +123,7 @@
<Compile Include="src\NSScriptCommandDescriptionDictionaryTest.cs" />
<Compile Include="src\ObjCRuntime\ClassTest.cs" />
<Compile Include="src\ObjCRuntime\Messaging.cs" />
<Compile Include="src\ObjCRuntime\SimpleRegistrarTest.cs" />
<Compile Include="src\SceneKit\SceneKit.cs" />
<Compile Include="src\SceneKit\SCNGeometrySource.cs" />
<Compile Include="src\SceneKit\SCNMaterial.cs" />

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

@ -0,0 +1,65 @@
using System;
using System.Runtime.InteropServices;
using NUnit.Framework;
#if !XAMCORE_2_0
using MonoMac.Foundation;
using MonoMac.ObjCRuntime;
#else
using Foundation;
using ObjCRuntime;
#endif
namespace Xamarin.Mac.Tests
{
[Register ("RegistrarTestClass")]
class RegistrarTestClass : NSObject
{
public virtual string Value {
[Export ("value")]
get {
return "RegistrarTestClass";
}
}
}
[Register ("RegistrarTestDerivedClass")]
class RegistrarTestDerivedClass : RegistrarTestClass
{
public override string Value {
get {
return "RegistrarTestDerivedClass";
}
}
}
[TestFixture]
public class SimpleRegistrarTest
{
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
[Test]
public void SimpleRegistrarSmokeTest ()
{
RegistrarTestClass obj = new RegistrarTestClass ();
IntPtr receiver = obj.Handle;
RegistrarTestDerivedClass derivedObj = new RegistrarTestDerivedClass ();
IntPtr derivedReceiver = derivedObj.Handle;
Assert.AreEqual (Runtime.GetNSObject<NSString> (IntPtr_objc_msgSend (receiver, Selector.GetHandle ("value"))), (NSString)"RegistrarTestClass");
Assert.AreEqual (Runtime.GetNSObject<NSString> (IntPtr_objc_msgSend (derivedReceiver, Selector.GetHandle ("value"))), (NSString)"RegistrarTestDerivedClass");
}
[Test]
public void SimpleRegistrar_XamarinMacRegistered ()
{
// __NSObject_Disposer is registered by src/Foundation/NSObject2.cs and should exist
// This will throw is for some reason it is not
Class c = new Class ("__NSObject_Disposer");
}
}
}

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

@ -11,6 +11,14 @@ using Xamarin.Utils;
using XamCore.ObjCRuntime;
#if MONOTOUCH
using PlatformException = Xamarin.Bundler.MonoTouchException;
using PlatformResolver = MonoTouch.Tuner.MonoTouchResolver;
#else
using PlatformException = Xamarin.Bundler.MonoMacException;
using PlatformResolver = Xamarin.Bundler.MonoMacResolver;
#endif
namespace Xamarin.Bundler {
[Flags]
@ -49,6 +57,8 @@ namespace Xamarin.Bundler {
public MarshalObjectiveCExceptionMode MarshalObjectiveCExceptions;
public MarshalManagedExceptionMode MarshalManagedExceptions;
public bool IsDefaultMarshalManagedExceptionMode;
public string RootAssembly;
public string RegistrarOutputLibrary;
public bool RequiresPInvokeWrappers {
get {
@ -398,5 +408,46 @@ namespace Xamarin.Bundler {
IsDefaultMarshalManagedExceptionMode = true;
}
}
public void RunRegistrar ()
{
// The static registrar.
if (Registrar != RegistrarMode.Static)
throw new PlatformException (67, "Invalid registrar: {0}", Registrar); // this is only called during our own build
var registrar_m = RegistrarOutputLibrary;
var resolvedAssemblies = new List<AssemblyDefinition> ();
var resolver = new PlatformResolver () {
FrameworkDirectory = Driver.PlatformFrameworkDirectory,
RootDirectory = Path.GetDirectoryName (RootAssembly),
};
if (Driver.App.Platform == ApplePlatform.iOS || Driver.App.Platform == ApplePlatform.MacOSX) {
if (Driver.App.Is32Build) {
resolver.ArchDirectory = Driver.Arch32Directory;
} else {
resolver.ArchDirectory = Driver.Arch64Directory;
}
}
var ps = new ReaderParameters ();
ps.AssemblyResolver = resolver;
resolvedAssemblies.Add (ps.AssemblyResolver.Resolve ("mscorlib"));
var rootName = Path.GetFileNameWithoutExtension (RootAssembly);
if (rootName != Driver.ProductAssembly)
throw new PlatformException (66, "Invalid build registrar assembly: {0}", RootAssembly);
resolvedAssemblies.Add (ps.AssemblyResolver.Resolve (rootName));
Driver.Log (3, "Loaded {0}", resolvedAssemblies [resolvedAssemblies.Count - 1].MainModule.FileName);
#if MONOTOUCH
BuildTarget = BuildTarget.Simulator;
#endif
var registrar = new XamCore.Registrar.StaticRegistrar (this);
registrar.GenerateSingleAssembly (resolvedAssemblies, Path.ChangeExtension (registrar_m, "h"), registrar_m, Path.GetFileNameWithoutExtension (RootAssembly));
}
}
}

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

@ -643,7 +643,7 @@ namespace XamCore.Registrar {
protected override bool Is64Bits {
get {
if (IsSingleAssembly)
throw new InvalidOperationException ("Can't emit size-specific code in single assembly mode.");
return App.Is64Build;
return Target.Is64Build;
}
}

1
tools/mmp/.gitignore поставляемый
Просмотреть файл

@ -1,2 +1,3 @@
mmp
temp-dir-mmp
Xamarin.Mac.registrar.*

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

@ -1,5 +1,7 @@
namespace MonoMac {
namespace Xamarin.Bundler {
public partial class Application
{
public bool Is32Build => !Driver.Is64Bit;
public bool Is64Build => Driver.Is64Bit;
}
}

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

@ -132,6 +132,8 @@ MMP_TARGETS = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/mmp.exe \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Mono.Cecil.dll \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Mono.Cecil.Mdb.dll \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.mobile.a \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.full.a \
MMP_DIRECTORIES = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin \
@ -150,9 +152,40 @@ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Mono.Cecil.dll: $(MONO_CECIL_
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Mono.Cecil.Mdb.dll: $(MONO_CECIL_MDB_DLL) | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp
$(Q) cp $<* $(dir $@)
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.a | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp
$(Q) cp $<* $(dir $@)
$(MMP_DIRECTORIES):
$(Q) mkdir -p $@
GENERATE_PART_REGISTRAR = $(Q_GEN) $(SYSTEM_MONO) --debug mmp.exe --xamarin-framework-directory=$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR) -q --runregistrar:$(abspath $@) --sdkroot $(XCODE_DEVELOPER_ROOT) --sdk $(OSX_SDK_VERSION) $< --registrar:static
Xamarin.Mac.registrar.mobile.i386.m: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/i386/mobile/Xamarin.Mac.dll mmp.exe
$(GENERATE_PART_REGISTRAR) --target-framework Xamarin.Mac,v1.0 --arch=i386
$(Q) touch Xamarin.Mac.registrar.mobile.i386.m Xamarin.Mac.registrar.mobile.i386.h
Xamarin.Mac.registrar.mobile.x86_64.m: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/x86_64/mobile/Xamarin.Mac.dll mmp.exe
$(GENERATE_PART_REGISTRAR) --target-framework Xamarin.Mac,v1.0 --arch=x86_64
$(Q) touch Xamarin.Mac.registrar.mobile.x86_64.m Xamarin.Mac.registrar.mobile.x86_64.h
Xamarin.Mac.registrar.full.i386.m: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/i386/full/Xamarin.Mac.dll mmp.exe
$(GENERATE_PART_REGISTRAR) --target-framework 4.5 --arch=i386 --xamarin-full-framework --nolink
$(Q) touch Xamarin.Mac.registrar.full.i386.m Xamarin.Mac.registrar.full.i386.h
Xamarin.Mac.registrar.full.x86_64.m: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/x86_64/full/Xamarin.Mac.dll mmp.exe
$(GENERATE_PART_REGISTRAR) --target-framework 4.5 --arch=x86_64 --xamarin-full-framework --nolink
$(Q) touch Xamarin.Mac.registrar.full.x86_64.m Xamarin.Mac.registrar.full.x86_64.h
Xamarin.Mac.registrar.%.i386.a: Xamarin.Mac.registrar.%.i386.m
$(Q_CC) xcrun -sdk macosx clang -DDEBUG -g -gdwarf-2 -x objective-c++ -o $@ -c -arch i386 $< -Wall -I$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/include -mmacosx-version-min=$(MIN_OSX_SDK_VERSION)
Xamarin.Mac.registrar.%.x86_64.a: Xamarin.Mac.registrar.%.x86_64.m
$(Q_CC) xcrun -sdk macosx clang -DDEBUG -g -gdwarf-2 -x objective-c++ -o $@ -c -arch x86_64 $< -Wall -I$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/include -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -fobjc-runtime=macosx
Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.i386.a Xamarin.Mac.registrar.%.x86_64.a
$(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^
ifdef INCLUDE_MAC
install-local:: $(MMP_TARGETS)
all-local:: $(MMP_TARGETS)
@ -163,7 +196,13 @@ clean-local::
rm -f mmp.stub.c mmp.helper.o
rm -f output/*
rm -f Mono.Touch.Common.dll*
rm -f Xamarin.Mac.registrar.*
$(SYSTEM_XBUILD) /t:Clean /p:Configuration=$(CECIL_CONFIG) $(CECIL_PATH)/Mono.Cecil.csproj
$(SYSTEM_XBUILD) /t:Clean /p:Configuration=$(CECIL_CONFIG) $(CECIL_PATH)/symbols/mdb/Mono.Cecil.Mdb.csproj
include $(TOP)/mk/rules.mk
# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards
# marking those files as .SECONDARY will prevent that deletion.
.SECONDARY: $(foreach ext,h m a,Xamarin.Mac.registrar.mobile.i386.$(ext) Xamarin.Mac.registrar.mobile.x86_64.$(ext) Xamarin.Mac.registrar.full.i386.$(ext) Xamarin.Mac.registrar.full.x86_64.$(ext))
.SECONDARY: Xamarin.Mac.registrar.mobile.a Xamarin.Mac.registrar.full.a

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

@ -58,6 +58,13 @@ namespace Xamarin.Bundler {
Static,
}
enum Action {
None,
Help,
Version,
RunRegistrar,
}
public static partial class Driver {
internal static Application App = new Application ();
static Target BuildTarget = new Target (App);
@ -68,10 +75,9 @@ namespace Xamarin.Bundler {
static List<string> native_references = new List<string> ();
static List<string> native_libraries_copied_in = new List<string> ();
static Action action;
static string output_dir;
static string app_name;
static bool show_help = false;
static bool show_version;
static bool generate_plist;
static RegistrarMode registrar = RegistrarMode.Default;
static bool no_executable;
@ -135,6 +141,8 @@ namespace Xamarin.Bundler {
public static bool IsUnified { get { return IsUnifiedFullSystemFramework || IsUnifiedMobile || IsUnifiedFullXamMacFramework; } }
public static bool IsClassic { get { return !IsUnified; } }
public static bool UsesPartialRegistrar => IsUnified && (registrar == RegistrarMode.Dynamic || registrar == RegistrarMode.Default) && App.LinkMode == LinkMode.None;
public static bool Is64Bit {
get {
if (IsUnified && !arch_set)
@ -148,9 +156,59 @@ namespace Xamarin.Bundler {
public static Version MinOSVersion { get { return minos; } }
public static string ProductAssembly => "Xamarin.Mac";
public static string PlatformFrameworkDirectory {
get {
if (IsUnifiedMobile)
return Path.Combine (MMPDirectory, "lib", "mono", "Xamarin.Mac");
else if (IsUnifiedFullXamMacFramework)
return Path.Combine (MMPDirectory, "lib", "mono", "4.5");
throw new InvalidOperationException ("PlatformFrameworkDirectory when not Mobile or Full?");
}
}
public static string Arch32Directory {
get {
if (IsUnifiedMobile)
return Path.Combine (MMPDirectory, "lib", "i386", "mobile");
else if (IsUnifiedFullXamMacFramework)
return Path.Combine (MMPDirectory, "lib", "i386", "full");
throw new InvalidOperationException ("Arch32Directory when not Mobile or Full?");
}
}
public static string Arch64Directory {
get {
if (IsUnifiedMobile)
return Path.Combine (MMPDirectory, "lib", "x86_64", "mobile");
else if (IsUnifiedFullXamMacFramework)
return Path.Combine (MMPDirectory, "lib", "x86_64", "full");
throw new InvalidOperationException ("Arch64Directory when not Mobile or Full?");
}
}
static int watch_level;
static Stopwatch watch;
static string xm_framework_dir;
public static string MMPDirectory {
get {
if (xm_framework_dir == null) {
xm_framework_dir = Path.GetFullPath (GetFullPath () + "/../../..");
#if DEV
// when launched from Xamarin Studio, mtouch is not in the final install location,
// so walk the directory hierarchy to find the root source directory.
while (!File.Exists (Path.Combine (xm_framework_dir, "Make.config")))
xm_framework_dir = Path.GetDirectoryName (xm_framework_dir);
xm_framework_dir = Path.Combine (xm_framework_dir, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current");
#endif
xm_framework_dir = Target.GetRealPath (xm_framework_dir);
}
return xm_framework_dir;
}
}
static void Watch (string msg, int level)
{
if (watch != null && (watch_level > level))
@ -179,8 +237,8 @@ namespace Xamarin.Bundler {
static void Main2 (string [] args)
{
var os = new OptionSet () {
{ "h|?|help", "Displays the help", v => show_help = true },
{ "version", "Output version information and exit.", v => show_version = true },
{ "h|?|help", "Displays the help", v => action = Action.Help },
{ "version", "Output version information and exit.", v => action = Action.Version },
{ "f|force", "Forces the recompilation of code, regardless of timestamps", v=> Force = true },
{ "cache=", "Specify the directory where temporary build files will be cached", v => Cache.Location = v },
{ "a|assembly=", "Add an assembly to be processed", v => references.Add (v) },
@ -290,6 +348,17 @@ namespace Xamarin.Bundler {
{ "allow-unsafe-gac-resolution", "Allow MSBuild to resolve from the System GAC", v => {} , true }, // Used in Xamarin.Mac.XM45.targets and must be ignored here. Hidden since it is a total hack. If you can use it, you don't need support
{ "disable-lldb-attach=", "Disable automatic lldb attach on crash", v => disable_lldb_attach = ParseBool (v, "disable-lldb-attach")},
{ "machine-config=", "Custom machine.config file to copy into MonoBundle/mono/4.5/machine.config. Pass \"\" to copy in a valid \"empty\" config file.", v => machine_config_path = v },
{ "runregistrar:", "Runs the registrar on the input assembly and outputs a corresponding native library.",
v => {
action = Action.RunRegistrar;
App.RegistrarOutputLibrary = v;
},
true /* this is an internal option */
},
{ "xamarin-framework-directory=", "The framework directory", v => { xm_framework_dir = v; }, true },
{ "xamarin-full-framework", "Used with --target-framework=4.5 to select XM 4.5 Target Framework", v => { IsUnifiedFullXamMacFramework = true; } },
{ "xamarin-system-framework", "Used with --target-framework=4.5 to select XM 4.5 Target Framework", v => { IsUnifiedFullSystemFramework = true; } },
};
AddSharedOptions (os);
@ -314,10 +383,10 @@ namespace Xamarin.Bundler {
watch.Start ();
}
if (show_help || (args.Length == 0)) {
if (action == Action.Help || (args.Length == 0)) {
ShowHelp (os);
return;
} else if (show_version) {
} else if (action == Action.Version) {
Console.Write ("mmp {0}.{1}", Constants.Version, Constants.Revision);
Console.WriteLine ();
return;
@ -330,7 +399,10 @@ namespace Xamarin.Bundler {
if (TargetFramework.Identifier == TargetFramework.Xamarin_Mac_2_0.Identifier) {
IsUnifiedMobile = true;
} else {
} else if (!IsUnifiedFullXamMacFramework && !IsUnifiedFullSystemFramework) {
// This is a total hack. Instead of passing in an argument, we walk the refernces looking for
// the "right" Xamarin.Mac and assume you are doing something
// Skip it if xamarin-full-framework or xamarin-system-framework passed in
foreach (var asm in references) {
if (asm.EndsWith ("reference/full/Xamarin.Mac.dll", StringComparison.Ordinal)) {
IsUnifiedFullSystemFramework = true;
@ -397,6 +469,9 @@ namespace Xamarin.Bundler {
if (!IsUnifiedMobile && tls_provider != null)
throw new MonoMacException (2011, true, "Selecting a TLS Provider is only supported in the Unified Mobile profile");
ValidateXcode ();
App.InitializeCommon ();
Log ("Xamarin.Mac {0}{1}", Constants.Version, verbose > 0 ? "." + Constants.Revision : string.Empty);
@ -404,6 +479,12 @@ namespace Xamarin.Bundler {
if (verbose > 0)
Console.WriteLine ("Selected target framework: {0}; API: {1}", targetFramework, IsClassic ? "Classic" : "Unified");
if (action == Action.RunRegistrar) {
App.RootAssembly = unprocessed [0];
App.Registrar = RegistrarMode.Static;
App.RunRegistrar ();
return;
}
try {
Pack (unprocessed);
} finally {
@ -459,6 +540,36 @@ namespace Xamarin.Bundler {
}
}
static void ValidateXcode ()
{
var plist_path = Path.Combine (Path.GetDirectoryName (DeveloperDirectory), "version.plist");
if (xcode_version == null) {
if (File.Exists (plist_path)) {
bool nextElement = false;
XmlReaderSettings settings = new XmlReaderSettings ();
settings.DtdProcessing = DtdProcessing.Ignore;
using (XmlReader reader = XmlReader.Create (plist_path, settings)) {
while (reader.Read()) {
// We want the element after CFBundleShortVersionString
if (reader.NodeType == XmlNodeType.Element) {
if (reader.Name == "key") {
if (reader.ReadElementContentAsString() == "CFBundleShortVersionString")
nextElement = true;
}
if (nextElement && reader.Name == "string") {
nextElement = false;
xcode_version = new Version (reader.ReadElementContentAsString());
}
}
}
}
} else {
throw ErrorHelper.CreateError (58, "The Xcode.app '{0}' is invalid (the file '{1}' does not exist).", Path.GetDirectoryName (Path.GetDirectoryName (DeveloperDirectory)), plist_path);
}
}
}
static void SetSDKVersion ()
{
if (sdk_version != null)
@ -692,33 +803,6 @@ namespace Xamarin.Bundler {
get {
if (sdk_root == null)
sdk_root = LocateXcode ();
var plist_path = Path.Combine (Path.GetDirectoryName (sdk_root), "version.plist");
if (xcode_version == null) {
if (File.Exists (plist_path)) {
bool nextElement = false;
XmlReaderSettings settings = new XmlReaderSettings ();
settings.DtdProcessing = DtdProcessing.Ignore;
using (XmlReader reader = XmlReader.Create (plist_path, settings)) {
while (reader.Read()) {
// We want the element after CFBundleShortVersionString
if (reader.NodeType == XmlNodeType.Element) {
if (reader.Name == "key") {
if (reader.ReadElementContentAsString() == "CFBundleShortVersionString")
nextElement = true;
}
if (nextElement && reader.Name == "string") {
nextElement = false;
xcode_version = new Version (reader.ReadElementContentAsString());
}
}
}
}
} else {
throw ErrorHelper.CreateError (58, "The Xcode.app '{0}' is invalid (the file '{1}' does not exist).", Path.GetDirectoryName (Path.GetDirectoryName (sdk_root)), plist_path);
}
}
return sdk_root;
}
}
@ -905,10 +989,13 @@ namespace Xamarin.Bundler {
sw.WriteLine ("#include <xamarin/xamarin.h>");
sw.WriteLine ("#import <AppKit/NSAlert.h>");
sw.WriteLine ("#import <Foundation/NSDate.h>"); // 10.7 wants this even if not needed on 10.9
if (UsesPartialRegistrar)
sw.WriteLine ("extern int xamarin_create_classes_Xamarin_Mac ();");
sw.WriteLine ();
sw.WriteLine ();
sw.WriteLine ();
sw.WriteLine ("extern \"C\" int xammac_setup ()");
sw.WriteLine ("{");
if (custom_bundle_name != null) {
sw.WriteLine ("extern NSString* xamarin_custom_bundle_name;");
@ -920,6 +1007,10 @@ namespace Xamarin.Bundler {
if (disable_lldb_attach.HasValue ? disable_lldb_attach.Value : !App.EnableDebug)
sw.WriteLine ("\txamarin_disable_lldb_attach = true;");
sw.WriteLine ();
if (UsesPartialRegistrar)
sw.WriteLine ("\txamarin_create_classes_Xamarin_Mac ();");
if (Driver.registrar == RegistrarMode.Static)
sw.WriteLine ("\txamarin_create_classes ();");
@ -1097,6 +1188,12 @@ namespace Xamarin.Bundler {
args.Append ("-u _mono_profiler_startup_log -lz ");
}
}
if (UsesPartialRegistrar) {
args.Append (Path.Combine (GetXamMacPrefix (), "lib", string.Format ("mmp/Xamarin.Mac.registrar.{0}.a ", IsUnifiedMobile ? "mobile" : "full")));
args.Append ("-framework Quartz ");
}
args.Append ("-framework AppKit -liconv -x objective-c++ ");
args.Append ("-I").Append (Quote (Path.Combine (GetXamMacPrefix (), "include"))).Append (' ');
if (registrarPath != null)

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

@ -38,6 +38,8 @@ namespace Xamarin.Bundler {
public string FrameworkDirectory { get; set; }
public string RootDirectory { get; set; }
public string ArchDirectory { get; set; }
public List <string> CommandLineAssemblies { get; set; }
public List<Exception> Exceptions = new List<Exception> ();
@ -117,6 +119,12 @@ namespace Xamarin.Bundler {
return assembly;
}
if (ArchDirectory != null) {
assembly = SearchDirectory (name, ArchDirectory);
if (assembly != null)
return assembly;
}
assembly = SearchDirectory (name, FrameworkDirectory);
if (assembly != null)
return assembly;

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

@ -86,7 +86,6 @@ namespace Xamarin.Bundler {
public partial class Application
{
public string ExecutableName;
public string RootAssembly;
public BuildTarget BuildTarget;
public Version DeploymentTarget;
@ -108,7 +107,6 @@ namespace Xamarin.Bundler {
public List<string> Extensions = new List<string> (); // A list of the extensions this app contains.
public bool FastDev;
public string RegistrarOutputLibrary;
public bool? EnablePie;
public bool NativeStrip = true;
@ -503,45 +501,6 @@ namespace Xamarin.Bundler {
return false;
}
public void RunRegistrar ()
{
// The static registrar.
if (Registrar != RegistrarMode.Static)
throw new MonoTouchException (67, "Invalid registrar: {0}", Registrar); // this is only called during our own build
var registrar_m = RegistrarOutputLibrary;
var resolvedAssemblies = new List<AssemblyDefinition> ();
var resolver = new MonoTouchResolver () {
FrameworkDirectory = Driver.PlatformFrameworkDirectory,
RootDirectory = Path.GetDirectoryName (RootAssembly),
};
if (Driver.App.Platform == ApplePlatform.iOS) {
if (Driver.App.Is32Build) {
resolver.ArchDirectory = Driver.Arch32Directory;
} else {
resolver.ArchDirectory = Driver.Arch64Directory;
}
}
var ps = new ReaderParameters ();
ps.AssemblyResolver = resolver;
resolvedAssemblies.Add (ps.AssemblyResolver.Resolve ("mscorlib"));
var rootName = Path.GetFileNameWithoutExtension (RootAssembly);
if (rootName != Driver.ProductAssembly)
throw new MonoTouchException (66, "Invalid build registrar assembly: {0}", RootAssembly);
resolvedAssemblies.Add (ps.AssemblyResolver.Resolve (rootName));
Driver.Log (3, "Loaded {0}", resolvedAssemblies [resolvedAssemblies.Count - 1].MainModule.FileName);
BuildTarget = BuildTarget.Simulator;
var registrar = new XamCore.Registrar.StaticRegistrar (this);
registrar.GenerateSingleAssembly (resolvedAssemblies, Path.ChangeExtension (registrar_m, "h"), registrar_m, Path.GetFileNameWithoutExtension (RootAssembly));
}
public void Build ()
{
if (Driver.Force) {