The BundleId property is used by the code that generates the mSYM directory,
but its value was always the default value 'com.yourcompany.sample' instead of
looked up in the app's Info.plist.

So fix the BundleId property to do the expected.

Also fix the mSYM test (SymbolicationData) to actually test mSYM stuff (it was
partially disabled when we disabled automatic mSYM generation for C8, and
never re-enabled), and port it to the new and better test syntax, and add a
few more asserts to check the manifest.xml generation.
This commit is contained in:
Rolf Bjarne Kvinge 2016-12-08 16:05:47 +01:00 коммит произвёл GitHub
Родитель 7cc039cd13
Коммит 30bac18e10
4 изменённых файлов: 49 добавлений и 35 удалений

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

@ -125,46 +125,44 @@ namespace Xamarin
[TestCase (Target.Sim, Config.Release, PackageMdb.WithMdb, MSym.Default, true, false, "")]
[TestCase (Target.Sim, Config.Debug, PackageMdb.WoutMdb, MSym.Default, false, false, "--nofastsim --nolink")]
// Device
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, false, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, true, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.WoutMSym, true, false, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.Default, MSym.Default, false, false, "--abi:armv7,arm64")]
[TestCase (Target.Dev, Config.Release, PackageMdb.Default, MSym.Default, false, true, "--abi:armv7,arm64")]
[TestCase (Target.Dev, Config.Debug, PackageMdb.WoutMdb, MSym.Default, false, false, "")]
[TestCase (Target.Dev, Config.Debug, PackageMdb.WoutMdb, MSym.WithMSym, false, true, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, false, "--abi:armv7+llvm")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, true, "--abi:armv7+llvm")]
public void SymbolicationData (Target target, Config configuration, PackageMdb package_mdb, MSym msym, bool has_mdb, bool has_msym, string extra_mtouch_args)
{
if (target == Target.Dev)
AssertDeviceAvailable ();
var testDir = GetTempDirectory ();
var appDir = Path.Combine (testDir, "testApp.app");
Directory.CreateDirectory (appDir);
try {
var is_sim = target == Target.Sim;
var exe = CompileUnifiedTestAppExecutable (testDir);
var msymDir = appDir + ".msym";
var args = extra_mtouch_args;
args += is_sim ? " --sim {0} " : " --dev {0} ";
using (var mtouch = new MTouchTool ()) {
mtouch.Profile = Profile.iOS;
mtouch.CreateTemporaryApp (hasPlist: true);
switch (package_mdb) {
case PackageMdb.WithMdb:
mtouch.PackageMdb = true;
break;
case PackageMdb.WoutMdb:
mtouch.PackageMdb = false;
break;
}
switch (msym) {
case MSym.WithMSym:
mtouch.MSym = true;
break;
case MSym.WoutMSym:
mtouch.MSym = false;
break;
}
if (configuration == Config.Debug)
args += "--debug ";
mtouch.Debug = true;
if (package_mdb == PackageMdb.WithMdb)
args += "--package-mdb:true ";
else if (package_mdb == PackageMdb.WoutMdb)
args += "--package-mdb:false ";
if (msym == MSym.WithMSym)
args += "--msym:true ";
else if (msym == MSym.WoutMSym)
args += "--msym:false ";
args += " --sdkroot {2} -v -v -v -sdk {3} {1} -r:{4}";
ExecutionHelper.Execute (TestTarget.ToolPath, string.Format (args, appDir, exe, Configuration.xcode_root, Configuration.sdk_version, Configuration.XamarinIOSDll));
var is_sim = target == Target.Sim;
mtouch.AssertExecute (is_sim ? MTouchAction.BuildSim : MTouchAction.BuildDev, "build");
var appDir = mtouch.AppPath;
var msymDir = appDir + ".mSYM";
if (is_sim) {
Assert.AreEqual (has_mdb, File.Exists (Path.Combine (appDir, "mscorlib.dll.mdb")), "#mdb");
} else {
@ -183,9 +181,12 @@ namespace Xamarin
}
}
Assert.AreEqual (has_msym, msymFiles.Contains ("mscorlib.dll.msym"));
var manifest = new XmlDocument ();
manifest.Load (Path.Combine (msymDir, "manifest.xml"));
Assert.AreEqual ("com.xamarin.testApp", manifest.SelectSingleNode ("/mono-debug/app-id").InnerText, "app-id");
} else {
DirectoryAssert.DoesNotExist (msymDir, "mSYM found when not expected");
}
} finally {
Directory.Delete (testDir, true);
}
}

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

@ -76,6 +76,8 @@ namespace Xamarin
public List<string> AppExtensions = new List<string> ();
public List<string> Frameworks = new List<string> ();
public string HttpMessageHandler;
public bool? PackageMdb;
public bool? MSym;
#pragma warning restore 649
// These are a bit smarter
@ -192,6 +194,12 @@ namespace Xamarin
if (FastDev.HasValue && FastDev.Value)
sb.Append (" --fastdev");
if (PackageMdb.HasValue)
sb.Append (" --package-mdb:").Append (PackageMdb.Value ? "true" : "false");
if (MSym.HasValue)
sb.Append (" --msym:").Append (MSym.Value ? "true" : "false");
if (Extension == true)
sb.Append (" --extension");

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

@ -140,7 +140,6 @@ namespace Xamarin.Bundler {
// Bundle config
//
public string BundleDisplayName;
public string BundleId = "com.yourcompany.sample";
public string MainNib = "MainWindow";
public string Icon;
public string CertificateName;
@ -308,9 +307,15 @@ namespace Xamarin.Bundler {
}
}
public string BundleId {
get {
return GetStringFromInfoPList ("CFBundleIdentifier");
}
}
string GetStringFromInfoPList (string key)
{
return GetStringFromInfoPList (AppDirectory, "Info.plist");
return GetStringFromInfoPList (AppDirectory, key);
}
string GetStringFromInfoPList (string directory, string key)

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

@ -1156,7 +1156,7 @@ namespace Xamarin.Bundler
// Bundle configuration
//
{ "displayname=", "Specifies the display name [Deprecated]", v => { app.BundleDisplayName = v; classic_only_arguments.Add ("--displayname"); }, true },
{ "bundleid=", "Specifies the bundle identifier (com.foo.exe) [Deprecated]", v => { app.BundleId = v; classic_only_arguments.Add ("--bundleid"); }, true },
{ "bundleid=", "Specifies the bundle identifier (com.foo.exe) [Deprecated]", v => { classic_only_arguments.Add ("--bundleid"); }, true },
{ "mainnib=", "Specifies the name of the main Nib file to load [Deprecated]", v => { app.MainNib = v; classic_only_arguments.Add ("--mainnib"); }, true },
{ "icon=", "Specifies the name of the icon to use [Deprecated]", v => { app.Icon = v; classic_only_arguments.Add ("--icon"); }, true },