[dotnet] Fix typo causing universal builds to not keep any symbols when stripped. Fixes #19860. (#19900)
Fixes https://github.com/xamarin/xamarin-macios/issues/19860.
This commit is contained in:
Родитель
6f8cfc8354
Коммит
fc7688cf8d
|
@ -364,7 +364,7 @@
|
||||||
Properties="
|
Properties="
|
||||||
RuntimeIdentifier=%(_RuntimeIdentifiersAsItems.Identity);
|
RuntimeIdentifier=%(_RuntimeIdentifiersAsItems.Identity);
|
||||||
_CodesignItemsPath=%(_RuntimeIdentifiersAsItems.RidSpecificCodesignItemsPath);
|
_CodesignItemsPath=%(_RuntimeIdentifiersAsItems.RidSpecificCodesignItemsPath);
|
||||||
_MtouchSymbolsList=%(_RuntimeIdentifiersAsItems.RidSpecificSymbolsList);
|
_MtouchSymbolsList=%(_RuntimeIdentifiersAsItems.RidSpecificSymbolsListPath);
|
||||||
_UserFrameworksWithoutDebugSymbolsPath=%(_RuntimeIdentifiersAsItems.RidSpecificUserFrameworksWithoutDebugSymbolsPath);
|
_UserFrameworksWithoutDebugSymbolsPath=%(_RuntimeIdentifiersAsItems.RidSpecificUserFrameworksWithoutDebugSymbolsPath);
|
||||||
$(_RidSpecificProperties);
|
$(_RidSpecificProperties);
|
||||||
">
|
">
|
||||||
|
|
|
@ -1215,5 +1215,23 @@ namespace Xamarin.Tests {
|
||||||
|
|
||||||
[DllImport ("libc")]
|
[DllImport ("libc")]
|
||||||
static extern int sysctlbyname (string name, ref int value, ref IntPtr size, IntPtr zero, IntPtr zeroAgain);
|
static extern int sysctlbyname (string name, ref int value, ref IntPtr size, IntPtr zero, IntPtr zeroAgain);
|
||||||
|
|
||||||
|
public static IEnumerable<string> GetNativeSymbols (string file, string arch = null)
|
||||||
|
{
|
||||||
|
var arguments = new List<string> (new [] { "-gUjA", file });
|
||||||
|
if (!string.IsNullOrEmpty (arch)) {
|
||||||
|
arguments.Add ("-arch");
|
||||||
|
arguments.Add (arch);
|
||||||
|
}
|
||||||
|
var symbols = ExecutionHelper.Execute ("nm", arguments, hide_output: true).Split ('\n');
|
||||||
|
return symbols.Where ((v) => {
|
||||||
|
return !v.EndsWith (": no symbols", StringComparison.Ordinal);
|
||||||
|
}).Select ((v) => {
|
||||||
|
var idx = v.LastIndexOf (": ", StringComparison.Ordinal);
|
||||||
|
if (idx <= 0)
|
||||||
|
return v;
|
||||||
|
return v.Substring (idx + 2);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1634,5 +1634,32 @@ namespace Xamarin.Tests {
|
||||||
AssertErrorCount (errors, 1, "Error count");
|
AssertErrorCount (errors, 1, "Error count");
|
||||||
AssertErrorMessages (errors, $"The property '{property}' is deprecated, please remove it from the project file. Use 'RuntimeIdentifier' or 'RuntimeIdentifiers' instead to specify the target architecture.");
|
AssertErrorMessages (errors, $"The property '{property}' is deprecated, please remove it from the project file. Use 'RuntimeIdentifier' or 'RuntimeIdentifiers' instead to specify the target architecture.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
// The trailing semi-colon for single-arch platforms is significant:
|
||||||
|
// it means we'll use "RuntimeIdentifiers" (plural) instead of "RuntimeIdentifier" (singular)
|
||||||
|
[TestCase (ApplePlatform.iOS, "ios-arm64;")]
|
||||||
|
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")]
|
||||||
|
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64;")]
|
||||||
|
[TestCase (ApplePlatform.TVOS, "tvos-arm64;")]
|
||||||
|
public void StrippedRuntimeIdentifiers (ApplePlatform platform, string runtimeIdentifiers)
|
||||||
|
{
|
||||||
|
var project = "MySimpleApp";
|
||||||
|
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||||
|
Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers);
|
||||||
|
|
||||||
|
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath);
|
||||||
|
Clean (project_path);
|
||||||
|
var properties = GetDefaultProperties (runtimeIdentifiers);
|
||||||
|
properties ["NoSymbolStrip"] = "false";
|
||||||
|
DotNet.AssertBuild (project_path, properties);
|
||||||
|
|
||||||
|
var appExecutable = GetNativeExecutable (platform, appPath);
|
||||||
|
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
|
||||||
|
|
||||||
|
var symbols = Configuration.GetNativeSymbols (appExecutable);
|
||||||
|
Assert.That (symbols, Does.Contain ("_xamarin_release_managed_ref"), "_xamarin_release_managed_ref");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4715,20 +4715,7 @@ public class TestApp {
|
||||||
|
|
||||||
public static IEnumerable<string> GetNativeSymbols (string file, string arch = null)
|
public static IEnumerable<string> GetNativeSymbols (string file, string arch = null)
|
||||||
{
|
{
|
||||||
var arguments = new List<string> (new [] { "-gUjA", file });
|
return Configuration.GetNativeSymbols (file, arch);
|
||||||
if (!string.IsNullOrEmpty (arch)) {
|
|
||||||
arguments.Add ("-arch");
|
|
||||||
arguments.Add (arch);
|
|
||||||
}
|
|
||||||
var symbols = ExecutionHelper.Execute ("nm", arguments, hide_output: true).Split ('\n');
|
|
||||||
return symbols.Where ((v) => {
|
|
||||||
return !v.EndsWith (": no symbols", StringComparison.Ordinal);
|
|
||||||
}).Select ((v) => {
|
|
||||||
var idx = v.LastIndexOf (": ", StringComparison.Ordinal);
|
|
||||||
if (idx <= 0)
|
|
||||||
return v;
|
|
||||||
return v.Substring (idx + 2);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool? is_apfs;
|
static bool? is_apfs;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче