Skip to content
Open
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
16 changes: 15 additions & 1 deletion msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class SymbolStrip : XamarinParallelTask, ITaskCallback {
// This can also be specified as metadata on the Executable item (as 'SymbolFile')
public string SymbolFile { get; set; } = string.Empty;

// The local path to the symbol file (used to transfer it to the remote Mac).
// This can also be specified as metadata on the Executable item (as 'SymbolFileLocalPath')
public string SymbolFileLocalPath { get; set; } = string.Empty;

// This can also be specified as metadata on the Executable item (as 'Kind')
public string Kind { get; set; } = string.Empty;
#endregion
Expand Down Expand Up @@ -78,6 +82,16 @@ public override bool Execute ()

public bool ShouldCreateOutputFile (ITaskItem item) => false;

public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> ();
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied ()
{
if (!string.IsNullOrEmpty (SymbolFileLocalPath))
yield return new Microsoft.Build.Utilities.TaskItem (SymbolFileLocalPath);

foreach (var item in Executable) {
var symbolFileLocalPath = item.GetMetadata ("SymbolFileLocalPath");
if (!string.IsNullOrEmpty (symbolFileLocalPath))
yield return new Microsoft.Build.Utilities.TaskItem (symbolFileLocalPath);
}
}
Comment on lines +85 to +95
}
}
4 changes: 3 additions & 1 deletion msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,8 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<DSymName>%(Filename).dSYM</DSymName>
</_PostProcessingItem>
<_PostProcessingItem Include="$([System.IO.Path]::GetFileName('$(AppBundleDir)'))/$(_NativeExecutableRelativePath)" Condition="'$(IsWatchApp)' != 'true'">
<SymbolFile Condition="'$(_ExportSymbolsExplicitly)' == 'true'">$(_SymbolsListFullPath)</SymbolFile>
<SymbolFile>$(_SymbolsListFullPath)</SymbolFile>
<SymbolFileLocalPath>$(_MtouchSymbolsList)</SymbolFileLocalPath>
<DSymName>$(_AppBundleName)$(AppBundleExtension).dSYM</DSymName>
<IsXPCService>$(IsXpcService)</IsXPCService>
<IsAppExtension>$(IsAppExtension)</IsAppExtension>
Expand Down Expand Up @@ -3201,6 +3202,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
MaxDegreeOfParallelism="$(SymbolStripMaxDegreeOfParallelism)"
StripPath="$(StripPath)"
SymbolFile="%(_NativeStripItems.SymbolFile)"
SymbolFileLocalPath="%(_NativeStripItems.SymbolFileLocalPath)"
/>

<!-- Create/touch the stamp file. -->
Expand Down
23 changes: 23 additions & 0 deletions tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2811,6 +2811,29 @@ public void StrippedRuntimeIdentifiers (ApplePlatform platform, string runtimeId
Assert.That (symbols, Does.Contain ("_xamarin_release_managed_ref"), "_xamarin_release_managed_ref");
}

[Test]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64;")]
Comment on lines +2814 to +2816
public void StrippedWithExportSymbolsExplicitlyFalse (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";
properties ["_ExportSymbolsExplicitly"] = "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");
}

[Test]
[TestCase (ApplePlatform.iOS, "ios-arm64;", "iOS")]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", "macOS")]
Expand Down
Loading