[autoformat] Add mmp.csproj. (#16313)
This commit is contained in:
Родитель
a047ce5cf3
Коммит
ee7e95dd69
|
@ -20,19 +20,16 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace ObjCRuntime
|
||||
{
|
||||
namespace ObjCRuntime {
|
||||
[Flags]
|
||||
public enum PlatformArchitecture : byte
|
||||
{
|
||||
public enum PlatformArchitecture : byte {
|
||||
None = 0x00,
|
||||
Arch32 = 0x01,
|
||||
Arch64 = 0x02,
|
||||
All = 0xff
|
||||
}
|
||||
|
||||
public enum PlatformName : byte
|
||||
{
|
||||
public enum PlatformName : byte {
|
||||
None,
|
||||
MacOSX,
|
||||
iOS,
|
||||
|
@ -43,8 +40,7 @@ namespace ObjCRuntime
|
|||
UIKitForMac = MacCatalyst, // temporary
|
||||
}
|
||||
|
||||
public enum AvailabilityKind
|
||||
{
|
||||
public enum AvailabilityKind {
|
||||
Introduced,
|
||||
Deprecated,
|
||||
Obsoleted,
|
||||
|
@ -65,8 +61,7 @@ namespace ObjCRuntime
|
|||
AttributeTargets.Struct,
|
||||
AllowMultiple = true
|
||||
)]
|
||||
public abstract class AvailabilityBaseAttribute : Attribute
|
||||
{
|
||||
public abstract class AvailabilityBaseAttribute : Attribute {
|
||||
public AvailabilityKind AvailabilityKind { get; private set; }
|
||||
public PlatformName Platform { get; private set; }
|
||||
public Version Version { get; private set; }
|
||||
|
@ -113,8 +108,7 @@ namespace ObjCRuntime
|
|||
}
|
||||
}
|
||||
|
||||
public class IntroducedAttribute : AvailabilityBaseAttribute
|
||||
{
|
||||
public class IntroducedAttribute : AvailabilityBaseAttribute {
|
||||
public IntroducedAttribute (PlatformName platform,
|
||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||
string message = null)
|
||||
|
@ -141,8 +135,7 @@ namespace ObjCRuntime
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class DeprecatedAttribute : AvailabilityBaseAttribute
|
||||
{
|
||||
public sealed class DeprecatedAttribute : AvailabilityBaseAttribute {
|
||||
public DeprecatedAttribute (PlatformName platform,
|
||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||
string message = null)
|
||||
|
@ -169,8 +162,7 @@ namespace ObjCRuntime
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class ObsoletedAttribute : AvailabilityBaseAttribute
|
||||
{
|
||||
public sealed class ObsoletedAttribute : AvailabilityBaseAttribute {
|
||||
public ObsoletedAttribute (PlatformName platform,
|
||||
PlatformArchitecture architecture = PlatformArchitecture.None,
|
||||
string message = null)
|
||||
|
@ -197,8 +189,7 @@ namespace ObjCRuntime
|
|||
}
|
||||
}
|
||||
|
||||
public class UnavailableAttribute : AvailabilityBaseAttribute
|
||||
{
|
||||
public class UnavailableAttribute : AvailabilityBaseAttribute {
|
||||
public UnavailableAttribute (PlatformName platform,
|
||||
PlatformArchitecture architecture = PlatformArchitecture.All,
|
||||
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)
|
||||
: 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.")]
|
||||
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)
|
||||
: 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.")]
|
||||
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)
|
||||
: 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
|
||||
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)
|
||||
: 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
|
||||
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)
|
||||
: 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 ()
|
||||
: base (PlatformName.MacOSX)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NoiOSAttribute : UnavailableAttribute
|
||||
{
|
||||
public sealed class NoiOSAttribute : UnavailableAttribute {
|
||||
public NoiOSAttribute ()
|
||||
: base (PlatformName.iOS)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NoWatchAttribute : UnavailableAttribute
|
||||
{
|
||||
public sealed class NoWatchAttribute : UnavailableAttribute {
|
||||
public NoWatchAttribute ()
|
||||
: base (PlatformName.WatchOS)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NoTVAttribute : UnavailableAttribute
|
||||
{
|
||||
public sealed class NoTVAttribute : UnavailableAttribute {
|
||||
public NoTVAttribute ()
|
||||
: base (PlatformName.TvOS)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NoMacCatalystAttribute : UnavailableAttribute
|
||||
{
|
||||
public sealed class NoMacCatalystAttribute : UnavailableAttribute {
|
||||
public NoMacCatalystAttribute ()
|
||||
: base (PlatformName.MacCatalyst)
|
||||
{
|
||||
|
|
|
@ -56,12 +56,10 @@ using ProductException=ObjCRuntime.RuntimeException;
|
|||
//
|
||||
|
||||
#if MONOMAC
|
||||
namespace ObjCRuntime
|
||||
{
|
||||
namespace ObjCRuntime {
|
||||
public delegate void AssemblyRegistrationHandler (object sender, AssemblyRegistrationEventArgs args);
|
||||
|
||||
public class AssemblyRegistrationEventArgs : EventArgs
|
||||
{
|
||||
public class AssemblyRegistrationEventArgs : EventArgs {
|
||||
public bool Register { get; 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/Xamarin.iOS.Tasks.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/u2ignore/u2ignore.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)
|
||||
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.
|
||||
|
||||
|
@ -115,8 +115,7 @@ namespace Xamarin.Bundler {
|
|||
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 ("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 {
|
||||
if (!string.IsNullOrEmpty (v)) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
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 {
|
||||
if (!string.IsNullOrEmpty (v)) {
|
||||
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 ("tls-provider=", "Specify the default TLS provider.", v => { app.TlsProvider = v; });
|
||||
options.Add ("setenv=", "Set the environment variable in the application on startup.", v => {
|
||||
int eq = v.IndexOf ('=');
|
||||
if (eq <= 0)
|
||||
throw ErrorHelper.CreateError (2, Errors.MT0002, v);
|
||||
var name = v.Substring (0, eq);
|
||||
var value = v.Substring (eq + 1);
|
||||
app.EnvironmentVariables.Add (name, value);
|
||||
}
|
||||
int eq = v.IndexOf ('=');
|
||||
if (eq <= 0)
|
||||
throw ErrorHelper.CreateError (2, Errors.MT0002, v);
|
||||
var name = v.Substring (0, eq);
|
||||
var value = v.Substring (eq + 1);
|
||||
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 => {
|
||||
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. */);
|
||||
|
||||
if (targetFramework == TargetFramework.Net_2_0
|
||||
|| targetFramework == TargetFramework.Net_3_0
|
||||
|| targetFramework == TargetFramework.Net_3_0
|
||||
|| targetFramework == TargetFramework.Net_3_5
|
||||
|| targetFramework == TargetFramework.Net_4_0
|
||||
|| targetFramework == TargetFramework.Net_4_5) {
|
||||
|
|
|
@ -53,8 +53,7 @@ namespace MonoMac.Tuner {
|
|||
return ae;
|
||||
case ProductException pe:
|
||||
return pe;
|
||||
case MarkException me:
|
||||
{
|
||||
case MarkException me: {
|
||||
var re = me.InnerException as ResolutionException;
|
||||
if (re == 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);
|
||||
}
|
||||
}
|
||||
case ResolutionException re:
|
||||
{
|
||||
case ResolutionException re: {
|
||||
TypeReference tr = (re.Member as TypeReference);
|
||||
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);
|
||||
|
|
|
@ -9,6 +9,6 @@ namespace Xamarin.Linker {
|
|||
public abstract class BaseProfile : Profile {
|
||||
|
||||
// return assembly name without extension (.dll)
|
||||
public abstract string ProductAssembly { get ; }
|
||||
public abstract string ProductAssembly { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,8 +239,8 @@ namespace Xamarin.Linker.Steps {
|
|||
{
|
||||
if (processing_generated_dispose) {
|
||||
switch (instruction.OpCode.OperandType) {
|
||||
case OperandType.InlineField:
|
||||
case OperandType.InlineTok:
|
||||
case OperandType.InlineField:
|
||||
case OperandType.InlineTok:
|
||||
if (SkipField (instruction.Operand as FieldDefinition))
|
||||
return;
|
||||
break;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Xamarin.Linker {
|
|||
switch (attr_type.Name) {
|
||||
case "AdviceAttribute":
|
||||
case "FieldAttribute":
|
||||
case "PreserveAttribute": // the ApplyPreserveAttribute substep is executed before this
|
||||
case "PreserveAttribute": // the ApplyPreserveAttribute substep is executed before this
|
||||
case "LinkerSafeAttribute":
|
||||
return attr_type.Namespace == Namespaces.Foundation;
|
||||
// used for documentation, not at runtime
|
||||
|
@ -69,7 +69,7 @@ namespace Xamarin.Linker {
|
|||
var attr_type = attribute.Constructor.DeclaringType;
|
||||
if (attr_type.Namespace == Namespaces.ObjCRuntime) {
|
||||
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 "DeprecatedAttribute":
|
||||
case "IntroducedAttribute":
|
||||
|
|
|
@ -251,8 +251,8 @@ namespace Xamarin.Linker.Steps {
|
|||
switch (type.Namespace) {
|
||||
case "System.Runtime.CompilerServices":
|
||||
switch (type.Name) {
|
||||
case "AsyncTaskMethodBuilder":
|
||||
case "AsyncTaskMethodBuilder`1":
|
||||
case "AsyncTaskMethodBuilder":
|
||||
case "AsyncTaskMethodBuilder`1":
|
||||
if (DebugBuild) {
|
||||
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
|
||||
MarkNamedMethod (type, "get_ObjectIdForDebugger");
|
||||
|
@ -262,7 +262,7 @@ namespace Xamarin.Linker.Steps {
|
|||
break;
|
||||
case "System.Threading.Tasks":
|
||||
switch (type.Name) {
|
||||
case "Task":
|
||||
case "Task":
|
||||
if (DebugBuild)
|
||||
MarkNamedMethod (type, "NotifyDebuggerOfWaitCompletion");
|
||||
break;
|
||||
|
|
|
@ -74,11 +74,11 @@ namespace MonoTouch.Tuner {
|
|||
if (attrib.ConstructorArguments.Count != 2)
|
||||
continue;
|
||||
|
||||
var libraryName = (string) attrib.ConstructorArguments[1].Value;
|
||||
var libraryName = (string) attrib.ConstructorArguments [1].Value;
|
||||
if (libraryName != "__Internal")
|
||||
continue;
|
||||
|
||||
return (string) attrib.ConstructorArguments[0].Value;
|
||||
return (string) attrib.ConstructorArguments [0].Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -2,8 +2,7 @@ using System;
|
|||
using System.Linq;
|
||||
|
||||
namespace Xamarin.Bundler {
|
||||
public partial class Application
|
||||
{
|
||||
public partial class Application {
|
||||
public string ProductName = "Xamarin.Mac";
|
||||
public AOTOptions AOTOptions;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.IO;
|
||||
|
||||
namespace Xamarin.Bundler {
|
||||
public partial class Assembly
|
||||
{
|
||||
public partial class Assembly {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace Xamarin.Bundler
|
||||
{
|
||||
partial class Target
|
||||
{
|
||||
namespace Xamarin.Bundler {
|
||||
partial class Target {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,16 +192,14 @@ namespace MonoMac.Tuner {
|
|||
using (StreamReader sr = new StreamReader (filename)) {
|
||||
return new ResolveFromXmlStep (new XPathDocument (new StringReader (sr.ReadToEnd ())));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new ProductException (2005, true, e, Errors.MX2005, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CustomizeMacActions : CustomizeCoreActions
|
||||
{
|
||||
public class CustomizeMacActions : CustomizeCoreActions {
|
||||
LinkMode link_mode;
|
||||
|
||||
public CustomizeMacActions (LinkMode mode, IEnumerable<string> skipped_assemblies)
|
||||
|
@ -235,15 +233,13 @@ namespace MonoMac.Tuner {
|
|||
|
||||
try {
|
||||
base.ProcessAssembly (assembly);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new ProductException (2103, true, e, Errors.MX2103, assembly.FullName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LoadOptionalReferencesStep : LoadReferencesStep
|
||||
{
|
||||
class LoadOptionalReferencesStep : LoadReferencesStep {
|
||||
HashSet<AssemblyNameDefinition> _references = new HashSet<AssemblyNameDefinition> ();
|
||||
|
||||
protected override void ProcessAssembly (AssemblyDefinition assembly)
|
||||
|
|
|
@ -36,14 +36,12 @@ using Profile = Mono.Tuner.Profile;
|
|||
|
||||
namespace Xamarin.Bundler {
|
||||
|
||||
public interface IFileEnumerator
|
||||
{
|
||||
public interface IFileEnumerator {
|
||||
IEnumerable<string> Files { get; }
|
||||
string RootDir { get; }
|
||||
}
|
||||
|
||||
public class FileSystemEnumerator : IFileEnumerator
|
||||
{
|
||||
public class FileSystemEnumerator : IFileEnumerator {
|
||||
DirectoryInfo Info;
|
||||
public IEnumerable<string> Files => Info.GetFiles ().Select (x => x.FullName);
|
||||
public string RootDir { get; private set; }
|
||||
|
@ -78,23 +76,22 @@ namespace Xamarin.Bundler {
|
|||
Hybrid
|
||||
}
|
||||
|
||||
public class AOTOptions
|
||||
{
|
||||
public class AOTOptions {
|
||||
public bool IsAOT => CompilationType != AOTCompilationType.Default && CompilationType != AOTCompilationType.None;
|
||||
public bool IsHybridAOT => IsAOT && Kind == AOTKind.Hybrid;
|
||||
|
||||
public AOTCompilationType CompilationType { get; private set; } = AOTCompilationType.Default;
|
||||
public AOTKind Kind { get; private set; } = AOTKind.Standard;
|
||||
|
||||
public List <string> IncludedAssemblies { get; private set; } = new List <string> ();
|
||||
public List <string> ExcludedAssemblies { 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 AOTOptions (string options)
|
||||
{
|
||||
// Syntax - all,core,sdk,none or "" if explicit then optional list of +/-'ed assemblies
|
||||
// Sections seperated by ,
|
||||
string [] optionParts = options.Split (',');
|
||||
for (int i = 0 ; i < optionParts.Length ; ++i) {
|
||||
for (int i = 0; i < optionParts.Length; ++i) {
|
||||
string option = optionParts [i];
|
||||
|
||||
AOTKind kind = AOTKind.Default;
|
||||
|
@ -172,8 +169,7 @@ namespace Xamarin.Bundler {
|
|||
}
|
||||
}
|
||||
|
||||
public class AOTCompiler
|
||||
{
|
||||
public class AOTCompiler {
|
||||
// Allows tests to stub out actual compilation and parallelism
|
||||
public RunCommandDelegate RunCommand { get; set; } = Driver.RunCommand;
|
||||
public ParallelOptions ParallelOptions { get; set; } = new ParallelOptions () { MaxDegreeOfParallelism = Driver.Concurrency };
|
||||
|
@ -196,7 +192,7 @@ namespace Xamarin.Bundler {
|
|||
bool IsRelease;
|
||||
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.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 abi = tuple.Item2;
|
||||
|
||||
var cmd = new List <string> ();
|
||||
var aotArgs = new List <string> ();
|
||||
var cmd = new List<string> ();
|
||||
var aotArgs = new List<string> ();
|
||||
aotArgs.Add ($"mtriple={abi.AsArchString ()}");
|
||||
if (options.IsHybridAOT)
|
||||
aotArgs.Add ("hybrid");
|
||||
|
@ -286,11 +282,11 @@ namespace Xamarin.Bundler {
|
|||
List<string> GetFilesToAOT (IFileEnumerator files)
|
||||
{
|
||||
// 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)
|
||||
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)
|
||||
excludedAssemblies [item] = false;
|
||||
|
||||
|
@ -329,7 +325,7 @@ namespace Xamarin.Bundler {
|
|||
case AOTCompilationType.Explicit:
|
||||
break; // In explicit, only included includedAssemblies included
|
||||
default:
|
||||
throw ErrorHelper.CreateError (0099, Errors.MX0099, $"\"GetFilesToAOT with aot: {options.CompilationType}\"" );
|
||||
throw ErrorHelper.CreateError (0099, Errors.MX0099, $"\"GetFilesToAOT with aot: {options.CompilationType}\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 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 ("Copyright 2010 Novell Inc.");
|
||||
Console.WriteLine ("Copyright 2011-2016 Xamarin Inc.");
|
||||
|
@ -255,9 +256,9 @@ namespace Xamarin.Bundler {
|
|||
// 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
|
||||
// copies. So we redirect to the "real" ones. Thanks TargetFrameworkDirectories :(
|
||||
Regex monoAPIRegex = new Regex("lib/mono/.*-api/", 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/"));
|
||||
Regex monoAPIRegex = new Regex ("lib/mono/.*-api/", 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/"));
|
||||
}
|
||||
|
||||
if (App.Registrar == RegistrarMode.PartialStatic && App.LinkMode != LinkMode.None)
|
||||
|
@ -562,8 +563,7 @@ namespace Xamarin.Bundler {
|
|||
native_libs [kvp.Key] = methods;
|
||||
}
|
||||
methods.AddRange (kvp.Value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
native_libs.Add (kvp.Key, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
@ -632,8 +632,7 @@ namespace Xamarin.Bundler {
|
|||
if (Application.UpdateFile (src, temp_dest))
|
||||
LipoLibrary (name, temp_dest);
|
||||
Application.UpdateFile (temp_dest, dest);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// we can directly update the dest
|
||||
Application.UpdateFile (src, dest);
|
||||
}
|
||||
|
@ -668,12 +667,13 @@ 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 all = sr.ReadToEnd ();
|
||||
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");
|
||||
using (var sw = new StreamWriter (path)){
|
||||
using (var sw = new StreamWriter (path)) {
|
||||
sw.WriteLine (
|
||||
all.Replace ("@BUNDLEDISPLAYNAME@", app_name).
|
||||
Replace ("@EXECUTABLE@", app_name).
|
||||
|
@ -687,7 +687,8 @@ namespace Xamarin.Bundler {
|
|||
|
||||
// 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)
|
||||
static void CodeSign () {
|
||||
static void CodeSign ()
|
||||
{
|
||||
RunCommand ("codesign", String.Format ("-v -s \"{0}\" \"{1}\"", certificate_name, App.AppDirectory));
|
||||
}
|
||||
|
||||
|
@ -712,8 +713,7 @@ namespace Xamarin.Bundler {
|
|||
return path;
|
||||
else
|
||||
return Marshal.PtrToStringAuto (buffer);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (buffer != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal (buffer);
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ namespace Xamarin.Bundler {
|
|||
throw new ProductException (5203, true, Errors.MM5203, libxammac);
|
||||
|
||||
try {
|
||||
List <string> compiledExecutables = new List <string> ();
|
||||
List<string> compiledExecutables = new List<string> ();
|
||||
foreach (var abi in App.Abis) {
|
||||
var abiDir = Path.Combine (App.Cache.Location, "main", abi.AsArchString ());
|
||||
|
||||
|
@ -823,7 +823,7 @@ namespace Xamarin.Bundler {
|
|||
var main = Path.Combine (abiDir, $"main.m");
|
||||
BuildTarget.GenerateMain (ApplePlatform.MacOSX, abi, main, null);
|
||||
|
||||
var args = new List <string> ();
|
||||
var args = new List<string> ();
|
||||
if (App.EnableDebug)
|
||||
args.Add ("-g");
|
||||
if (App.Embeddinator) {
|
||||
|
@ -845,7 +845,7 @@ namespace Xamarin.Bundler {
|
|||
args.Add ("-std=c++14");
|
||||
|
||||
bool appendedObjc = false;
|
||||
var sourceFiles = new List <string> ();
|
||||
var sourceFiles = new List<string> ();
|
||||
foreach (var assembly in BuildTarget.Assemblies) {
|
||||
if (assembly.LinkWith != null) {
|
||||
foreach (var linkWith in assembly.LinkWith) {
|
||||
|
@ -1074,7 +1074,7 @@ namespace Xamarin.Bundler {
|
|||
throw new AggregateException (exceptions);
|
||||
}
|
||||
|
||||
static IDictionary<string,List<MethodDefinition>> Link ()
|
||||
static IDictionary<string, List<MethodDefinition>> Link ()
|
||||
{
|
||||
var cache = (Dictionary<string, AssemblyDefinition>) BuildTarget.Resolver.ResolverCache;
|
||||
AssemblyResolver resolver;
|
||||
|
@ -1102,8 +1102,7 @@ namespace Xamarin.Bundler {
|
|||
I18nAssemblies = App.I18n,
|
||||
ExtraDefinitions = App.Definitions,
|
||||
RuntimeOptions = App.RuntimeOptions,
|
||||
MarshalNativeExceptionsState = !App.RequiresPInvokeWrappers ? null : new PInvokeWrapperGenerator ()
|
||||
{
|
||||
MarshalNativeExceptionsState = !App.RequiresPInvokeWrappers ? null : new PInvokeWrapperGenerator () {
|
||||
App = App,
|
||||
SourcePath = Path.Combine (App.Cache.Location, "pinvokes.m"),
|
||||
HeaderPath = Path.Combine (App.Cache.Location, "pinvokes.h"),
|
||||
|
@ -1188,7 +1187,7 @@ namespace Xamarin.Bundler {
|
|||
if (lib.StartsWith (Path.GetDirectoryName (MonoPrefix), StringComparison.Ordinal)) {
|
||||
string libname = Path.GetFileName (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 (libname != real_libname)
|
||||
CreateSymLink (mmp_dir, real_libname, libname);
|
||||
|
@ -1226,31 +1225,31 @@ namespace Xamarin.Bundler {
|
|||
|
||||
// well known libraries we do not bundle or warn about
|
||||
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 "__internal": // mono runtime
|
||||
case "kernel32": // windows specific
|
||||
case "gdi32": // windows specific
|
||||
case "ole32": // windows specific
|
||||
case "user32": // windows specific
|
||||
case "advapi32": // windows specific
|
||||
case "crypt32": // windows specific
|
||||
case "msvcrt": // windows specific
|
||||
case "iphlpapi": // windows specific
|
||||
case "winmm": // windows specific
|
||||
case "winspool": // windows specific
|
||||
case "c": // system provided
|
||||
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 "kernel32": // windows specific
|
||||
case "gdi32": // windows specific
|
||||
case "ole32": // windows specific
|
||||
case "user32": // windows specific
|
||||
case "advapi32": // windows specific
|
||||
case "crypt32": // windows specific
|
||||
case "msvcrt": // windows specific
|
||||
case "iphlpapi": // windows specific
|
||||
case "winmm": // windows specific
|
||||
case "winspool": // windows specific
|
||||
case "c": // system provided
|
||||
case "objc": // system provided
|
||||
case "objc.a": // found in swift core libraries
|
||||
case "system.b": // found in swift core libraries
|
||||
case "system": // system provided, libSystem.dylib -> CommonCrypto
|
||||
case "x11": // msvcrt pulled in
|
||||
case "winspool.drv": // msvcrt pulled in
|
||||
case "cups": // msvcrt pulled in
|
||||
case "fam.so.0": // msvcrt pulled in
|
||||
case "gamin-1.so.0": // msvcrt pulled in
|
||||
case "asound.so.2": // msvcrt pulled in
|
||||
case "objc.a": // found in swift core libraries
|
||||
case "system.b": // found in swift core libraries
|
||||
case "system": // system provided, libSystem.dylib -> CommonCrypto
|
||||
case "x11": // msvcrt pulled in
|
||||
case "winspool.drv": // msvcrt pulled in
|
||||
case "cups": // msvcrt pulled in
|
||||
case "fam.so.0": // msvcrt pulled in
|
||||
case "gamin-1.so.0": // msvcrt pulled in
|
||||
case "asound.so.2": // msvcrt pulled in
|
||||
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.net.security.native": // same
|
||||
return true;
|
||||
|
@ -1327,8 +1326,7 @@ namespace Xamarin.Bundler {
|
|||
|
||||
if (GetRealPath (dest) == 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
|
||||
CopyFileAndRemoveReadOnly (real_src, dest);
|
||||
}
|
||||
|
@ -1380,7 +1378,7 @@ namespace Xamarin.Bundler {
|
|||
|
||||
var prefix = new [] { dest };
|
||||
var suffix = new [] { "-output", dest };
|
||||
List <string> archArgs = new List <string> ();
|
||||
List<string> archArgs = new List<string> ();
|
||||
foreach (var abi in App.Abis) {
|
||||
archArgs.Add ("-extract_family");
|
||||
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 */
|
||||
static void CreateDirectoriesIfNeeded () {
|
||||
static void CreateDirectoriesIfNeeded ()
|
||||
{
|
||||
if (App.Embeddinator) {
|
||||
App.AppDirectory = Path.Combine (output_dir, app_name + ".framework");
|
||||
contents_dir = Path.Combine (App.AppDirectory, "Versions", "A");
|
||||
|
@ -1441,20 +1440,20 @@ namespace Xamarin.Bundler {
|
|||
PathUtils.CreateSymlink (file, target);
|
||||
}
|
||||
|
||||
static void CreateDirectoryIfNeeded (string dir) {
|
||||
static void CreateDirectoryIfNeeded (string dir)
|
||||
{
|
||||
if (!Directory.Exists (dir))
|
||||
Directory.CreateDirectory (dir);
|
||||
}
|
||||
|
||||
static void CopyConfiguration () {
|
||||
static void CopyConfiguration ()
|
||||
{
|
||||
if (IsUnifiedMobile) {
|
||||
CopyResourceFile ("config_mobile", "config");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (IsUnifiedFullXamMacFramework) {
|
||||
CopyResourceFile ("machine.4_5.config", "machine.config");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
string machine_config = Path.Combine (MonoDirectory, "etc", "mono", "4.5", "machine.config");
|
||||
|
||||
if (!File.Exists (machine_config))
|
||||
|
@ -1473,8 +1472,7 @@ namespace Xamarin.Bundler {
|
|||
CreateDirectoryIfNeeded (machineConfigDestDir);
|
||||
if (machine_config_path == String.Empty) {
|
||||
File.WriteAllLines (machineConfigDestFile, new string [] { "<?xml version=\"1.0\" encoding=\"utf-8\"?>", "<configuration>", "</configuration>" });
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!File.Exists (machine_config_path))
|
||||
throw new ProductException (97, true, Errors.MM0097, machine_config_path);
|
||||
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 all = sr.ReadToEnd ();
|
||||
var config = Path.Combine (mmp_dir, outputFileName);
|
||||
|
@ -1512,7 +1511,8 @@ namespace Xamarin.Bundler {
|
|||
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);
|
||||
|
||||
FileAttributes attrs = File.GetAttributes (dest);
|
||||
|
@ -1520,7 +1520,8 @@ namespace Xamarin.Bundler {
|
|||
File.SetAttributes (dest, attrs & ~FileAttributes.ReadOnly);
|
||||
}
|
||||
|
||||
static void CopyAssemblies () {
|
||||
static void CopyAssemblies ()
|
||||
{
|
||||
foreach (string asm in resolved_assemblies) {
|
||||
var configfile = string.Format ("{0}.config", asm);
|
||||
string filename = Path.GetFileName (asm);
|
||||
|
@ -1546,13 +1547,15 @@ namespace Xamarin.Bundler {
|
|||
assembly.CopySatellitesToDirectory (mmp_dir);
|
||||
}
|
||||
|
||||
static void CopyResources () {
|
||||
static void CopyResources ()
|
||||
{
|
||||
foreach (string res in resources) {
|
||||
File.Copy (res, Path.Combine (resources_dir, Path.GetFileName (res)), true);
|
||||
}
|
||||
}
|
||||
|
||||
static void GatherAssemblies () {
|
||||
static void GatherAssemblies ()
|
||||
{
|
||||
foreach (string asm in App.References) {
|
||||
AssemblyDefinition assembly = AddAssemblyPathToResolver (asm);
|
||||
ProcessAssemblyReferences (assembly);
|
||||
|
@ -1561,7 +1564,8 @@ namespace Xamarin.Bundler {
|
|||
throw new AggregateException (BuildTarget.Resolver.Exceptions);
|
||||
}
|
||||
|
||||
static void ProcessAssemblyReferences (AssemblyDefinition assembly) {
|
||||
static void ProcessAssemblyReferences (AssemblyDefinition assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
return;
|
||||
|
||||
|
@ -1630,11 +1634,11 @@ namespace Xamarin.Bundler {
|
|||
var abi = Driver.App.Abi;
|
||||
var arch = abi.AsArchString ();
|
||||
switch (abi) {
|
||||
case Abi.x86_64:
|
||||
case Abi.ARM64:
|
||||
return Path.Combine (Driver.GetFrameworkLibDirectory (Driver.App), "64bits", flavor, name + ".dll");
|
||||
default:
|
||||
throw new ProductException (5205, true, Errors.MM5205, arch);
|
||||
case Abi.x86_64:
|
||||
case Abi.ARM64:
|
||||
return Path.Combine (Driver.GetFrameworkLibDirectory (Driver.App), "64bits", flavor, name + ".dll");
|
||||
default:
|
||||
throw new ProductException (5205, true, Errors.MM5205, arch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace MonoMac.Tuner {
|
|||
|
||||
// FIXME: this is the non-MOBILE version
|
||||
if (true) { // Mono.Tuner.Profile.Current is MobileProfile)
|
||||
// limited machine.config support
|
||||
// limited machine.config support
|
||||
WebRequestConfiguration ();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -30,10 +30,10 @@ using Mono.Linker;
|
|||
|
||||
namespace Xamarin.Bundler {
|
||||
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 string GlobalAssemblyCache;
|
||||
public string[] SystemFrameworkDirectories;
|
||||
public string [] SystemFrameworkDirectories;
|
||||
|
||||
public AssemblyDefinition GetAssembly (string fileName)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче