[dotnet] Parse --dlsym and pass it to the dotnet-linker tasks.

This commit is contained in:
Rolf Bjarne Kvinge 2021-07-01 16:01:01 +02:00
Родитель bdbf642b6f
Коммит d26bdf97bf
4 изменённых файлов: 18 добавлений и 0 удалений

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

@ -359,6 +359,7 @@
AssemblyName=$(AssemblyName).dll AssemblyName=$(AssemblyName).dll
AOTOutputDirectory=$(_AOTOutputDirectory) AOTOutputDirectory=$(_AOTOutputDirectory)
CacheDirectory=$(_LinkerCacheDirectory) CacheDirectory=$(_LinkerCacheDirectory)
@(_BundlerDlsym -> 'Dlsym=%(Identity)')
Debug=$(_BundlerDebug) Debug=$(_BundlerDebug)
DeploymentTarget=$(_MinimumOSVersion) DeploymentTarget=$(_MinimumOSVersion)
@(_BundlerEnvironmentVariables -> 'EnvironmentVariable=%(Identity)=%(Value)') @(_BundlerEnvironmentVariables -> 'EnvironmentVariable=%(Identity)=%(Value)')

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

@ -7,6 +7,9 @@ namespace Xamarin.MacDev.Tasks {
public abstract class ParseBundlerArgumentsTaskBase : XamarinTask { public abstract class ParseBundlerArgumentsTaskBase : XamarinTask {
public string ExtraArgs { get; set; } public string ExtraArgs { get; set; }
[Output]
public ITaskItem [] DlSym { get; set; }
[Output] [Output]
public ITaskItem[] EnvironmentVariables { get; set; } public ITaskItem[] EnvironmentVariables { get; set; }
@ -49,6 +52,7 @@ namespace Xamarin.MacDev.Tasks {
var args = CommandLineArgumentBuilder.Parse (ExtraArgs); var args = CommandLineArgumentBuilder.Parse (ExtraArgs);
List<string> xml = null; List<string> xml = null;
var envVariables = new List<ITaskItem> (); var envVariables = new List<ITaskItem> ();
var dlsyms = new List<ITaskItem> ();
for (int i = 0; i < args.Length; i++) { for (int i = 0; i < args.Length; i++) {
var arg = args [i]; var arg = args [i];
@ -84,6 +88,9 @@ namespace Xamarin.MacDev.Tasks {
// do not set the MtouchNoSymbolStrip property to 'true' in that case. // do not set the MtouchNoSymbolStrip property to 'true' in that case.
NoSymbolStrip = string.IsNullOrEmpty (value) ? "true" : "false"; NoSymbolStrip = string.IsNullOrEmpty (value) ? "true" : "false";
break; break;
case "dlsym":
dlsyms.Add (new TaskItem (string.IsNullOrEmpty (value) ? "true" : value));
break;
case "dsym": case "dsym":
NoDSymUtil = ParseBool (value) ? "false" : "true"; NoDSymUtil = ParseBool (value) ? "false" : "true";
break; break;
@ -143,6 +150,11 @@ namespace Xamarin.MacDev.Tasks {
EnvironmentVariables = envVariables.ToArray (); EnvironmentVariables = envVariables.ToArray ();
} }
if (dlsyms.Count > 0) {
if (DlSym != null)
dlsyms.AddRange (DlSym);
DlSym = dlsyms.ToArray ();
}
} }
return !Log.HasLoggedErrors; return !Log.HasLoggedErrors;

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

@ -1016,6 +1016,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
NoDSymUtil="$(_NoDSymUtil)" NoDSymUtil="$(_NoDSymUtil)"
> >
<Output TaskParameter="CustomBundleName" PropertyName="_CustomBundleName" /> <Output TaskParameter="CustomBundleName" PropertyName="_CustomBundleName" />
<Output TaskParameter="DlSym" ItemName="_BundlerDlsym" />
<Output TaskParameter="EnvironmentVariables" ItemName="_BundlerEnvironmentVariables" /> <Output TaskParameter="EnvironmentVariables" ItemName="_BundlerEnvironmentVariables" />
<Output TaskParameter="MarshalManagedExceptionMode" PropertyName="_MarshalManagedExceptionMode" /> <Output TaskParameter="MarshalManagedExceptionMode" PropertyName="_MarshalManagedExceptionMode" />
<Output TaskParameter="MarshalObjectiveCExceptionMode" PropertyName="_MarshalObjectiveCExceptionMode" /> <Output TaskParameter="MarshalObjectiveCExceptionMode" PropertyName="_MarshalObjectiveCExceptionMode" />

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

@ -121,6 +121,9 @@ namespace Xamarin.Linker {
throw new InvalidOperationException ($"Unable to parse the {key} value: {value} in {linker_file}"); throw new InvalidOperationException ($"Unable to parse the {key} value: {value} in {linker_file}");
DeploymentTarget = deployment_target; DeploymentTarget = deployment_target;
break; break;
case "Dlsym":
Application.ParseDlsymOptions (value);
break;
case "EnvironmentVariable": case "EnvironmentVariable":
var separators = new char [] { ':', '=' }; var separators = new char [] { ':', '=' };
var equals = value.IndexOfAny (separators); var equals = value.IndexOfAny (separators);
@ -314,6 +317,7 @@ namespace Xamarin.Linker {
Console.WriteLine ($" AssemblyName: {Application.AssemblyName}"); Console.WriteLine ($" AssemblyName: {Application.AssemblyName}");
Console.WriteLine ($" CacheDirectory: {CacheDirectory}"); Console.WriteLine ($" CacheDirectory: {CacheDirectory}");
Console.WriteLine ($" Debug: {Application.EnableDebug}"); Console.WriteLine ($" Debug: {Application.EnableDebug}");
Console.WriteLine ($" Dlsym: {Application.DlsymOptions} {(Application.DlsymAssemblies != null ? string.Join (" ", Application.DlsymAssemblies.Select (v => (v.Item2 ? "+" : "-") + v.Item1)) : string.Empty)}");
Console.WriteLine ($" DeploymentTarget: {DeploymentTarget}"); Console.WriteLine ($" DeploymentTarget: {DeploymentTarget}");
Console.WriteLine ($" IntermediateLinkDir: {IntermediateLinkDir}"); Console.WriteLine ($" IntermediateLinkDir: {IntermediateLinkDir}");
Console.WriteLine ($" InterpretedAssemblies: {string.Join (", ", Application.InterpretedAssemblies)}"); Console.WriteLine ($" InterpretedAssemblies: {string.Join (", ", Application.InterpretedAssemblies)}");