From 1a7712f59524e091df1fc7bec7b9d8ea95f4a8b2 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 17 Nov 2017 18:24:09 +0100 Subject: [PATCH] [MTouch] If we are building a shared code extension, do not build the msym dir. #60415 (#3016) * [MTouch] If we are building a shared code extension, do not build the msym dir. --- tests/mtouch/MTouch.cs | 63 +++++++++++++++++++++++++++++++++++++ tools/mtouch/Application.cs | 3 ++ 2 files changed, 66 insertions(+) diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index 997536a2e0..0caab1350c 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -1014,6 +1014,69 @@ public class B : A {} } } + [Test] + public void MT0095_SharedCode () + { + using (var exttool = new MTouchTool ()) { + exttool.Profile = Profile.iOS; + exttool.CreateTemporaryCacheDirectory (); + exttool.Linker = MTouchLinker.LinkAll; + + exttool.CreateTemporaryServiceExtension (); + exttool.MSym = true; + exttool.Debug = false; + exttool.AssertExecute (MTouchAction.BuildDev, "build extension"); + + using (var apptool = new MTouchTool ()) { + apptool.Profile = Profile.iOS; + apptool.MSym = true; + apptool.Debug = false; + apptool.CreateTemporaryCacheDirectory (); + apptool.CreateTemporaryApp (); + apptool.AppExtensions.Add (exttool); + apptool.Linker = MTouchLinker.LinkAll; + apptool.AssertExecute (MTouchAction.BuildDev, "build app"); + + Assert.IsTrue(Directory.Exists(Path.Combine(apptool.Cache, "Build", "Msym")), "App Msym dir"); + Assert.IsFalse(Directory.Exists(Path.Combine(exttool.Cache, "Build", "Msym")), "Extenson Msym dir"); + exttool.AssertNoWarnings(); + apptool.AssertNoWarnings(); + } + } + } + + [Test] + public void MT0095_NotSharedCode () + { + using (var exttool = new MTouchTool ()) { + exttool.Profile = Profile.iOS; + exttool.CreateTemporaryCacheDirectory (); + exttool.Linker = MTouchLinker.LinkAll; + exttool.CustomArguments = new string [] { "--nodevcodeshare" }; + exttool.CreateTemporaryServiceExtension (); + exttool.MSym = true; + exttool.Debug = false; + exttool.AssertExecute (MTouchAction.BuildDev, "build extension"); + + using (var apptool = new MTouchTool ()) { + apptool.Profile = Profile.iOS; + apptool.MSym = true; + apptool.Debug = false; + apptool.CreateTemporaryCacheDirectory (); + apptool.CreateTemporaryApp (); + apptool.AppExtensions.Add (exttool); + apptool.Linker = MTouchLinker.LinkAll; + apptool.CustomArguments = new string [] { "--nodevcodeshare" }; + apptool.AssertExecute (MTouchAction.BuildDev, "build app"); + + Assert.IsTrue(Directory.Exists(Path.Combine(apptool.Cache, "Build", "Msym")), "App Msym dir"); + Assert.IsTrue(Directory.Exists(Path.Combine(exttool.Cache, "Build", "Msym")), "Extenson Msym dir"); + exttool.AssertNoWarnings(); + apptool.AssertNoWarnings(); + } + } + } + [Test] public void MT0096 () { diff --git a/tools/mtouch/Application.cs b/tools/mtouch/Application.cs index ab231a5175..190cd5c011 100644 --- a/tools/mtouch/Application.cs +++ b/tools/mtouch/Application.cs @@ -2001,6 +2001,9 @@ namespace Xamarin.Bundler { if (!EnableMSym) return; + if (IsExtension && IsCodeShared) // we already have the data from the app + return; + var target_directory = string.Format ("{0}.mSYM", AppDirectory); if (!Directory.Exists (target_directory)) Directory.CreateDirectory (target_directory);