Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] remove pdb2mdb #7950

Merged
merged 1 commit into from
Apr 13, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ xamarin.android.sdk*\xamarin.android.sdk*.vsixdir\*msbuild\xamarin\android\Java.
xamarin.android.sdk*\xamarin.android.sdk*.vsixdir\*msbuild\xamarin\android\mdoc.exe, Fails Pdb2Pdb.exe conversion.
xamarin.android.sdk*\xamarin.android.sdk*.vsixdir\*msbuild\xamarin\android\mkbundle.exe, Fails Pdb2Pdb.exe conversion.
xamarin.android.sdk*\xamarin.android.sdk*.vsixdir\*msbuild\xamarin\android\mono-symbolicate.exe, Fails Pdb2Pdb.exe conversion.
xamarin.android.sdk*\xamarin.android.sdk*.vsixdir\*msbuild\xamarin\android\pdb2mdb.exe, Fails Pdb2Pdb.exe conversion.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ partial class Runtimes
new MonoUtilityFile ("monodoc.dll.config", ignoreDebugInfo: true),
new MonoUtilityFile ("mono-api-html.exe", remap: true),
new MonoUtilityFile ("mono-api-info.exe", remap: true),
new MonoUtilityFile ("pdb2mdb.exe", remap: true),
new MonoUtilityFile ("ICSharpCode.SharpZipLib.dll", remap: false),
new MonoUtilityFile ("Mono.CompilerServices.SymbolWriter.dll", remap: false),
new MonoUtilityFile ("aprofutil.exe", remap: false),
Expand Down
8 changes: 1 addition & 7 deletions src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,11 @@ void AddAssembliesFromCollection (ITaskItem[] assemblies)

// Try to add symbols if Debug
if (debug) {
var symbols = Path.ChangeExtension (assembly.ItemSpec, "dll.mdb");
var symbols = Path.ChangeExtension (assembly.ItemSpec, "pdb");
string symbolsPath = null;

if (File.Exists (symbols)) {
symbolsPath = symbols;
} else {
symbols = Path.ChangeExtension (assembly.ItemSpec, "pdb");

if (File.Exists (symbols)) {
symbolsPath = symbols;
}
}

if (!String.IsNullOrEmpty (symbolsPath)) {
Expand Down
44 changes: 0 additions & 44 deletions src/Xamarin.Android.Build.Tasks/Tasks/ConvertDebuggingFiles.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,135 +16,46 @@ public partial class BuildTest : BaseTest
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "Full",
/* optimize */ true ,
/* embedassebmlies */ true ,
/* expectedResult */ "release",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "Full",
/* optimize */ true ,
/* embedassebmlies */ false ,
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "Full",
/* optimize */ false ,
/* embedassebmlies */ true ,
/* expectedResult */ "debug",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "Full",
/* optimize */ false ,
/* embedassebmlies */ false ,
/* expectedResult */ "debug",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "",
/* optimize */ true ,
/* embedassebmlies */ true ,
/* expectedResult */ "release",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "",
/* optimize */ true ,
/* embedassebmlies */ false ,
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "",
/* optimize */ false ,
/* embedassebmlies */ true ,
/* expectedResult */ "debug",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ true ,
/* debugType */ "",
/* optimize */ false ,
/* embedassebmlies */ false ,
/* expectedResult */ "debug",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
/* debugSymbols */ false ,
/* debugType */ "",
/* optimize */ null ,
/* embedassebmlies */ null ,
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
},
};

