[autoformat] Add mmp.csproj. (#16313)
This commit is contained in:
Родитель
a047ce5cf3
Коммит
ee7e95dd69
|
@ -20,19 +20,16 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace ObjCRuntime
|
namespace ObjCRuntime {
|
||||||
{
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum PlatformArchitecture : byte
|
public enum PlatformArchitecture : byte {
|
||||||
{
|
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
Arch32 = 0x01,
|
Arch32 = 0x01,
|
||||||
Arch64 = 0x02,
|
Arch64 = 0x02,
|
||||||
All = 0xff
|
All = 0xff
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PlatformName : byte
|
public enum PlatformName : byte {
|
||||||
{
|
|
||||||
None,
|
None,
|
||||||
MacOSX,
|
MacOSX,
|
||||||
iOS,
|
iOS,
|
||||||
|
@ -43,8 +40,7 @@ namespace ObjCRuntime
|
||||||
UIKitForMac = MacCatalyst, // temporary
|
UIKitForMac = MacCatalyst, // temporary
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AvailabilityKind
|
public enum AvailabilityKind {
|
||||||
{
|
|
||||||
Introduced,
|
Introduced,
|
||||||
Deprecated,
|
Deprecated,
|
||||||
Obsoleted,
|
Obsoleted,
|
||||||
|
@ -65,8 +61,7 @@ namespace ObjCRuntime
|
||||||
AttributeTargets.Struct,
|
AttributeTargets.Struct,
|
||||||
AllowMultiple = true
|
AllowMultiple = true
|
||||||
)]
|
)]
|
||||||
public abstract class AvailabilityBaseAttribute : Attribute
|
public abstract class AvailabilityBaseAttribute : Attribute {
|
||||||
{
|
|
||||||
public AvailabilityKind AvailabilityKind { get; private set; }
|
public AvailabilityKind AvailabilityKind { get; private set; }
|
||||||
public PlatformName Platform { get; private set; }
|
public PlatformName Platform { get; private set; }
|
||||||
public Version Version { get; private set; }
|
public Version Version { get; private set; }
|
||||||
|
@ -95,7 +90,7 @@ namespace ObjCRuntime
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder ();
|
var builder = new StringBuilder ();
|
||||||
builder.AppendFormat ("[{0} ({1}.{2}", AvailabilityKind, nameof (PlatformName), Platform);
|
builder.AppendFormat ("[{0} ({1}.{2}", AvailabilityKind, nameof (PlatformName), Platform);
|
||||||
|
|
||||||
if (Version != null) {
|
if (Version != null) {
|
||||||
builder.AppendFormat (", {0},{1}", Version.Major, Version.Minor);
|
builder.AppendFormat (", {0},{1}", Version.Major, Version.Minor);
|
||||||
if (Version.Build >= 0)
|
if (Version.Build >= 0)
|
||||||
|
@ -113,8 +108,7 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IntroducedAttribute : AvailabilityBaseAttribute
|
public class IntroducedAttribute : AvailabilityBaseAttribute {
|
||||||
{
|
|
||||||
public IntroducedAttribute (PlatformName platform,
|
public IntroducedAttribute (PlatformName platform,
|
||||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||||
string message = null)
|
string message = null)
|
||||||
|
@ -141,8 +135,7 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class DeprecatedAttribute : AvailabilityBaseAttribute
|
public sealed class DeprecatedAttribute : AvailabilityBaseAttribute {
|
||||||
{
|
|
||||||
public DeprecatedAttribute (PlatformName platform,
|
public DeprecatedAttribute (PlatformName platform,
|
||||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||||
string message = null)
|
string message = null)
|
||||||
|
@ -169,8 +162,7 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ObsoletedAttribute : AvailabilityBaseAttribute
|
public sealed class ObsoletedAttribute : AvailabilityBaseAttribute {
|
||||||
{
|
|
||||||
public ObsoletedAttribute (PlatformName platform,
|
public ObsoletedAttribute (PlatformName platform,
|
||||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||||
string message = null)
|
string message = null)
|
||||||
|
@ -197,8 +189,7 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnavailableAttribute : AvailabilityBaseAttribute
|
public class UnavailableAttribute : AvailabilityBaseAttribute {
|
||||||
{
|
|
||||||
public UnavailableAttribute (PlatformName platform,
|
public UnavailableAttribute (PlatformName platform,
|
||||||
PlatformArchitecture architecture = PlatformArchitecture.All,
|
PlatformArchitecture architecture = PlatformArchitecture.All,
|
||||||
string message = null)
|
string message = null)
|
||||||
|
@ -208,58 +199,55 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class TVAttribute : IntroducedAttribute
|
public sealed class TVAttribute : IntroducedAttribute {
|
||||||
{
|
|
||||||
public TVAttribute (byte major, byte minor)
|
public TVAttribute (byte major, byte minor)
|
||||||
: base (PlatformName.TvOS, (int)major, (int)minor)
|
: base (PlatformName.TvOS, (int) major, (int) minor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete ("Use the overload that takes '(major, minor)', since tvOS is always 64-bit.")]
|
[Obsolete ("Use the overload that takes '(major, minor)', since tvOS is always 64-bit.")]
|
||||||
public TVAttribute (byte major, byte minor, bool onlyOn64 = false)
|
public TVAttribute (byte major, byte minor, bool onlyOn64 = false)
|
||||||
: base (PlatformName.TvOS, (int)major, (int)minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
: base (PlatformName.TvOS, (int) major, (int) minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public TVAttribute (byte major, byte minor, byte subminor)
|
public TVAttribute (byte major, byte minor, byte subminor)
|
||||||
: base (PlatformName.TvOS, (int)major, (int)minor, subminor)
|
: base (PlatformName.TvOS, (int) major, (int) minor, subminor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete ("Use the overload that takes '(major, minor, subminor)', since tvOS is always 64-bit.")]
|
[Obsolete ("Use the overload that takes '(major, minor, subminor)', since tvOS is always 64-bit.")]
|
||||||
public TVAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
|
public TVAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
|
||||||
: base (PlatformName.TvOS, (int)major, (int)minor, (int)subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
: base (PlatformName.TvOS, (int) major, (int) minor, (int) subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class WatchAttribute : IntroducedAttribute
|
public sealed class WatchAttribute : IntroducedAttribute {
|
||||||
{
|
|
||||||
public WatchAttribute (byte major, byte minor)
|
public WatchAttribute (byte major, byte minor)
|
||||||
: base (PlatformName.WatchOS, (int)major, (int)minor)
|
: base (PlatformName.WatchOS, (int) major, (int) minor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
|
[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
|
||||||
public WatchAttribute (byte major, byte minor, bool onlyOn64 = false)
|
public WatchAttribute (byte major, byte minor, bool onlyOn64 = false)
|
||||||
: base (PlatformName.WatchOS, (int)major, (int)minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
: base (PlatformName.WatchOS, (int) major, (int) minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public WatchAttribute (byte major, byte minor, byte subminor)
|
public WatchAttribute (byte major, byte minor, byte subminor)
|
||||||
: base (PlatformName.WatchOS, (int)major, (int)minor, subminor)
|
: base (PlatformName.WatchOS, (int) major, (int) minor, subminor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
|
[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
|
||||||
public WatchAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
|
public WatchAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
|
||||||
: base (PlatformName.WatchOS, (int)major, (int)minor, (int)subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
: base (PlatformName.WatchOS, (int) major, (int) minor, (int) subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class MacCatalystAttribute : IntroducedAttribute
|
public sealed class MacCatalystAttribute : IntroducedAttribute {
|
||||||
{
|
|
||||||
public MacCatalystAttribute (byte major, byte minor)
|
public MacCatalystAttribute (byte major, byte minor)
|
||||||
: base (PlatformName.MacCatalyst, (int) major, (int) minor)
|
: base (PlatformName.MacCatalyst, (int) major, (int) minor)
|
||||||
{
|
{
|
||||||
|
@ -271,40 +259,35 @@ namespace ObjCRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NoMacAttribute : UnavailableAttribute
|
public sealed class NoMacAttribute : UnavailableAttribute {
|
||||||
{
|
|
||||||
public NoMacAttribute ()
|
public NoMacAttribute ()
|
||||||
: base (PlatformName.MacOSX)
|
: base (PlatformName.MacOSX)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NoiOSAttribute : UnavailableAttribute
|
public sealed class NoiOSAttribute : UnavailableAttribute {
|
||||||
{
|
|
||||||
public NoiOSAttribute ()
|
public NoiOSAttribute ()
|
||||||
: base (PlatformName.iOS)
|
: base (PlatformName.iOS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NoWatchAttribute : UnavailableAttribute
|
public sealed class NoWatchAttribute : UnavailableAttribute {
|
||||||
{
|
|
||||||
public NoWatchAttribute ()
|
public NoWatchAttribute ()
|
||||||
: base (PlatformName.WatchOS)
|
: base (PlatformName.WatchOS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NoTVAttribute : UnavailableAttribute
|
public sealed class NoTVAttribute : UnavailableAttribute {
|
||||||
{
|
|
||||||
public NoTVAttribute ()
|
public NoTVAttribute ()
|
||||||
: base (PlatformName.TvOS)
|
: base (PlatformName.TvOS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class NoMacCatalystAttribute : UnavailableAttribute
|
public sealed class NoMacCatalystAttribute : UnavailableAttribute {
|
||||||
{
|
|
||||||
public NoMacCatalystAttribute ()
|
public NoMacCatalystAttribute ()
|
||||||
: base (PlatformName.MacCatalyst)
|
: base (PlatformName.MacCatalyst)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,12 +56,10 @@ using ProductException=ObjCRuntime.RuntimeException;
|
||||||
//
|
//
|
||||||
|
|
||||||
#if MONOMAC
|
#if MONOMAC
|
||||||
namespace ObjCRuntime
|
namespace ObjCRuntime {
|
||||||
{
|
|
||||||
public delegate void AssemblyRegistrationHandler (object sender, AssemblyRegistrationEventArgs args);
|
public delegate void AssemblyRegistrationHandler (object sender, AssemblyRegistrationEventArgs args);
|
||||||
|
|
||||||
public class AssemblyRegistrationEventArgs : EventArgs
|
public class AssemblyRegistrationEventArgs : EventArgs {
|
||||||
{
|
|
||||||
public bool Register { get; set; }
|
public bool Register { get; set; }
|
||||||
public System.Reflection.AssemblyName AssemblyName { get; internal set; }
|
public System.Reflection.AssemblyName AssemblyName { get; internal set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.T
|
||||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
|
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
|
||||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
|
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
|
||||||
dotnet format whitespace "$SRC_DIR/tools/dotnet-linker/dotnet-linker.csproj"
|
dotnet format whitespace "$SRC_DIR/tools/dotnet-linker/dotnet-linker.csproj"
|
||||||
|
dotnet format whitespace "$SRC_DIR/tools/mmp/mmp.csproj"
|
||||||
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-sharpie.csproj"
|
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-sharpie.csproj"
|
||||||
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2ignore/u2ignore.csproj"
|
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2ignore/u2ignore.csproj"
|
||||||
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2todo/u2todo.csproj"
|
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2todo/u2todo.csproj"
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the process should exit (with a 0 exit code; failures are propagated using exceptions)
|
// Returns true if the process should exit (with a 0 exit code; failures are propagated using exceptions)
|
||||||
static bool ParseOptions (Application app, Mono.Options.OptionSet options, string[] args, ref Action action)
|
static bool ParseOptions (Application app, Mono.Options.OptionSet options, string [] args, ref Action action)
|
||||||
{
|
{
|
||||||
Action a = Action.None; // Need a temporary local variable, since anonymous functions can't write directly to ref/out arguments.
|
Action a = Action.None; // Need a temporary local variable, since anonymous functions can't write directly to ref/out arguments.
|
||||||
|
|
||||||
|
@ -115,8 +115,7 @@ namespace Xamarin.Bundler {
|
||||||
options.Add ("linkskip=", "Skip linking of the specified assembly.", v => app.LinkSkipped.Add (v));
|
options.Add ("linkskip=", "Skip linking of the specified assembly.", v => app.LinkSkipped.Add (v));
|
||||||
options.Add ("i18n=", "List of i18n assemblies to copy to the output directory, separated by commas (none, all, cjk, mideast, other, rare and/or west).", v => app.ParseI18nAssemblies (v));
|
options.Add ("i18n=", "List of i18n assemblies to copy to the output directory, separated by commas (none, all, cjk, mideast, other, rare and/or west).", v => app.ParseI18nAssemblies (v));
|
||||||
options.Add ("xml=", "Provide an extra XML definition file to the linker.", v => app.Definitions.Add (v));
|
options.Add ("xml=", "Provide an extra XML definition file to the linker.", v => app.Definitions.Add (v));
|
||||||
options.Add ("warnaserror:", "An optional comma-separated list of warning codes that should be reported as errors (if no warnings are specified all warnings are reported as errors).", v =>
|
options.Add ("warnaserror:", "An optional comma-separated list of warning codes that should be reported as errors (if no warnings are specified all warnings are reported as errors).", v => {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (!string.IsNullOrEmpty (v)) {
|
if (!string.IsNullOrEmpty (v)) {
|
||||||
foreach (var code in v.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var code in v.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
|
@ -128,8 +127,7 @@ namespace Xamarin.Bundler {
|
||||||
throw ErrorHelper.CreateError (26, ex, Errors.MX0026, "--warnaserror", ex.Message);
|
throw ErrorHelper.CreateError (26, ex, Errors.MX0026, "--warnaserror", ex.Message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
options.Add ("nowarn:", "An optional comma-separated list of warning codes to ignore (if no warnings are specified all warnings are ignored).", v =>
|
options.Add ("nowarn:", "An optional comma-separated list of warning codes to ignore (if no warnings are specified all warnings are ignored).", v => {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (!string.IsNullOrEmpty (v)) {
|
if (!string.IsNullOrEmpty (v)) {
|
||||||
foreach (var code in v.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var code in v.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
|
@ -223,13 +221,13 @@ namespace Xamarin.Bundler {
|
||||||
options.Add ("http-message-handler=", "Specify the default HTTP message handler for HttpClient.", v => { app.HttpMessageHandler = v; });
|
options.Add ("http-message-handler=", "Specify the default HTTP message handler for HttpClient.", v => { app.HttpMessageHandler = v; });
|
||||||
options.Add ("tls-provider=", "Specify the default TLS provider.", v => { app.TlsProvider = v; });
|
options.Add ("tls-provider=", "Specify the default TLS provider.", v => { app.TlsProvider = v; });
|
||||||
options.Add ("setenv=", "Set the environment variable in the application on startup.", v => {
|
options.Add ("setenv=", "Set the environment variable in the application on startup.", v => {
|
||||||
int eq = v.IndexOf ('=');
|
int eq = v.IndexOf ('=');
|
||||||
if (eq <= 0)
|
if (eq <= 0)
|
||||||
throw ErrorHelper.CreateError (2, Errors.MT0002, v);
|
throw ErrorHelper.CreateError (2, Errors.MT0002, v);
|
||||||
var name = v.Substring (0, eq);
|
var name = v.Substring (0, eq);
|
||||||
var value = v.Substring (eq + 1);
|
var value = v.Substring (eq + 1);
|
||||||
app.EnvironmentVariables.Add (name, value);
|
app.EnvironmentVariables.Add (name, value);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
options.Add ("registrar:", "Specify the registrar to use (dynamic, static or default (dynamic in the simulator, static on device)).", v => {
|
options.Add ("registrar:", "Specify the registrar to use (dynamic, static or default (dynamic in the simulator, static on device)).", v => {
|
||||||
app.ParseRegistrar (v);
|
app.ParseRegistrar (v);
|
||||||
|
@ -414,7 +412,7 @@ namespace Xamarin.Bundler {
|
||||||
throw ErrorHelper.CreateError (143, Errors.MM0143 /* Projects using the Classic API are not supported anymore. Please migrate the project to the Unified API. */);
|
throw ErrorHelper.CreateError (143, Errors.MM0143 /* Projects using the Classic API are not supported anymore. Please migrate the project to the Unified API. */);
|
||||||
|
|
||||||
if (targetFramework == TargetFramework.Net_2_0
|
if (targetFramework == TargetFramework.Net_2_0
|
||||||
|| targetFramework == TargetFramework.Net_3_0
|
|| targetFramework == TargetFramework.Net_3_0
|
||||||
|| targetFramework == TargetFramework.Net_3_5
|
|| targetFramework == TargetFramework.Net_3_5
|
||||||
|| targetFramework == TargetFramework.Net_4_0
|
|| targetFramework == TargetFramework.Net_4_0
|
||||||
|| targetFramework == TargetFramework.Net_4_5) {
|
|| targetFramework == TargetFramework.Net_4_5) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ using PlatformLinkContext = MonoMac.Tuner.MonoMacLinkContext;
|
||||||
|
|
||||||
#if MONOTOUCH
|
#if MONOTOUCH
|
||||||
namespace MonoTouch.Tuner {
|
namespace MonoTouch.Tuner {
|
||||||
#else
|
#else
|
||||||
namespace MonoMac.Tuner {
|
namespace MonoMac.Tuner {
|
||||||
#endif
|
#endif
|
||||||
static partial class Linker {
|
static partial class Linker {
|
||||||
|
@ -53,8 +53,7 @@ namespace MonoMac.Tuner {
|
||||||
return ae;
|
return ae;
|
||||||
case ProductException pe:
|
case ProductException pe:
|
||||||
return pe;
|
return pe;
|
||||||
case MarkException me:
|
case MarkException me: {
|
||||||
{
|
|
||||||
var re = me.InnerException as ResolutionException;
|
var re = me.InnerException as ResolutionException;
|
||||||
if (re == null) {
|
if (re == null) {
|
||||||
if (me.InnerException != null) {
|
if (me.InnerException != null) {
|
||||||
|
@ -68,8 +67,7 @@ namespace MonoMac.Tuner {
|
||||||
return ErrorHelper.CreateError (2101, me, Errors.MT2101, re.Member, me.Method.FullName, scope);
|
return ErrorHelper.CreateError (2101, me, Errors.MT2101, re.Member, me.Method.FullName, scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ResolutionException re:
|
case ResolutionException re: {
|
||||||
{
|
|
||||||
TypeReference tr = (re.Member as TypeReference);
|
TypeReference tr = (re.Member as TypeReference);
|
||||||
IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
|
IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
|
||||||
return new ProductException (2002, true, re, "Failed to resolve \"{0}\" reference from \"{1}\"", re.Member, scope);
|
return new ProductException (2002, true, re, "Failed to resolve \"{0}\" reference from \"{1}\"", re.Member, scope);
|
||||||
|
|
|
@ -9,6 +9,6 @@ namespace Xamarin.Linker {
|
||||||
public abstract class BaseProfile : Profile {
|
public abstract class BaseProfile : Profile {
|
||||||
|
|
||||||
// return assembly name without extension (.dll)
|
// return assembly name without extension (.dll)
|
||||||
public abstract string ProductAssembly { get ; }
|
public abstract string ProductAssembly { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ using ObjCRuntime;
|
||||||
namespace Xamarin.Linker.Steps {
|
namespace Xamarin.Linker.Steps {
|
||||||
|
|
||||||
public class CoreHttpMessageHandler : ExceptionalSubStep {
|
public class CoreHttpMessageHandler : ExceptionalSubStep {
|
||||||
|
|
||||||
public CoreHttpMessageHandler ()
|
public CoreHttpMessageHandler ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,8 @@ namespace Xamarin.Linker.Steps {
|
||||||
{
|
{
|
||||||
if (processing_generated_dispose) {
|
if (processing_generated_dispose) {
|
||||||
switch (instruction.OpCode.OperandType) {
|
switch (instruction.OpCode.OperandType) {
|
||||||
case OperandType.InlineField:
|
case OperandType.InlineField:
|
||||||
case OperandType.InlineTok:
|
case OperandType.InlineTok:
|
||||||
if (SkipField (instruction.Operand as FieldDefinition))
|
if (SkipField (instruction.Operand as FieldDefinition))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -254,7 +254,7 @@ namespace Xamarin.Linker.Steps {
|
||||||
var method = base.MarkMethod (reference);
|
var method = base.MarkMethod (reference);
|
||||||
if (method == null)
|
if (method == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var t = method.DeclaringType;
|
var t = method.DeclaringType;
|
||||||
|
|
||||||
// We have special processing that prevents protocol interfaces from being marked if they're
|
// We have special processing that prevents protocol interfaces from being marked if they're
|
||||||
|
@ -286,7 +286,7 @@ namespace Xamarin.Linker.Steps {
|
||||||
isProtocolImplementation = true;
|
isProtocolImplementation = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isProtocolImplementation) {
|
if (isProtocolImplementation) {
|
||||||
MarkType (r.InterfaceType);
|
MarkType (r.InterfaceType);
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Xamarin.Linker {
|
||||||
|
|
||||||
// this can be used (directly) with Xamarin.Mac and as the base of Xamarin.iOS step
|
// this can be used (directly) with Xamarin.Mac and as the base of Xamarin.iOS step
|
||||||
public class CoreRemoveAttributes : MobileRemoveAttributes {
|
public class CoreRemoveAttributes : MobileRemoveAttributes {
|
||||||
|
|
||||||
protected DerivedLinkContext LinkContext {
|
protected DerivedLinkContext LinkContext {
|
||||||
get {
|
get {
|
||||||
return (DerivedLinkContext) base.context;
|
return (DerivedLinkContext) base.context;
|
||||||
|
@ -29,7 +29,7 @@ namespace Xamarin.Linker {
|
||||||
switch (attr_type.Name) {
|
switch (attr_type.Name) {
|
||||||
case "AdviceAttribute":
|
case "AdviceAttribute":
|
||||||
case "FieldAttribute":
|
case "FieldAttribute":
|
||||||
case "PreserveAttribute": // the ApplyPreserveAttribute substep is executed before this
|
case "PreserveAttribute": // the ApplyPreserveAttribute substep is executed before this
|
||||||
case "LinkerSafeAttribute":
|
case "LinkerSafeAttribute":
|
||||||
return attr_type.Namespace == Namespaces.Foundation;
|
return attr_type.Namespace == Namespaces.Foundation;
|
||||||
// used for documentation, not at runtime
|
// used for documentation, not at runtime
|
||||||
|
@ -69,7 +69,7 @@ namespace Xamarin.Linker {
|
||||||
var attr_type = attribute.Constructor.DeclaringType;
|
var attr_type = attribute.Constructor.DeclaringType;
|
||||||
if (attr_type.Namespace == Namespaces.ObjCRuntime) {
|
if (attr_type.Namespace == Namespaces.ObjCRuntime) {
|
||||||
switch (attr_type.Name) {
|
switch (attr_type.Name) {
|
||||||
case "AvailabilityAttribute": // obsolete (could be present in user code)
|
case "AvailabilityAttribute": // obsolete (could be present in user code)
|
||||||
case "AvailabilityBaseAttribute": // base type for IntroducedAttribute and DeprecatedAttribute (could be in user code)
|
case "AvailabilityBaseAttribute": // base type for IntroducedAttribute and DeprecatedAttribute (could be in user code)
|
||||||
case "DeprecatedAttribute":
|
case "DeprecatedAttribute":
|
||||||
case "IntroducedAttribute":
|
case "IntroducedAttribute":
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace Xamarin.Linker.Steps {
|
||||||
if (td == null) {
|
if (td == null) {
|
||||||
PropertyDefinition pd = (provider as PropertyDefinition);
|
PropertyDefinition pd = (provider as PropertyDefinition);
|
||||||
if (pd != null) {
|
if (pd != null) {
|
||||||
MarkDefaultConstructor (pd.DeclaringType);
|
MarkDefaultConstructor (pd.DeclaringType);
|
||||||
MarkGenericType (pd.PropertyType as GenericInstanceType);
|
MarkGenericType (pd.PropertyType as GenericInstanceType);
|
||||||
td = pd.PropertyType.Resolve ();
|
td = pd.PropertyType.Resolve ();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -251,8 +251,8 @@ namespace Xamarin.Linker.Steps {
|
||||||
switch (type.Namespace) {
|
switch (type.Namespace) {
|
||||||
case "System.Runtime.CompilerServices":
|
case "System.Runtime.CompilerServices":
|
||||||
switch (type.Name) {
|
switch (type.Name) {
|
||||||
case "AsyncTaskMethodBuilder":
|
case "AsyncTaskMethodBuilder":
|
||||||
case "AsyncTaskMethodBuilder`1":
|
case "AsyncTaskMethodBuilder`1":
|
||||||
if (DebugBuild) {
|
if (DebugBuild) {
|
||||||
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
|
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
|
||||||
MarkNamedMethod (type, "get_ObjectIdForDebugger");
|
MarkNamedMethod (type, "get_ObjectIdForDebugger");
|
||||||
|
@ -262,7 +262,7 @@ namespace Xamarin.Linker.Steps {
|
||||||
break;
|
break;
|
||||||
case "System.Threading.Tasks":
|
case "System.Threading.Tasks":
|
||||||
switch (type.Name) {
|
switch (type.Name) {
|
||||||
case "Task":
|
case "Task":
|
||||||
if (DebugBuild)
|
if (DebugBuild)
|
||||||
MarkNamedMethod (type, "NotifyDebuggerOfWaitCompletion");
|
MarkNamedMethod (type, "NotifyDebuggerOfWaitCompletion");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,7 +8,7 @@ using Mono.Tuner;
|
||||||
using Xamarin.Linker;
|
using Xamarin.Linker;
|
||||||
|
|
||||||
namespace MonoTouch.Tuner {
|
namespace MonoTouch.Tuner {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We do not want to list symbols for properties that are linked away.
|
// We do not want to list symbols for properties that are linked away.
|
||||||
// This poses a minor challenge, because the [Field] attribute is linked away
|
// This poses a minor challenge, because the [Field] attribute is linked away
|
||||||
|
@ -74,11 +74,11 @@ namespace MonoTouch.Tuner {
|
||||||
if (attrib.ConstructorArguments.Count != 2)
|
if (attrib.ConstructorArguments.Count != 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var libraryName = (string) attrib.ConstructorArguments[1].Value;
|
var libraryName = (string) attrib.ConstructorArguments [1].Value;
|
||||||
if (libraryName != "__Internal")
|
if (libraryName != "__Internal")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return (string) attrib.ConstructorArguments[0].Value;
|
return (string) attrib.ConstructorArguments [0].Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -2,8 +2,7 @@ using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Xamarin.Bundler {
|
namespace Xamarin.Bundler {
|
||||||
public partial class Application
|
public partial class Application {
|
||||||
{
|
|
||||||
public string ProductName = "Xamarin.Mac";
|
public string ProductName = "Xamarin.Mac";
|
||||||
public AOTOptions AOTOptions;
|
public AOTOptions AOTOptions;
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
internal void Initialize ()
|
internal void Initialize ()
|
||||||
{
|
{
|
||||||
if (DeploymentTarget == null)
|
if (DeploymentTarget == null)
|
||||||
DeploymentTarget = SdkVersions.MinOSXVersion;
|
DeploymentTarget = SdkVersions.MinOSXVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Xamarin.Bundler {
|
namespace Xamarin.Bundler {
|
||||||
public partial class Assembly
|
public partial class Assembly {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Xamarin.Bundler
|
namespace Xamarin.Bundler {
|
||||||
{
|
partial class Target {
|
||||||
partial class Target
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,28 +180,26 @@ namespace MonoMac.Tuner {
|
||||||
{
|
{
|
||||||
return assembly.MainModule.FileName;
|
return assembly.MainModule.FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ResolveFromXmlStep GetResolveStep (string filename)
|
static ResolveFromXmlStep GetResolveStep (string filename)
|
||||||
{
|
{
|
||||||
filename = Path.GetFullPath (filename);
|
filename = Path.GetFullPath (filename);
|
||||||
|
|
||||||
if (!File.Exists (filename))
|
if (!File.Exists (filename))
|
||||||
throw new ProductException (2004, true, Errors.MX2004, filename);
|
throw new ProductException (2004, true, Errors.MX2004, filename);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
using (StreamReader sr = new StreamReader (filename)) {
|
using (StreamReader sr = new StreamReader (filename)) {
|
||||||
return new ResolveFromXmlStep (new XPathDocument (new StringReader (sr.ReadToEnd ())));
|
return new ResolveFromXmlStep (new XPathDocument (new StringReader (sr.ReadToEnd ())));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
throw new ProductException (2005, true, e, Errors.MX2005, filename);
|
throw new ProductException (2005, true, e, Errors.MX2005, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class CustomizeMacActions : CustomizeCoreActions
|
public class CustomizeMacActions : CustomizeCoreActions {
|
||||||
{
|
|
||||||
LinkMode link_mode;
|
LinkMode link_mode;
|
||||||
|
|
||||||
public CustomizeMacActions (LinkMode mode, IEnumerable<string> skipped_assemblies)
|
public CustomizeMacActions (LinkMode mode, IEnumerable<string> skipped_assemblies)
|
||||||
|
@ -235,15 +233,13 @@ namespace MonoMac.Tuner {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
base.ProcessAssembly (assembly);
|
base.ProcessAssembly (assembly);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
throw new ProductException (2103, true, e, Errors.MX2103, assembly.FullName, e);
|
throw new ProductException (2103, true, e, Errors.MX2103, assembly.FullName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadOptionalReferencesStep : LoadReferencesStep
|
class LoadOptionalReferencesStep : LoadReferencesStep {
|
||||||
{
|
|
||||||
HashSet<AssemblyNameDefinition> _references = new HashSet<AssemblyNameDefinition> ();
|
HashSet<AssemblyNameDefinition> _references = new HashSet<AssemblyNameDefinition> ();
|
||||||
|
|
||||||
protected override void ProcessAssembly (AssemblyDefinition assembly)
|
protected override void ProcessAssembly (AssemblyDefinition assembly)
|
||||||
|
|
|
@ -36,14 +36,12 @@ using Profile = Mono.Tuner.Profile;
|
||||||
|
|
||||||
namespace Xamarin.Bundler {
|
namespace Xamarin.Bundler {
|
||||||
|
|
||||||
public interface IFileEnumerator
|
public interface IFileEnumerator {
|
||||||
{
|
|
||||||
IEnumerable<string> Files { get; }
|
IEnumerable<string> Files { get; }
|
||||||
string RootDir { get; }
|
string RootDir { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileSystemEnumerator : IFileEnumerator
|
public class FileSystemEnumerator : IFileEnumerator {
|
||||||
{
|
|
||||||
DirectoryInfo Info;
|
DirectoryInfo Info;
|
||||||
public IEnumerable<string> Files => Info.GetFiles ().Select (x => x.FullName);
|
public IEnumerable<string> Files => Info.GetFiles ().Select (x => x.FullName);
|
||||||
public string RootDir { get; private set; }
|
public string RootDir { get; private set; }
|
||||||
|
@ -78,23 +76,22 @@ namespace Xamarin.Bundler {
|
||||||
Hybrid
|
Hybrid
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AOTOptions
|
public class AOTOptions {
|
||||||
{
|
|
||||||
public bool IsAOT => CompilationType != AOTCompilationType.Default && CompilationType != AOTCompilationType.None;
|
public bool IsAOT => CompilationType != AOTCompilationType.Default && CompilationType != AOTCompilationType.None;
|
||||||
public bool IsHybridAOT => IsAOT && Kind == AOTKind.Hybrid;
|
public bool IsHybridAOT => IsAOT && Kind == AOTKind.Hybrid;
|
||||||
|
|
||||||
public AOTCompilationType CompilationType { get; private set; } = AOTCompilationType.Default;
|
public AOTCompilationType CompilationType { get; private set; } = AOTCompilationType.Default;
|
||||||
public AOTKind Kind { get; private set; } = AOTKind.Standard;
|
public AOTKind Kind { get; private set; } = AOTKind.Standard;
|
||||||
|
|
||||||
public List <string> IncludedAssemblies { get; private set; } = new List <string> ();
|
public List<string> IncludedAssemblies { get; private set; } = new List<string> ();
|
||||||
public List <string> ExcludedAssemblies { get; private set; } = new List <string> ();
|
public List<string> ExcludedAssemblies { get; private set; } = new List<string> ();
|
||||||
|
|
||||||
public AOTOptions (string options)
|
public AOTOptions (string options)
|
||||||
{
|
{
|
||||||
// Syntax - all,core,sdk,none or "" if explicit then optional list of +/-'ed assemblies
|
// Syntax - all,core,sdk,none or "" if explicit then optional list of +/-'ed assemblies
|
||||||
// Sections seperated by ,
|
// Sections seperated by ,
|
||||||
string [] optionParts = options.Split (',');
|
string [] optionParts = options.Split (',');
|
||||||
for (int i = 0 ; i < optionParts.Length ; ++i) {
|
for (int i = 0; i < optionParts.Length; ++i) {
|
||||||
string option = optionParts [i];
|
string option = optionParts [i];
|
||||||
|
|
||||||
AOTKind kind = AOTKind.Default;
|
AOTKind kind = AOTKind.Default;
|
||||||
|
@ -172,10 +169,9 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AOTCompiler
|
public class AOTCompiler {
|
||||||
{
|
|
||||||
// Allows tests to stub out actual compilation and parallelism
|
// Allows tests to stub out actual compilation and parallelism
|
||||||
public RunCommandDelegate RunCommand { get; set; } = Driver.RunCommand;
|
public RunCommandDelegate RunCommand { get; set; } = Driver.RunCommand;
|
||||||
public ParallelOptions ParallelOptions { get; set; } = new ParallelOptions () { MaxDegreeOfParallelism = Driver.Concurrency };
|
public ParallelOptions ParallelOptions { get; set; } = new ParallelOptions () { MaxDegreeOfParallelism = Driver.Concurrency };
|
||||||
|
|
||||||
string xamarin_mac_prefix;
|
string xamarin_mac_prefix;
|
||||||
|
@ -189,14 +185,14 @@ namespace Xamarin.Bundler {
|
||||||
xamarin_mac_prefix = value;
|
xamarin_mac_prefix = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AOTOptions options;
|
AOTOptions options;
|
||||||
Abi [] abis;
|
Abi [] abis;
|
||||||
AOTCompilerType compilerType;
|
AOTCompilerType compilerType;
|
||||||
bool IsRelease;
|
bool IsRelease;
|
||||||
bool IsModern;
|
bool IsModern;
|
||||||
|
|
||||||
public AOTCompiler (AOTOptions options, IEnumerable <Abi> abis, AOTCompilerType compilerType, bool isModern, bool isRelease)
|
public AOTCompiler (AOTOptions options, IEnumerable<Abi> abis, AOTCompilerType compilerType, bool isModern, bool isRelease)
|
||||||
{
|
{
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.abis = abis.ToArray ();
|
this.abis = abis.ToArray ();
|
||||||
|
@ -226,12 +222,12 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Parallel.ForEach (filesToAOT.SelectMany (f => abis, (file, abi) => new Tuple <string, Abi> (file, abi)), ParallelOptions, tuple => {
|
Parallel.ForEach (filesToAOT.SelectMany (f => abis, (file, abi) => new Tuple<string, Abi> (file, abi)), ParallelOptions, tuple => {
|
||||||
var file = tuple.Item1;
|
var file = tuple.Item1;
|
||||||
var abi = tuple.Item2;
|
var abi = tuple.Item2;
|
||||||
|
|
||||||
var cmd = new List <string> ();
|
var cmd = new List<string> ();
|
||||||
var aotArgs = new List <string> ();
|
var aotArgs = new List<string> ();
|
||||||
aotArgs.Add ($"mtriple={abi.AsArchString ()}");
|
aotArgs.Add ($"mtriple={abi.AsArchString ()}");
|
||||||
if (options.IsHybridAOT)
|
if (options.IsHybridAOT)
|
||||||
aotArgs.Add ("hybrid");
|
aotArgs.Add ("hybrid");
|
||||||
|
@ -286,11 +282,11 @@ namespace Xamarin.Bundler {
|
||||||
List<string> GetFilesToAOT (IFileEnumerator files)
|
List<string> GetFilesToAOT (IFileEnumerator files)
|
||||||
{
|
{
|
||||||
// Make a dictionary of included/excluded files to track if we've missed some at the end
|
// Make a dictionary of included/excluded files to track if we've missed some at the end
|
||||||
Dictionary <string, bool> includedAssemblies = new Dictionary <string, bool> ();
|
Dictionary<string, bool> includedAssemblies = new Dictionary<string, bool> ();
|
||||||
foreach (var item in options.IncludedAssemblies)
|
foreach (var item in options.IncludedAssemblies)
|
||||||
includedAssemblies [item] = false;
|
includedAssemblies [item] = false;
|
||||||
|
|
||||||
Dictionary <string, bool> excludedAssemblies = new Dictionary <string, bool> ();
|
Dictionary<string, bool> excludedAssemblies = new Dictionary<string, bool> ();
|
||||||
foreach (var item in options.ExcludedAssemblies)
|
foreach (var item in options.ExcludedAssemblies)
|
||||||
excludedAssemblies [item] = false;
|
excludedAssemblies [item] = false;
|
||||||
|
|
||||||
|
@ -329,7 +325,7 @@ namespace Xamarin.Bundler {
|
||||||
case AOTCompilationType.Explicit:
|
case AOTCompilationType.Explicit:
|
||||||
break; // In explicit, only included includedAssemblies included
|
break; // In explicit, only included includedAssemblies included
|
||||||
default:
|
default:
|
||||||
throw ErrorHelper.CreateError (0099, Errors.MX0099, $"\"GetFilesToAOT with aot: {options.CompilationType}\"" );
|
throw ErrorHelper.CreateError (0099, Errors.MX0099, $"\"GetFilesToAOT with aot: {options.CompilationType}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Xamarin.Bundler {
|
||||||
static string macos_dir;
|
static string macos_dir;
|
||||||
static string resources_dir;
|
static string resources_dir;
|
||||||
static string mmp_dir;
|
static string mmp_dir;
|
||||||
|
|
||||||
static string AppPath { get { return Path.Combine (macos_dir, app_name); } }
|
static string AppPath { get { return Path.Combine (macos_dir, app_name); } }
|
||||||
|
|
||||||
static string icon;
|
static string icon;
|
||||||
|
@ -93,7 +93,8 @@ namespace Xamarin.Bundler {
|
||||||
static bool frameworks_copied_to_bundle_dir; // Have we copied any frameworks to Foo.app/Contents/Frameworks?
|
static bool frameworks_copied_to_bundle_dir; // Have we copied any frameworks to Foo.app/Contents/Frameworks?
|
||||||
static bool dylibs_copied_to_bundle_dir => native_libraries_copied_in.Count > 0;
|
static bool dylibs_copied_to_bundle_dir => native_libraries_copied_in.Count > 0;
|
||||||
|
|
||||||
static void ShowHelp (OptionSet os) {
|
static void ShowHelp (OptionSet os)
|
||||||
|
{
|
||||||
Console.WriteLine ("mmp - Xamarin.Mac Packer");
|
Console.WriteLine ("mmp - Xamarin.Mac Packer");
|
||||||
Console.WriteLine ("Copyright 2010 Novell Inc.");
|
Console.WriteLine ("Copyright 2010 Novell Inc.");
|
||||||
Console.WriteLine ("Copyright 2011-2016 Xamarin Inc.");
|
Console.WriteLine ("Copyright 2011-2016 Xamarin Inc.");
|
||||||
|
@ -129,7 +130,7 @@ namespace Xamarin.Bundler {
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException ("Arch32Directory when not Mobile or Full?");
|
throw new InvalidOperationException ("Arch32Directory when not Mobile or Full?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetArch64Directory (Application app)
|
public static string GetArch64Directory (Application app)
|
||||||
{
|
{
|
||||||
if (IsUnifiedMobile)
|
if (IsUnifiedMobile)
|
||||||
|
@ -138,7 +139,7 @@ namespace Xamarin.Bundler {
|
||||||
return Path.Combine (GetFrameworkLibDirectory (app), "x86_64", "full");
|
return Path.Combine (GetFrameworkLibDirectory (app), "x86_64", "full");
|
||||||
throw new InvalidOperationException ("Arch64Directory when not Mobile or Full?");
|
throw new InvalidOperationException ("Arch64Directory when not Mobile or Full?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool EnableDebug {
|
public static bool EnableDebug {
|
||||||
get { return App.EnableDebug; }
|
get { return App.EnableDebug; }
|
||||||
}
|
}
|
||||||
|
@ -152,15 +153,15 @@ namespace Xamarin.Bundler {
|
||||||
{ "n|name=", "Specify the application name", v => app_name = v },
|
{ "n|name=", "Specify the application name", v => app_name = v },
|
||||||
{ "s|sgen:", "Use the SGen Garbage Collector",
|
{ "s|sgen:", "Use the SGen Garbage Collector",
|
||||||
v => {
|
v => {
|
||||||
if (!ParseBool (v, "sgen"))
|
if (!ParseBool (v, "sgen"))
|
||||||
ErrorHelper.Warning (43, Errors.MX0043);
|
ErrorHelper.Warning (43, Errors.MX0043);
|
||||||
},
|
},
|
||||||
true // do not show the option anymore
|
true // do not show the option anymore
|
||||||
},
|
},
|
||||||
{ "boehm:", "Enable the Boehm garbage collector",
|
{ "boehm:", "Enable the Boehm garbage collector",
|
||||||
v => {
|
v => {
|
||||||
if (ParseBool (v, "boehm"))
|
if (ParseBool (v, "boehm"))
|
||||||
ErrorHelper.Warning (43, Errors.MX0043); },
|
ErrorHelper.Warning (43, Errors.MX0043); },
|
||||||
true // do not show the option anymore
|
true // do not show the option anymore
|
||||||
},
|
},
|
||||||
{ "new-refcount:", "Enable new refcounting logic",
|
{ "new-refcount:", "Enable new refcounting logic",
|
||||||
|
@ -255,9 +256,9 @@ namespace Xamarin.Bundler {
|
||||||
// With newer Mono builds, the system assemblies passed to us by msbuild are
|
// With newer Mono builds, the system assemblies passed to us by msbuild are
|
||||||
// no longer safe to copy into the bundle. They are stripped "fake" BCL
|
// no longer safe to copy into the bundle. They are stripped "fake" BCL
|
||||||
// copies. So we redirect to the "real" ones. Thanks TargetFrameworkDirectories :(
|
// copies. So we redirect to the "real" ones. Thanks TargetFrameworkDirectories :(
|
||||||
Regex monoAPIRegex = new Regex("lib/mono/.*-api/", RegexOptions.IgnoreCase);
|
Regex monoAPIRegex = new Regex ("lib/mono/.*-api/", RegexOptions.IgnoreCase);
|
||||||
Regex monoAPIFacadesRegex = new Regex("lib/mono/.*-api/Facades/", RegexOptions.IgnoreCase);
|
Regex monoAPIFacadesRegex = new Regex ("lib/mono/.*-api/Facades/", RegexOptions.IgnoreCase);
|
||||||
FixReferences (x => monoAPIRegex.IsMatch (x) && !monoAPIFacadesRegex.IsMatch (x), x => x.Replace(monoAPIRegex.Match(x).Value, "lib/mono/4.5/"));
|
FixReferences (x => monoAPIRegex.IsMatch (x) && !monoAPIFacadesRegex.IsMatch (x), x => x.Replace (monoAPIRegex.Match (x).Value, "lib/mono/4.5/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.Registrar == RegistrarMode.PartialStatic && App.LinkMode != LinkMode.None)
|
if (App.Registrar == RegistrarMode.PartialStatic && App.LinkMode != LinkMode.None)
|
||||||
|
@ -488,7 +489,7 @@ namespace Xamarin.Bundler {
|
||||||
root_assembly = unprocessed [0];
|
root_assembly = unprocessed [0];
|
||||||
if (!File.Exists (root_assembly))
|
if (!File.Exists (root_assembly))
|
||||||
throw new ProductException (7, true, Errors.MX0007, root_assembly);
|
throw new ProductException (7, true, Errors.MX0007, root_assembly);
|
||||||
|
|
||||||
string root_wo_ext = Path.GetFileNameWithoutExtension (root_assembly);
|
string root_wo_ext = Path.GetFileNameWithoutExtension (root_assembly);
|
||||||
if (Profile.IsSdkAssembly (root_wo_ext) || Profile.IsProductAssembly (root_wo_ext))
|
if (Profile.IsSdkAssembly (root_wo_ext) || Profile.IsProductAssembly (root_wo_ext))
|
||||||
throw new ProductException (3, true, Errors.MX0003, root_wo_ext);
|
throw new ProductException (3, true, Errors.MX0003, root_wo_ext);
|
||||||
|
@ -507,7 +508,7 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (app_name))
|
if (string.IsNullOrEmpty (app_name))
|
||||||
app_name = root_wo_ext;
|
app_name = root_wo_ext;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (output_dir))
|
if (string.IsNullOrEmpty (output_dir))
|
||||||
output_dir = Environment.CurrentDirectory;
|
output_dir = Environment.CurrentDirectory;
|
||||||
}
|
}
|
||||||
|
@ -558,12 +559,11 @@ namespace Xamarin.Bundler {
|
||||||
List<MethodDefinition> methods;
|
List<MethodDefinition> methods;
|
||||||
if (native_libs.TryGetValue (kvp.Key, out methods)) {
|
if (native_libs.TryGetValue (kvp.Key, out methods)) {
|
||||||
if (methods == null) {
|
if (methods == null) {
|
||||||
methods = new List<MethodDefinition> ();
|
methods = new List<MethodDefinition> ();
|
||||||
native_libs [kvp.Key] = methods;
|
native_libs [kvp.Key] = methods;
|
||||||
}
|
}
|
||||||
methods.AddRange (kvp.Value);
|
methods.AddRange (kvp.Value);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
native_libs.Add (kvp.Key, kvp.Value);
|
native_libs.Add (kvp.Key, kvp.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ namespace Xamarin.Bundler {
|
||||||
// MDK check
|
// MDK check
|
||||||
Compile ();
|
Compile ();
|
||||||
Watch ("Compile", 1);
|
Watch ("Compile", 1);
|
||||||
|
|
||||||
if (generate_plist)
|
if (generate_plist)
|
||||||
GeneratePList ();
|
GeneratePList ();
|
||||||
|
|
||||||
|
@ -632,8 +632,7 @@ namespace Xamarin.Bundler {
|
||||||
if (Application.UpdateFile (src, temp_dest))
|
if (Application.UpdateFile (src, temp_dest))
|
||||||
LipoLibrary (name, temp_dest);
|
LipoLibrary (name, temp_dest);
|
||||||
Application.UpdateFile (temp_dest, dest);
|
Application.UpdateFile (temp_dest, dest);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// we can directly update the dest
|
// we can directly update the dest
|
||||||
Application.UpdateFile (src, dest);
|
Application.UpdateFile (src, dest);
|
||||||
}
|
}
|
||||||
|
@ -668,26 +667,28 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GeneratePList () {
|
static void GeneratePList ()
|
||||||
|
{
|
||||||
var sr = new StreamReader (typeof (Driver).Assembly.GetManifestResourceStream (App.Embeddinator ? "Info-framework.plist.tmpl" : "Info.plist.tmpl"));
|
var sr = new StreamReader (typeof (Driver).Assembly.GetManifestResourceStream (App.Embeddinator ? "Info-framework.plist.tmpl" : "Info.plist.tmpl"));
|
||||||
var all = sr.ReadToEnd ();
|
var all = sr.ReadToEnd ();
|
||||||
var icon_str = (icon != null) ? "\t<key>CFBundleIconFile</key>\n\t<string>" + icon + "</string>\n\t" : "";
|
var icon_str = (icon != null) ? "\t<key>CFBundleIconFile</key>\n\t<string>" + icon + "</string>\n\t" : "";
|
||||||
var path = Path.Combine (App.Embeddinator ? resources_dir : contents_dir, "Info.plist");
|
var path = Path.Combine (App.Embeddinator ? resources_dir : contents_dir, "Info.plist");
|
||||||
using (var sw = new StreamWriter (path)){
|
using (var sw = new StreamWriter (path)) {
|
||||||
sw.WriteLine (
|
sw.WriteLine (
|
||||||
all.Replace ("@BUNDLEDISPLAYNAME@", app_name).
|
all.Replace ("@BUNDLEDISPLAYNAME@", app_name).
|
||||||
Replace ("@EXECUTABLE@", app_name).
|
Replace ("@EXECUTABLE@", app_name).
|
||||||
Replace ("@BUNDLEID@", string.Format ("org.mono.bundler.{0}", app_name)).
|
Replace ("@BUNDLEID@", string.Format ("org.mono.bundler.{0}", app_name)).
|
||||||
Replace ("@BUNDLEICON@", icon_str).
|
Replace ("@BUNDLEICON@", icon_str).
|
||||||
Replace ("@BUNDLENAME@", app_name).
|
Replace ("@BUNDLENAME@", app_name).
|
||||||
Replace ("@ASSEMBLY@", App.References.Where (e => Path.GetExtension (e) == ".exe").FirstOrDefault ()));
|
Replace ("@ASSEMBLY@", App.References.Where (e => Path.GetExtension (e) == ".exe").FirstOrDefault ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// the 'codesign' is provided with OSX, not with Xcode (no need to use xcrun)
|
// the 'codesign' is provided with OSX, not with Xcode (no need to use xcrun)
|
||||||
// note: by default the monodevelop addin does the signing (not mmp)
|
// note: by default the monodevelop addin does the signing (not mmp)
|
||||||
static void CodeSign () {
|
static void CodeSign ()
|
||||||
|
{
|
||||||
RunCommand ("codesign", String.Format ("-v -s \"{0}\" \"{1}\"", certificate_name, App.AppDirectory));
|
RunCommand ("codesign", String.Format ("-v -s \"{0}\" \"{1}\"", certificate_name, App.AppDirectory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,8 +713,7 @@ namespace Xamarin.Bundler {
|
||||||
return path;
|
return path;
|
||||||
else
|
else
|
||||||
return Marshal.PtrToStringAuto (buffer);
|
return Marshal.PtrToStringAuto (buffer);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
if (buffer != IntPtr.Zero)
|
if (buffer != IntPtr.Zero)
|
||||||
Marshal.FreeHGlobal (buffer);
|
Marshal.FreeHGlobal (buffer);
|
||||||
}
|
}
|
||||||
|
@ -735,7 +735,7 @@ namespace Xamarin.Bundler {
|
||||||
args.Add ("-F");
|
args.Add ("-F");
|
||||||
args.Add (path);
|
args.Add (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weak)
|
if (weak)
|
||||||
BuildTarget.WeakFrameworks.Add (name);
|
BuildTarget.WeakFrameworks.Add (name);
|
||||||
else
|
else
|
||||||
|
@ -812,7 +812,7 @@ namespace Xamarin.Bundler {
|
||||||
throw new ProductException (5203, true, Errors.MM5203, libxammac);
|
throw new ProductException (5203, true, Errors.MM5203, libxammac);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List <string> compiledExecutables = new List <string> ();
|
List<string> compiledExecutables = new List<string> ();
|
||||||
foreach (var abi in App.Abis) {
|
foreach (var abi in App.Abis) {
|
||||||
var abiDir = Path.Combine (App.Cache.Location, "main", abi.AsArchString ());
|
var abiDir = Path.Combine (App.Cache.Location, "main", abi.AsArchString ());
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ namespace Xamarin.Bundler {
|
||||||
var main = Path.Combine (abiDir, $"main.m");
|
var main = Path.Combine (abiDir, $"main.m");
|
||||||
BuildTarget.GenerateMain (ApplePlatform.MacOSX, abi, main, null);
|
BuildTarget.GenerateMain (ApplePlatform.MacOSX, abi, main, null);
|
||||||
|
|
||||||
var args = new List <string> ();
|
var args = new List<string> ();
|
||||||
if (App.EnableDebug)
|
if (App.EnableDebug)
|
||||||
args.Add ("-g");
|
args.Add ("-g");
|
||||||
if (App.Embeddinator) {
|
if (App.Embeddinator) {
|
||||||
|
@ -845,7 +845,7 @@ namespace Xamarin.Bundler {
|
||||||
args.Add ("-std=c++14");
|
args.Add ("-std=c++14");
|
||||||
|
|
||||||
bool appendedObjc = false;
|
bool appendedObjc = false;
|
||||||
var sourceFiles = new List <string> ();
|
var sourceFiles = new List<string> ();
|
||||||
foreach (var assembly in BuildTarget.Assemblies) {
|
foreach (var assembly in BuildTarget.Assemblies) {
|
||||||
if (assembly.LinkWith != null) {
|
if (assembly.LinkWith != null) {
|
||||||
foreach (var linkWith in assembly.LinkWith) {
|
foreach (var linkWith in assembly.LinkWith) {
|
||||||
|
@ -947,7 +947,7 @@ namespace Xamarin.Bundler {
|
||||||
var outputPath = Path.Combine (abiDir, Path.GetFileName (AppPath));
|
var outputPath = Path.Combine (abiDir, Path.GetFileName (AppPath));
|
||||||
compiledExecutables.Add (outputPath);
|
compiledExecutables.Add (outputPath);
|
||||||
args.Add (outputPath);
|
args.Add (outputPath);
|
||||||
|
|
||||||
args.AddRange (cflags);
|
args.AddRange (cflags);
|
||||||
if (embed_mono) {
|
if (embed_mono) {
|
||||||
string libmono = Path.Combine (libdir, "libmonosgen-2.0.a");
|
string libmono = Path.Combine (libdir, "libmonosgen-2.0.a");
|
||||||
|
@ -1074,7 +1074,7 @@ namespace Xamarin.Bundler {
|
||||||
throw new AggregateException (exceptions);
|
throw new AggregateException (exceptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IDictionary<string,List<MethodDefinition>> Link ()
|
static IDictionary<string, List<MethodDefinition>> Link ()
|
||||||
{
|
{
|
||||||
var cache = (Dictionary<string, AssemblyDefinition>) BuildTarget.Resolver.ResolverCache;
|
var cache = (Dictionary<string, AssemblyDefinition>) BuildTarget.Resolver.ResolverCache;
|
||||||
AssemblyResolver resolver;
|
AssemblyResolver resolver;
|
||||||
|
@ -1085,7 +1085,7 @@ namespace Xamarin.Bundler {
|
||||||
} else {
|
} else {
|
||||||
resolver = new Mono.Linker.AssemblyResolver ();
|
resolver = new Mono.Linker.AssemblyResolver ();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resolver = new MonoMacAssemblyResolver (BuildTarget.Resolver);
|
resolver = new MonoMacAssemblyResolver (BuildTarget.Resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,8 +1102,7 @@ namespace Xamarin.Bundler {
|
||||||
I18nAssemblies = App.I18n,
|
I18nAssemblies = App.I18n,
|
||||||
ExtraDefinitions = App.Definitions,
|
ExtraDefinitions = App.Definitions,
|
||||||
RuntimeOptions = App.RuntimeOptions,
|
RuntimeOptions = App.RuntimeOptions,
|
||||||
MarshalNativeExceptionsState = !App.RequiresPInvokeWrappers ? null : new PInvokeWrapperGenerator ()
|
MarshalNativeExceptionsState = !App.RequiresPInvokeWrappers ? null : new PInvokeWrapperGenerator () {
|
||||||
{
|
|
||||||
App = App,
|
App = App,
|
||||||
SourcePath = Path.Combine (App.Cache.Location, "pinvokes.m"),
|
SourcePath = Path.Combine (App.Cache.Location, "pinvokes.m"),
|
||||||
HeaderPath = Path.Combine (App.Cache.Location, "pinvokes.h"),
|
HeaderPath = Path.Combine (App.Cache.Location, "pinvokes.h"),
|
||||||
|
@ -1188,7 +1187,7 @@ namespace Xamarin.Bundler {
|
||||||
if (lib.StartsWith (Path.GetDirectoryName (MonoPrefix), StringComparison.Ordinal)) {
|
if (lib.StartsWith (Path.GetDirectoryName (MonoPrefix), StringComparison.Ordinal)) {
|
||||||
string libname = Path.GetFileName (lib);
|
string libname = Path.GetFileName (lib);
|
||||||
string real_lib = GetRealPath (lib);
|
string real_lib = GetRealPath (lib);
|
||||||
string real_libname = Path.GetFileName (real_lib);
|
string real_libname = Path.GetFileName (real_lib);
|
||||||
// if a symlink was specified then re-create it inside the .app
|
// if a symlink was specified then re-create it inside the .app
|
||||||
if (libname != real_libname)
|
if (libname != real_libname)
|
||||||
CreateSymLink (mmp_dir, real_libname, libname);
|
CreateSymLink (mmp_dir, real_libname, libname);
|
||||||
|
@ -1226,31 +1225,31 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
// well known libraries we do not bundle or warn about
|
// well known libraries we do not bundle or warn about
|
||||||
switch (shortendName.ToLowerInvariant ()) {
|
switch (shortendName.ToLowerInvariant ()) {
|
||||||
case "xammac": // we have a p/invoke to this library in Runtime.mac.cs, for users that don't bundle with mmp.
|
case "xammac": // we have a p/invoke to this library in Runtime.mac.cs, for users that don't bundle with mmp.
|
||||||
case "__internal": // mono runtime
|
case "__internal": // mono runtime
|
||||||
case "kernel32": // windows specific
|
case "kernel32": // windows specific
|
||||||
case "gdi32": // windows specific
|
case "gdi32": // windows specific
|
||||||
case "ole32": // windows specific
|
case "ole32": // windows specific
|
||||||
case "user32": // windows specific
|
case "user32": // windows specific
|
||||||
case "advapi32": // windows specific
|
case "advapi32": // windows specific
|
||||||
case "crypt32": // windows specific
|
case "crypt32": // windows specific
|
||||||
case "msvcrt": // windows specific
|
case "msvcrt": // windows specific
|
||||||
case "iphlpapi": // windows specific
|
case "iphlpapi": // windows specific
|
||||||
case "winmm": // windows specific
|
case "winmm": // windows specific
|
||||||
case "winspool": // windows specific
|
case "winspool": // windows specific
|
||||||
case "c": // system provided
|
case "c": // system provided
|
||||||
case "objc": // system provided
|
case "objc": // system provided
|
||||||
case "objc.a": // found in swift core libraries
|
case "objc.a": // found in swift core libraries
|
||||||
case "system.b": // found in swift core libraries
|
case "system.b": // found in swift core libraries
|
||||||
case "system": // system provided, libSystem.dylib -> CommonCrypto
|
case "system": // system provided, libSystem.dylib -> CommonCrypto
|
||||||
case "x11": // msvcrt pulled in
|
case "x11": // msvcrt pulled in
|
||||||
case "winspool.drv": // msvcrt pulled in
|
case "winspool.drv": // msvcrt pulled in
|
||||||
case "cups": // msvcrt pulled in
|
case "cups": // msvcrt pulled in
|
||||||
case "fam.so.0": // msvcrt pulled in
|
case "fam.so.0": // msvcrt pulled in
|
||||||
case "gamin-1.so.0": // msvcrt pulled in
|
case "gamin-1.so.0": // msvcrt pulled in
|
||||||
case "asound.so.2": // msvcrt pulled in
|
case "asound.so.2": // msvcrt pulled in
|
||||||
case "oleaut32": // referenced by System.Runtime.InteropServices.Marshal._[S|G]etErrorInfo
|
case "oleaut32": // referenced by System.Runtime.InteropServices.Marshal._[S|G]etErrorInfo
|
||||||
case "system.native": // handled by CopyMonoNative()
|
case "system.native": // handled by CopyMonoNative()
|
||||||
case "system.security.cryptography.native.apple": // same
|
case "system.security.cryptography.native.apple": // same
|
||||||
case "system.net.security.native": // same
|
case "system.net.security.native": // same
|
||||||
return true;
|
return true;
|
||||||
|
@ -1327,8 +1326,7 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
if (GetRealPath (dest) == real_src) {
|
if (GetRealPath (dest) == real_src) {
|
||||||
Console.WriteLine ("Dependency {0} was already at destination, skipping.", Path.GetFileName (real_src));
|
Console.WriteLine ("Dependency {0} was already at destination, skipping.", Path.GetFileName (real_src));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// install_name_tool gets angry if you copy in a read only native library
|
// install_name_tool gets angry if you copy in a read only native library
|
||||||
CopyFileAndRemoveReadOnly (real_src, dest);
|
CopyFileAndRemoveReadOnly (real_src, dest);
|
||||||
}
|
}
|
||||||
|
@ -1380,7 +1378,7 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
var prefix = new [] { dest };
|
var prefix = new [] { dest };
|
||||||
var suffix = new [] { "-output", dest };
|
var suffix = new [] { "-output", dest };
|
||||||
List <string> archArgs = new List <string> ();
|
List<string> archArgs = new List<string> ();
|
||||||
foreach (var abi in App.Abis) {
|
foreach (var abi in App.Abis) {
|
||||||
archArgs.Add ("-extract_family");
|
archArgs.Add ("-extract_family");
|
||||||
archArgs.Add (abi.ToString ().ToLowerInvariant ());
|
archArgs.Add (abi.ToString ().ToLowerInvariant ());
|
||||||
|
@ -1399,7 +1397,8 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Currently we clobber any existing files, perhaps we should error and have a -force flag */
|
/* Currently we clobber any existing files, perhaps we should error and have a -force flag */
|
||||||
static void CreateDirectoriesIfNeeded () {
|
static void CreateDirectoriesIfNeeded ()
|
||||||
|
{
|
||||||
if (App.Embeddinator) {
|
if (App.Embeddinator) {
|
||||||
App.AppDirectory = Path.Combine (output_dir, app_name + ".framework");
|
App.AppDirectory = Path.Combine (output_dir, app_name + ".framework");
|
||||||
contents_dir = Path.Combine (App.AppDirectory, "Versions", "A");
|
contents_dir = Path.Combine (App.AppDirectory, "Versions", "A");
|
||||||
|
@ -1441,20 +1440,20 @@ namespace Xamarin.Bundler {
|
||||||
PathUtils.CreateSymlink (file, target);
|
PathUtils.CreateSymlink (file, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateDirectoryIfNeeded (string dir) {
|
static void CreateDirectoryIfNeeded (string dir)
|
||||||
|
{
|
||||||
if (!Directory.Exists (dir))
|
if (!Directory.Exists (dir))
|
||||||
Directory.CreateDirectory (dir);
|
Directory.CreateDirectory (dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyConfiguration () {
|
static void CopyConfiguration ()
|
||||||
|
{
|
||||||
if (IsUnifiedMobile) {
|
if (IsUnifiedMobile) {
|
||||||
CopyResourceFile ("config_mobile", "config");
|
CopyResourceFile ("config_mobile", "config");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (IsUnifiedFullXamMacFramework) {
|
if (IsUnifiedFullXamMacFramework) {
|
||||||
CopyResourceFile ("machine.4_5.config", "machine.config");
|
CopyResourceFile ("machine.4_5.config", "machine.config");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
string machine_config = Path.Combine (MonoDirectory, "etc", "mono", "4.5", "machine.config");
|
string machine_config = Path.Combine (MonoDirectory, "etc", "mono", "4.5", "machine.config");
|
||||||
|
|
||||||
if (!File.Exists (machine_config))
|
if (!File.Exists (machine_config))
|
||||||
|
@ -1473,8 +1472,7 @@ namespace Xamarin.Bundler {
|
||||||
CreateDirectoryIfNeeded (machineConfigDestDir);
|
CreateDirectoryIfNeeded (machineConfigDestDir);
|
||||||
if (machine_config_path == String.Empty) {
|
if (machine_config_path == String.Empty) {
|
||||||
File.WriteAllLines (machineConfigDestFile, new string [] { "<?xml version=\"1.0\" encoding=\"utf-8\"?>", "<configuration>", "</configuration>" });
|
File.WriteAllLines (machineConfigDestFile, new string [] { "<?xml version=\"1.0\" encoding=\"utf-8\"?>", "<configuration>", "</configuration>" });
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (!File.Exists (machine_config_path))
|
if (!File.Exists (machine_config_path))
|
||||||
throw new ProductException (97, true, Errors.MM0097, machine_config_path);
|
throw new ProductException (97, true, Errors.MM0097, machine_config_path);
|
||||||
File.Copy (machine_config_path, machineConfigDestFile);
|
File.Copy (machine_config_path, machineConfigDestFile);
|
||||||
|
@ -1482,7 +1480,8 @@ namespace Xamarin.Bundler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyResourceFile (string streamName, string outputFileName) {
|
static void CopyResourceFile (string streamName, string outputFileName)
|
||||||
|
{
|
||||||
var sr = new StreamReader (typeof (Driver).Assembly.GetManifestResourceStream (streamName));
|
var sr = new StreamReader (typeof (Driver).Assembly.GetManifestResourceStream (streamName));
|
||||||
var all = sr.ReadToEnd ();
|
var all = sr.ReadToEnd ();
|
||||||
var config = Path.Combine (mmp_dir, outputFileName);
|
var config = Path.Combine (mmp_dir, outputFileName);
|
||||||
|
@ -1512,7 +1511,8 @@ namespace Xamarin.Bundler {
|
||||||
resolved_assemblies.Add (Path.Combine (fx_dir, "I18N.West.dll"));
|
resolved_assemblies.Add (Path.Combine (fx_dir, "I18N.West.dll"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyFileAndRemoveReadOnly (string src, string dest) {
|
static void CopyFileAndRemoveReadOnly (string src, string dest)
|
||||||
|
{
|
||||||
File.Copy (src, dest, true);
|
File.Copy (src, dest, true);
|
||||||
|
|
||||||
FileAttributes attrs = File.GetAttributes (dest);
|
FileAttributes attrs = File.GetAttributes (dest);
|
||||||
|
@ -1520,7 +1520,8 @@ namespace Xamarin.Bundler {
|
||||||
File.SetAttributes (dest, attrs & ~FileAttributes.ReadOnly);
|
File.SetAttributes (dest, attrs & ~FileAttributes.ReadOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyAssemblies () {
|
static void CopyAssemblies ()
|
||||||
|
{
|
||||||
foreach (string asm in resolved_assemblies) {
|
foreach (string asm in resolved_assemblies) {
|
||||||
var configfile = string.Format ("{0}.config", asm);
|
var configfile = string.Format ("{0}.config", asm);
|
||||||
string filename = Path.GetFileName (asm);
|
string filename = Path.GetFileName (asm);
|
||||||
|
@ -1546,13 +1547,15 @@ namespace Xamarin.Bundler {
|
||||||
assembly.CopySatellitesToDirectory (mmp_dir);
|
assembly.CopySatellitesToDirectory (mmp_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyResources () {
|
static void CopyResources ()
|
||||||
|
{
|
||||||
foreach (string res in resources) {
|
foreach (string res in resources) {
|
||||||
File.Copy (res, Path.Combine (resources_dir, Path.GetFileName (res)), true);
|
File.Copy (res, Path.Combine (resources_dir, Path.GetFileName (res)), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GatherAssemblies () {
|
static void GatherAssemblies ()
|
||||||
|
{
|
||||||
foreach (string asm in App.References) {
|
foreach (string asm in App.References) {
|
||||||
AssemblyDefinition assembly = AddAssemblyPathToResolver (asm);
|
AssemblyDefinition assembly = AddAssemblyPathToResolver (asm);
|
||||||
ProcessAssemblyReferences (assembly);
|
ProcessAssemblyReferences (assembly);
|
||||||
|
@ -1561,7 +1564,8 @@ namespace Xamarin.Bundler {
|
||||||
throw new AggregateException (BuildTarget.Resolver.Exceptions);
|
throw new AggregateException (BuildTarget.Resolver.Exceptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessAssemblyReferences (AssemblyDefinition assembly) {
|
static void ProcessAssemblyReferences (AssemblyDefinition assembly)
|
||||||
|
{
|
||||||
if (assembly == null)
|
if (assembly == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1569,7 +1573,7 @@ namespace Xamarin.Bundler {
|
||||||
|
|
||||||
if (resolved_assemblies.Contains (fqname))
|
if (resolved_assemblies.Contains (fqname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Target.PrintAssemblyReferences (assembly);
|
Target.PrintAssemblyReferences (assembly);
|
||||||
|
|
||||||
var asm = BuildTarget.AddAssembly (assembly);
|
var asm = BuildTarget.AddAssembly (assembly);
|
||||||
|
@ -1630,11 +1634,11 @@ namespace Xamarin.Bundler {
|
||||||
var abi = Driver.App.Abi;
|
var abi = Driver.App.Abi;
|
||||||
var arch = abi.AsArchString ();
|
var arch = abi.AsArchString ();
|
||||||
switch (abi) {
|
switch (abi) {
|
||||||
case Abi.x86_64:
|
case Abi.x86_64:
|
||||||
case Abi.ARM64:
|
case Abi.ARM64:
|
||||||
return Path.Combine (Driver.GetFrameworkLibDirectory (Driver.App), "64bits", flavor, name + ".dll");
|
return Path.Combine (Driver.GetFrameworkLibDirectory (Driver.App), "64bits", flavor, name + ".dll");
|
||||||
default:
|
default:
|
||||||
throw new ProductException (5205, true, Errors.MM5205, arch);
|
throw new ProductException (5205, true, Errors.MM5205, arch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ using Mono.Tuner;
|
||||||
using Xamarin.Linker;
|
using Xamarin.Linker;
|
||||||
|
|
||||||
namespace MonoMac.Tuner {
|
namespace MonoMac.Tuner {
|
||||||
|
|
||||||
public class MacRemoveResources : RemoveResources {
|
public class MacRemoveResources : RemoveResources {
|
||||||
|
|
||||||
public MacRemoveResources (LinkerOptions options) :
|
public MacRemoveResources (LinkerOptions options) :
|
||||||
base (options.I18nAssemblies)
|
base (options.I18nAssemblies)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -30,13 +30,13 @@ namespace MonoMac.Tuner {
|
||||||
Process ("System", ProcessSystem);
|
Process ("System", ProcessSystem);
|
||||||
Process ("System.Drawing", ProcessSystemDrawing);
|
Process ("System.Drawing", ProcessSystemDrawing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process (string assemblyName, Action<AssemblyDefinition> process)
|
void Process (string assemblyName, Action<AssemblyDefinition> process)
|
||||||
{
|
{
|
||||||
AssemblyDefinition assembly;
|
AssemblyDefinition assembly;
|
||||||
if (!Context.TryGetLinkedAssembly (assemblyName, out assembly))
|
if (!Context.TryGetLinkedAssembly (assemblyName, out assembly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Context.Annotations.GetAction (assembly) == AssemblyAction.Link)
|
if (Context.Annotations.GetAction (assembly) == AssemblyAction.Link)
|
||||||
process (assembly);
|
process (assembly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// adapted from xtouch/tools/mtouch/Touch.Tuner/ManualMarkStep.cs
|
// adapted from xtouch/tools/mtouch/Touch.Tuner/ManualMarkStep.cs
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Mono.Cecil;
|
using Mono.Cecil;
|
||||||
using Mono.Linker;
|
using Mono.Linker;
|
||||||
using Xamarin.Bundler;
|
using Xamarin.Bundler;
|
||||||
|
@ -58,10 +58,10 @@ namespace MonoMac.Tuner {
|
||||||
ProcessXamarinMac (type);
|
ProcessXamarinMac (type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: we could be more precise (per field) but that would require a lot more maintenance for a very small gain
|
// FIXME: we could be more precise (per field) but that would require a lot more maintenance for a very small gain
|
||||||
void ProcessSystem (TypeDefinition type)
|
void ProcessSystem (TypeDefinition type)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ namespace MonoMac.Tuner {
|
||||||
|
|
||||||
// FIXME: this is the non-MOBILE version
|
// FIXME: this is the non-MOBILE version
|
||||||
if (true) { // Mono.Tuner.Profile.Current is MobileProfile)
|
if (true) { // Mono.Tuner.Profile.Current is MobileProfile)
|
||||||
// limited machine.config support
|
// limited machine.config support
|
||||||
WebRequestConfiguration ();
|
WebRequestConfiguration ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -85,14 +85,14 @@ namespace MonoMac.Tuner {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRequestConfiguration ()
|
void WebRequestConfiguration ()
|
||||||
{
|
{
|
||||||
// MarkMethods is used because the default .ctor is needed by Activation.Create
|
// MarkMethods is used because the default .ctor is needed by Activation.Create
|
||||||
MarkMethods (GetType ("System.Configuration", "System.Configuration.ExeConfigurationHost"));
|
MarkMethods (GetType ("System.Configuration", "System.Configuration.ExeConfigurationHost"));
|
||||||
|
|
||||||
AssemblyDefinition system = GetAssembly ("System");
|
AssemblyDefinition system = GetAssembly ("System");
|
||||||
|
|
||||||
// types we could directly infer from machine.config
|
// types we could directly infer from machine.config
|
||||||
MarkMethods (GetType (system, "System.Net.Configuration.DefaultProxySection"));
|
MarkMethods (GetType (system, "System.Net.Configuration.DefaultProxySection"));
|
||||||
MarkMethods (GetType (system, "System.Net.Configuration.NetSectionGroup"));
|
MarkMethods (GetType (system, "System.Net.Configuration.NetSectionGroup"));
|
||||||
|
@ -101,7 +101,7 @@ namespace MonoMac.Tuner {
|
||||||
MarkMethods (GetType (system, "System.Net.HttpRequestCreator"));
|
MarkMethods (GetType (system, "System.Net.HttpRequestCreator"));
|
||||||
MarkMethods (GetType (system, "System.Net.FileWebRequestCreator"));
|
MarkMethods (GetType (system, "System.Net.FileWebRequestCreator"));
|
||||||
MarkMethods (GetType (system, "System.Net.FtpWebRequestCreator"));
|
MarkMethods (GetType (system, "System.Net.FtpWebRequestCreator"));
|
||||||
|
|
||||||
// types we cannot find (statiscally or using machine.config)
|
// types we cannot find (statiscally or using machine.config)
|
||||||
MarkMethods (GetType (system, "System.ComponentModel.BooleanConverter"));
|
MarkMethods (GetType (system, "System.ComponentModel.BooleanConverter"));
|
||||||
MarkMethods (GetType (system, "System.ComponentModel.CollectionConverter"));
|
MarkMethods (GetType (system, "System.ComponentModel.CollectionConverter"));
|
||||||
|
|
|
@ -30,10 +30,10 @@ using Mono.Linker;
|
||||||
|
|
||||||
namespace Xamarin.Bundler {
|
namespace Xamarin.Bundler {
|
||||||
public partial class MonoMacResolver : CoreResolver {
|
public partial class MonoMacResolver : CoreResolver {
|
||||||
public List <string> CommandLineAssemblies { get; set; }
|
public List<string> CommandLineAssemblies { get; set; }
|
||||||
public List<Exception> Exceptions = new List<Exception> ();
|
public List<Exception> Exceptions = new List<Exception> ();
|
||||||
public string GlobalAssemblyCache;
|
public string GlobalAssemblyCache;
|
||||||
public string[] SystemFrameworkDirectories;
|
public string [] SystemFrameworkDirectories;
|
||||||
|
|
||||||
public AssemblyDefinition GetAssembly (string fileName)
|
public AssemblyDefinition GetAssembly (string fileName)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace Xamarin.Bundler {
|
||||||
AssemblyDefinition assembly;
|
AssemblyDefinition assembly;
|
||||||
if (cache.TryGetValue (name, out assembly))
|
if (cache.TryGetValue (name, out assembly))
|
||||||
return assembly;
|
return assembly;
|
||||||
|
|
||||||
if (CommandLineAssemblies != null && CommandLineAssemblies.Count > 0) {
|
if (CommandLineAssemblies != null && CommandLineAssemblies.Count > 0) {
|
||||||
string cmdasm = CommandLineAssemblies.Find (t => {
|
string cmdasm = CommandLineAssemblies.Find (t => {
|
||||||
if (String.IsNullOrEmpty (t))
|
if (String.IsNullOrEmpty (t))
|
||||||
|
@ -64,7 +64,7 @@ namespace Xamarin.Bundler {
|
||||||
if (assembly != null)
|
if (assembly != null)
|
||||||
return assembly;
|
return assembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
assembly = SearchDirectory (name, FrameworkDirectory);
|
assembly = SearchDirectory (name, FrameworkDirectory);
|
||||||
if (assembly != null)
|
if (assembly != null)
|
||||||
return assembly;
|
return assembly;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче