Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions msbuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ MAC_SYMLINKS =
MAC_PRODUCTS = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/FrameworkList.xml \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList/FrameworkList.xml \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5/machine.config \
$(foreach target,$(MAC_TARGETS) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(notdir $(target))) \
$(foreach target,$(MAC_BINDING_TARGETS) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(notdir $(target))) \
$(foreach dll,$(MAC_TASK_ASSEMBLIES) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(dll).dll) \
Expand Down Expand Up @@ -337,9 +336,6 @@ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/RedistList/Frame
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList/FrameworkList.xml: Xamarin.Shared/Xamarin.Mac-Full-FrameworkList.xml.in Makefile | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList
$(Q) sed 's@%TargetFrameworkDirectory%@$(MAC_TARGETDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5@' $< > $@

$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5/machine.config: $(TOP)/tools/mmp/machine.4_5.config | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5
$(Q) $(CP) $(TOP)/tools/mmp/machine.4_5.config $@

$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/%: Xamarin.Mac.Tasks/% | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild
$(Q) install -m 644 $< $@

Expand Down
2 changes: 1 addition & 1 deletion src/ObjCRuntime/PlatformAvailability2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
// Copyright 2015 Xamarin Inc. All rights reserved.

#if !NET
#if !NET || LEGACY_TOOLS
using System;
using System.Text;

Expand Down
12 changes: 6 additions & 6 deletions src/ObjCRuntime/RuntimeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Xamarin.Bundler {
namespace ObjCRuntime {
#endif
class RuntimeOptions {
#if NET
#if NET && !LEGACY_TOOLS
const string SocketsHandlerValue = "SocketsHttpHandler";
#else
const string HttpClientHandlerValue = "HttpClientHandler";
Expand All @@ -45,13 +45,13 @@ static string ParseHttpMessageHandler (Application app, string? value)
switch (value) {
// default
case null:
#if NET
#if NET && !LEGACY_TOOLS
return NSUrlSessionHandlerValue;
#else
return (app.Platform == Utils.ApplePlatform.WatchOS) ? NSUrlSessionHandlerValue : HttpClientHandlerValue;
#endif
case CFNetworkHandlerValue:
#if NET
#if NET && !LEGACY_TOOLS
case SocketsHandlerValue:
#else
case HttpClientHandlerValue:
Expand Down Expand Up @@ -100,7 +100,7 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp
} else if (app.Platform == Utils.ApplePlatform.WatchOS) {
handler = NSUrlSessionHandlerValue;
} else {
#if NET
#if NET && !LEGACY_TOOLS
handler = NSUrlSessionHandlerValue;
#else
handler = HttpClientHandlerValue;
Expand All @@ -119,7 +119,7 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp
type = platformModule!.GetType ("Foundation", "NSUrlSessionHandler");
break;
#else
#if NET
#if NET && !LEGACY_TOOLS
case SocketsHandlerValue:
type = httpModule.GetType ("System.Net.Http", "SocketsHttpHandler");
break;
Expand Down Expand Up @@ -180,7 +180,7 @@ internal static HttpMessageHandler GetHttpMessageHandler ()
var options = RuntimeOptions.Read ();
// all types will be present as this is executed only when the linker is not enabled
var handler_name = options?.http_message_handler;
#if NET
#if NET && !LEGACY_TOOLS
// Note: no need to handle SocketsHandlerValue here because System.Net.Http handles
// creating a SocketsHttpHandler when configured to do so.
switch (handler_name) {
Expand Down
26 changes: 13 additions & 13 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using PlatformResolver = MonoTouch.Tuner.MonoTouchResolver;
#elif MMP
using PlatformResolver = Xamarin.Bundler.MonoMacResolver;
#elif NET
#elif NET && !LEGACY_TOOLS
using PlatformResolver = Xamarin.Linker.DotNetResolver;
#else
#error Invalid defines
Expand Down Expand Up @@ -107,15 +107,15 @@ public bool EnableMSym {
}

// Linker config
#if !NET
#if !NET || LEGACY_TOOLS
public LinkMode LinkMode = LinkMode.Full;
#endif
bool? are_any_assemblies_trimmed;
public bool AreAnyAssembliesTrimmed {
get {
if (are_any_assemblies_trimmed.HasValue)
return are_any_assemblies_trimmed.Value;
#if NET
#if NET && !LEGACY_TOOLS
// This shouldn't happen, we should always set AreAnyAssembliesTrimmed to some value for .NET.
throw ErrorHelper.CreateError (99, "A custom LinkMode value is not supported for .NET");
#else
Expand All @@ -128,7 +128,7 @@ public bool AreAnyAssembliesTrimmed {
}
public List<string> LinkSkipped = new List<string> ();
public List<string> Definitions = new List<string> ();
#if !NET
#if !NET || LEGACY_TOOLS
public I18nAssemblies I18n;
#endif
public List<string> WarnOnTypeRef = new List<string> ();
Expand Down Expand Up @@ -444,7 +444,7 @@ public bool ArchSpecificExecutable {
}
}

#if !NET
#if !NET || LEGACY_TOOLS
public static int Concurrency => Driver.Concurrency;
#endif
public Version DeploymentTarget;
Expand Down Expand Up @@ -552,7 +552,7 @@ public void UnsetInterpreter ()
InterpretedAssemblies.Clear ();
}

#if !NET
#if !NET || LEGACY_TOOLS
public void ParseI18nAssemblies (string i18n)
{
var assemblies = I18nAssemblies.None;
Expand Down Expand Up @@ -658,7 +658,7 @@ public bool RequiresPInvokeWrappers {
}
}

#if NET
#if NET && !LEGACY_TOOLS
public bool RequireLinkWithAttributeForObjectiveCClassSearch;
#else
public bool RequireLinkWithAttributeForObjectiveCClassSearch = true;
Expand Down Expand Up @@ -836,7 +836,7 @@ public static void CopyFile (string source, string target)
public void InitializeCommon ()
{
InitializeDeploymentTarget ();
#if !NET
#if !NET || LEGACY_TOOLS
SelectRegistrar ();
#endif
SelectMonoNative ();
Expand Down Expand Up @@ -1263,13 +1263,13 @@ public void ParseRegistrar (string v)
Registrar = RegistrarMode.PartialStatic;
break;
#endif
#if NET
#if NET && !LEGACY_TOOLS
case "managed-static":
Registrar = RegistrarMode.ManagedStatic;
break;
#endif
default:
#if NET
#if NET && !LEGACY_TOOLS
throw ErrorHelper.CreateError (20, Errors.MX0020, "--registrar", "managed-static, static, dynamic or default");
#else
throw ErrorHelper.CreateError (20, Errors.MX0020, "--registrar", "static, dynamic or default");
Expand Down Expand Up @@ -1475,7 +1475,7 @@ public bool IsInterpreted (string assembly)
if (Platform == ApplePlatform.MacOSX)
throw ErrorHelper.CreateError (99, Errors.MX0099, "IsInterpreted isn't a valid operation for macOS apps.");

#if !NET
#if !NET || LEGACY_TOOLS
if (IsSimulatorBuild)
return false;
#endif
Expand Down Expand Up @@ -1507,7 +1507,7 @@ public bool IsInterpreted (string assembly)
// revision/testing to be used so desired.
public bool IsAOTCompiled (string assembly)
{
#if NET
#if NET && !LEGACY_TOOLS
if (Platform == ApplePlatform.MacOSX)
return false; // AOT on .NET for macOS hasn't been implemented yet.
#else
Expand Down Expand Up @@ -1645,7 +1645,7 @@ public void GetAotArguments (string filename, Abi abi, string outputDir, string
if (enable_llvm)
aotArguments.Add ($"llvm-outfile={llvmOutputFile}");

#if NET
#if NET && !LEGACY_TOOLS
// If the interpreter is enabled, and we're building for x86_64, we're AOT-compiling but we
// don't have access to infinite trampolines. So we're bumping the trampoline count (unless
// the developer has already set a value) to something higher than the default.
Expand Down
4 changes: 2 additions & 2 deletions tools/common/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public string FullPath {
set {
full_path = value;
if (!is_framework_assembly.HasValue && !string.IsNullOrEmpty (full_path)) {
#if NET
#if NET && !LEGACY_TOOLS
is_framework_assembly = Target.App.Configuration.FrameworkAssemblies.Contains (GetIdentity (full_path));
#else
var real_full_path = Target.GetRealPath (full_path);
Expand Down Expand Up @@ -582,7 +582,7 @@ public void ComputeLinkerFlags ()
if (Frameworks.Add ("OpenAL"))
Driver.Log (3, "Linking with the framework OpenAL because {0} is referenced by a module reference in {1}", file, FileName);
break;
#if NET
#if NET && !LEGACY_TOOLS
case "Carbon":
if (App.Platform != ApplePlatform.MacOSX) {
Driver.Log (3, $"Not linking with the framework {file} (referenced by a module reference in {FileName}) because it doesn't exist on the target platform.");
Expand Down
6 changes: 3 additions & 3 deletions tools/common/DerivedLinkContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Mono.Tuner;
using Xamarin.Bundler;

#if NET
#if NET && !LEGACY_TOOLS
using LinkContext = Xamarin.Bundler.DotNetLinkContext;
#endif

Expand Down Expand Up @@ -43,7 +43,7 @@ public class DerivedLinkContext : LinkContext {
// so we need a second dictionary
Dictionary<TypeDefinition, LinkedAwayTypeReference> LinkedAwayTypeMap = new Dictionary<TypeDefinition, LinkedAwayTypeReference> ();

#if NET
#if NET && !LEGACY_TOOLS
public DerivedLinkContext (Xamarin.Linker.LinkerConfiguration configuration, Target target)
: base (configuration)
{
Expand Down Expand Up @@ -103,7 +103,7 @@ public bool RequireMonoNative {
get; set;
}

#if !NET
#if !NET || LEGACY_TOOLS
public DerivedLinkContext (Pipeline pipeline, AssemblyResolver resolver)
: base (pipeline, resolver)
{
Expand Down
4 changes: 2 additions & 2 deletions tools/common/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public partial class Driver {
static Version min_xcode_version = new Version (6, 0);
#endif

#if !NET
#if !NET || LEGACY_TOOLS
public static int Main (string [] args)
{
try {
Expand Down Expand Up @@ -303,7 +303,7 @@ static bool ParseOptions (Application app, Mono.Options.OptionSet options, strin
}
#endif // !NET

#if !NET
#if !NET || LEGACY_TOOLS
static int Jobs;
public static int Concurrency {
get {
Expand Down
30 changes: 15 additions & 15 deletions tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ protected override IEnumerable<ProtocolMemberAttribute> GetProtocolMemberAttribu
}
}

#if !NET
#if !NET || LEGACY_TOOLS
PlatformName AsPlatformName (ApplePlatform platform)
{
switch (platform) {
Expand Down Expand Up @@ -1735,7 +1735,7 @@ bool GetLegacyAvailabilityAttribute (ICustomAttribute ca, ApplePlatform platform
}
#endif // !NET

#if NET
#if NET && !LEGACY_TOOLS
bool GetDotNetAvailabilityAttribute (ICustomAttribute ca, ApplePlatform currentPlatform, out Version sdkVersion, out string message)
{
var caType = ca.AttributeType;
Expand Down Expand Up @@ -1790,7 +1790,7 @@ bool CollectAvailabilityAttributes (IEnumerable<ICustomAttribute> attributes, ou

ApplePlatform [] platforms;

#if !NET
#if !NET || LEGACY_TOOLS
if (currentPlatform == ApplePlatform.MacCatalyst) {
// Fall back to any iOS attributes if we can't find something for Mac Catalyst
platforms = new ApplePlatform [] {
Expand All @@ -1812,7 +1812,7 @@ bool CollectAvailabilityAttributes (IEnumerable<ICustomAttribute> attributes, ou
foreach (var platform in platforms) {
foreach (var ca in attributes) {
var caType = ca.AttributeType;
#if NET
#if NET && !LEGACY_TOOLS
if (!caType.Is ("System.Runtime.Versioning", "SupportedOSPlatformAttribute"))
continue;
if (GetDotNetAvailabilityAttribute (ca, platform, out sdkVersion, out message))
Expand Down Expand Up @@ -2265,7 +2265,7 @@ void CheckNamespace (string ns, List<Exception> exceptions)
}
}
goto default;
#if !NET
#if !NET || LEGACY_TOOLS
case "Chip":
switch (App.Platform) {
case ApplePlatform.iOS when App.SdkVersion.Major <= 15:
Expand Down Expand Up @@ -2348,7 +2348,7 @@ void CheckNamespace (string ns, List<Exception> exceptions)
}
}
goto default;
#if !NET
#if !NET || LEGACY_TOOLS
case "QTKit":
if (App.Platform == ApplePlatform.MacOSX && App.SdkVersion >= MacOSTenTwelveVersion)
return; // 10.12 removed the header files for QTKit
Expand All @@ -2361,7 +2361,7 @@ void CheckNamespace (string ns, List<Exception> exceptions)
header.WriteLine ("#import <CoreImage/CoreImage.h>");
header.WriteLine ("#import <CoreImage/CIFilterBuiltins.h>");
return;
#if !NET
#if !NET || LEGACY_TOOLS
case "iAd":
if (App.SdkVersion.Major >= 13) {
// most of the framework has been obliterated from the headers
Expand Down Expand Up @@ -2810,7 +2810,7 @@ static bool IsTypeCore (ObjCType type, string nsToMatch)
return ns == nsToMatch;
}

#if !NET
#if !NET || LEGACY_TOOLS
static bool IsQTKitType (ObjCType type) => IsTypeCore (type, "QTKit");
#endif
static bool IsMapKitType (ObjCType type) => IsTypeCore (type, "MapKit");
Expand Down Expand Up @@ -2871,13 +2871,13 @@ List<ObjCType> GetAllTypes (List<Exception> exceptions)
continue; // Some types are not supported in the simulator.
}
} else {
#if !NET
#if !NET || LEGACY_TOOLS
if (IsQTKitType (@class) && App.SdkVersion >= MacOSTenTwelveVersion)
continue; // QTKit header was removed in 10.12 SDK
#endif
}

#if !NET
#if !NET || LEGACY_TOOLS
// Xcode 11 removed WatchKit for iOS!
if (IsTypeCore (@class, "WatchKit") && App.Platform == Xamarin.Utils.ApplePlatform.iOS) {
exceptions.Add (ErrorHelper.CreateWarning (4178, $"The class '{@class.Type.FullName}' will not be registered because the WatchKit framework has been removed from the iOS SDK."));
Expand Down Expand Up @@ -2950,7 +2950,7 @@ public CSToObjCMap GetTypeMapDictionary (List<Exception> exceptions)

public void Rewrite ()
{
#if NET
#if NET && !LEGACY_TOOLS
if (App.Optimizations.RedirectClassHandles == true) {
var exceptions = new List<Exception> ();
var map_dict = GetTypeMapDictionary (exceptions);
Expand Down Expand Up @@ -3513,7 +3513,7 @@ bool SpecializeTrampoline (AutoIndentStringBuilder sb, ObjCMethod method, List<E
sb.AppendLine ("}");
return true;
case Trampoline.CopyWithZone2:
#if NET
#if NET && !LEGACY_TOOLS
// Managed Static Registrar handles CopyWithZone2 in GenerateCallToUnmanagedCallersOnlyMethod
if (LinkContext.App.Registrar == RegistrarMode.ManagedStatic) {
return false;
Expand Down Expand Up @@ -4140,7 +4140,7 @@ void Specialize (AutoIndentStringBuilder sb, ObjCMethod method, List<Exception>
nslog_start.AppendLine (");");
}

#if NET
#if NET && !LEGACY_TOOLS
// Generate the native trampoline to call the generated UnmanagedCallersOnly method if we're using the managed static registrar.
if (LinkContext.App.Registrar == RegistrarMode.ManagedStatic) {
GenerateCallToUnmanagedCallersOnlyMethod (sb, method, isCtor, isVoid, num_arg, descriptiveMethodName, exceptions);
Expand Down Expand Up @@ -4378,7 +4378,7 @@ void Specialize (AutoIndentStringBuilder sb, ObjCMethod method, List<Exception>
}
}

#if NET
#if NET && !LEGACY_TOOLS
void GenerateCallToUnmanagedCallersOnlyMethod (AutoIndentStringBuilder sb, ObjCMethod method, bool isCtor, bool isVoid, int num_arg, string descriptiveMethodName, List<Exception> exceptions)
{
// Generate the native trampoline to call the generated UnmanagedCallersOnly method.
Expand Down Expand Up @@ -5319,7 +5319,7 @@ bool TryCreateTokenReferenceUncached (MemberReference member, TokenType implied_
{
var token = member.MetadataToken;

#if NET
#if NET && !LEGACY_TOOLS
if (App.Registrar == RegistrarMode.ManagedStatic) {
if (implied_type == TokenType.TypeDef && member is TypeDefinition td) {
if (App.Configuration.AssemblyTrampolineInfos.TryGetValue (td.Module.Assembly, out var infos) && infos.TryGetRegisteredTypeIndex (td, out var id)) {
Expand Down
Loading