static object [] SequencePointChecks () => new object [] {
new object[] {
/* isRelease */ false,
/* monoSymbolArchive */ false ,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
/* embedMdb */ !CommercialBuildAvailable, // because we don't use FastDev in the OSS repo
/* expectedRuntime */ "debug",
/* usesAssemblyBlobs */ false,
},
new object[] {
/* isRelease */ false,
/* monoSymbolArchive */ false ,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
/* embedMdb */ !CommercialBuildAvailable, // because we don't use FastDev in the OSS repo
/* expectedRuntime */ "debug",
/* usesAssemblyBlobs */ true,
},
new object[] {
/* isRelease */ true,
/* monoSymbolArchive */ false,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
new object[] {
/* isRelease */ true,
/* monoSymbolArchive */ false,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ true,
},
new object[] {
/* isRelease */ true,
/* monoSymbolArchive */ true,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
new object[] {
/* isRelease */ true,
/* monoSymbolArchive */ true ,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Portable",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
Expand All @@ -153,8 +64,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ true ,
/* aotAssemblies */ true,
/* debugSymbols */ true,
/* debugType */ "Portable",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
Expand All @@ -163,8 +72,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ false ,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Portable",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
Expand All @@ -173,8 +80,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ false ,
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Portable",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ true,
},
Expand All @@ -183,8 +88,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ false ,
/* aotAssemblies */ true,
/* debugSymbols */ false,
/* debugType */ "",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
Expand All @@ -193,8 +96,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ true ,
/* aotAssemblies */ true,
/* debugSymbols */ false,
/* debugType */ "",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ false,
},
Expand All @@ -203,8 +104,6 @@ public partial class BuildTest : BaseTest
/* monoSymbolArchive */ true ,
/* aotAssemblies */ true,
/* debugSymbols */ false,
/* debugType */ "",
/* embedMdb */ false,
/* expectedRuntime */ "release",
/* usesAssemblyBlobs */ true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ public static string GetLinkedPath (ProjectBuilder builder, bool isRelease, stri

[Test]
[TestCaseSource (nameof (RuntimeChecks))]
public void CheckWhichRuntimeIsIncluded (string supportedAbi, bool debugSymbols, string debugType, bool? optimize, bool? embedAssemblies, string expectedRuntime) {
public void CheckWhichRuntimeIsIncluded (string supportedAbi, bool debugSymbols, bool? optimize, bool? embedAssemblies, string expectedRuntime) {
var proj = new XamarinAndroidApplicationProject ();
proj.SetAndroidSupportedAbis (supportedAbi);
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugSymbols", debugSymbols);
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugType", debugType);
if (optimize.HasValue)
proj.SetProperty (proj.ActiveConfigurationProperties, "Optimize", optimize.Value);
else
Expand Down Expand Up @@ -255,7 +254,7 @@ public void CheckWhichRuntimeIsIncluded (string supportedAbi, bool debugSymbols,
[Category ("AOT"), Category ("MonoSymbolicate")]
[TestCaseSource (nameof (SequencePointChecks))]
public void CheckSequencePointGeneration (bool isRelease, bool monoSymbolArchive, bool aotAssemblies,
bool debugSymbols, string debugType, bool embedMdb, string expectedRuntime, bool usesAssemblyBlobs)
bool debugSymbols, string expectedRuntime, bool usesAssemblyBlobs)
{
var proj = new XamarinAndroidApplicationProject () {
IsRelease = isRelease,
Expand All @@ -265,22 +264,18 @@ public void CheckSequencePointGeneration (bool isRelease, bool monoSymbolArchive
proj.SetAndroidSupportedAbis (abis);
proj.SetProperty (proj.ActiveConfigurationProperties, "MonoSymbolArchive", monoSymbolArchive);
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugSymbols", debugSymbols);
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugType", debugType);
proj.SetProperty (proj.ActiveConfigurationProperties, "AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ());
using (var b = CreateApkBuilder ()) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
var apk = Path.Combine (Root, b.ProjectDirectory,
proj.OutputPath, $"{proj.PackageName}-Signed.apk");
var msymarchive = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.PackageName + ".apk.mSYM");
var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs);
var mdbExits = helper.Exists ("assemblies/UnnamedProject.dll.mdb") || helper.Exists ("assemblies/UnnamedProject.pdb");
Assert.AreEqual (embedMdb, mdbExits,
$"assemblies/UnnamedProject.dll.mdb or assemblies/UnnamedProject.pdb should{0}be in the {proj.PackageName}-Signed.apk", embedMdb ? " " : " not ");
if (aotAssemblies) {
foreach (var abi in abis) {
var assemblies = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath,
"aot", abi, "libaot-UnnamedProject.dll.so");
var shouldExist = monoSymbolArchive && debugSymbols && (debugType == "PdbOnly" || debugType == "Portable");
var shouldExist = monoSymbolArchive && debugSymbols;
var symbolicateFile = Directory.GetFiles (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath,
"aot", abi), "UnnamedProject.dll.msym", SearchOption.AllDirectories).FirstOrDefault ();
if (shouldExist)
Expand Down Expand Up @@ -1061,75 +1056,6 @@ public void CompileBeforeUpgradingNuGet ()
}
}

[Test]
[Category ("DotNetIgnore")] // .mdb and non-portable .pdb files not supported in .NET 5+
public void BuildBasicApplicationCheckPdb ()
{
var proj = new XamarinAndroidApplicationProject {
EmbedAssembliesIntoApk = true,
};
using (var b = CreateApkBuilder ()) {
var reference = new BuildItem.Reference ("PdbTestLibrary.dll") {
WebContentFileNameFromAzure = "PdbTestLibrary.dll"
};
proj.References.Add (reference);
var pdb = new BuildItem.NoActionResource ("PdbTestLibrary.pdb") {
WebContentFileNameFromAzure = "PdbTestLibrary.pdb"
};
proj.References.Add (pdb);
var netStandardRef = new BuildItem.Reference ("NetStandard16.dll") {
WebContentFileNameFromAzure = "NetStandard16.dll"
};
proj.References.Add (netStandardRef);
var netStandardpdb = new BuildItem.NoActionResource ("NetStandard16.pdb") {
WebContentFileNameFromAzure = "NetStandard16.pdb"
};
proj.References.Add (netStandardpdb);
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
var pdbToMdbPath = Path.Combine (Root, b.ProjectDirectory, "PdbTestLibrary.dll.mdb");
Assert.IsTrue (
File.Exists (pdbToMdbPath),
"PdbTestLibrary.dll.mdb must be generated next to the .pdb");
Assert.IsTrue (
File.Exists (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "assets", "UnnamedProject.pdb")),
"UnnamedProject.pdb must be copied to the Intermediate directory");
Assert.IsFalse (
File.Exists (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "assets", "PdbTestLibrary.pdb")),
"PdbTestLibrary.pdb must not be copied to Intermediate directory");
Assert.IsTrue (
File.Exists (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "assets", "PdbTestLibrary.dll.mdb")),
"PdbTestLibrary.dll.mdb must be copied to Intermediate directory");
FileAssert.AreNotEqual (pdbToMdbPath,
Path.Combine (Root, b.ProjectDirectory, "PdbTestLibrary.pdb"),
"The .pdb should NOT match the .mdb");
Assert.IsTrue (
File.Exists (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "assets", "NetStandard16.pdb")),
"NetStandard16.pdb must be copied to Intermediate directory");
var apk = Path.Combine (Root, b.ProjectDirectory,
proj.OutputPath, $"{proj.PackageName}-Signed.apk");
using (var zipFile = ZipHelper.OpenZip (apk)) {
Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile,
"assemblies/NetStandard16.pdb"),
"assemblies/NetStandard16.pdb should exist in the apk.");
Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile,
"assemblies/PdbTestLibrary.dll.mdb"),
"assemblies/PdbTestLibrary.dll.mdb should exist in the apk.");
Assert.IsNull (ZipHelper.ReadFileFromZip (zipFile,
"assemblies/PdbTestLibrary.pdb"),
"assemblies/PdbTestLibrary.pdb should not exist in the apk.");
}
b.BuildLogFile = "build1.log";
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true), "second build failed");
b.BuildLogFile = "build2.log";
var lastTime = File.GetLastWriteTimeUtc (pdbToMdbPath);
pdb.Timestamp = DateTimeOffset.UtcNow;
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true), "third build failed");
Assert.Less (lastTime,
File.GetLastWriteTimeUtc (pdbToMdbPath),
"{0} should have been updated", pdbToMdbPath);
}
}

[Test]
public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser)
{
Expand Down
Loading