Skip to content

Commit

Permalink
[build] Stop producing Xamarin.Android.Cecil.dll (#8489)
Browse files Browse the repository at this point in the history
Fixes: #3132

Context: xamarin/monodroid@b934949

`Xamarin.Android.Cecil.dll` was created to avoid potential conflicts
and versioning issues with the copy of Cecil that Xamarin Studio was
using at the time; from April 2013:

> The issue is that when Xamarin Studio builds MSBuild-based
> projects, it does so through an intermediary
> `MonoDevelop.Projects.Formats.MSBuild.exe` process, which is
> responsible for using the `Microsoft.Build.*` assemblies to
> actually build the project.
> 
> The problem is that the directory containing
> `MonoDevelop.Projects.Formats.MSBuild.exe` --
> `/Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/bin`
> -- contains its own copy of `Mono.Cecil.dll`, and _that_ is the
> version that was used!
>
> Meaning that in order to fix a Xamarin.Android bug, we would need
> an updated Xamarin Studio release.

Considering our migration to .NET, and how infrequently we change our
`Mono.Cecil` reference these days, these potential issues are likely
no longer a concern.

Our unique `Xamarin.Android.Cecil.dll` copy has been removed in favor
of `Mono.Cecil` package references in all projects that depend on it.
  • Loading branch information
pjcollins authored Nov 20, 2023
1 parent 91c0956 commit 8f33823
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 477 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:main@4d3ede83f699e1d127fed4a18de992819983d715
xamarin/monodroid:main@c5f1e77bc732dc660090a8d59048f07de846ccd7
mono/mono:2020-02@6dd9def57ce969ca04a0ecd9ef72c0a8f069112d
4 changes: 0 additions & 4 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@
<AndroidSupportedTargetAotAbisForConditionalChecks Condition=" !$(AndroidSupportedTargetAotAbisForConditionalChecks.StartsWith (':')) " >:$(AndroidSupportedTargetAotAbisForConditionalChecks)</AndroidSupportedTargetAotAbisForConditionalChecks>
<AndroidSupportedTargetAotAbisSplit>$(AndroidSupportedTargetAotAbis.Split(':'))</AndroidSupportedTargetAotAbisSplit>
</PropertyGroup>
<PropertyGroup>
<RemapAssemblyRefToolExecutable>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\remap-assembly-ref\remap-assembly-ref.dll</RemapAssemblyRefToolExecutable>
<RemapAssemblyRefTool>$(ManagedRuntime) $(ManagedRuntimeArgs) &quot;$(RemapAssemblyRefToolExecutable)&quot;</RemapAssemblyRefTool>
</PropertyGroup>

<!-- Unit Test Properties -->
<PropertyGroup>
Expand Down
7 changes: 0 additions & 7 deletions Xamarin.Android.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "jnienv-gen", "build-tools\j
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "api-merge", "build-tools\api-merge\api-merge.csproj", "{3FC3E78B-F7D4-42EA-BBE8-4535DF42BFF8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "remap-assembly-ref", "build-tools\remap-assembly-ref\remap-assembly-ref.csproj", "{C876DA71-8573-4CEF-9149-716D72455ED4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{04E3E11E-B47D-4599-8AFC-50515A95E715}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop", "external\Java.Interop\src\Java.Interop\Java.Interop.csproj", "{94BD81F7-B06F-4295-9636-F8A3B6BDC762}"
Expand Down Expand Up @@ -145,10 +143,6 @@ Global
{3FC3E78B-F7D4-42EA-BBE8-4535DF42BFF8}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{3FC3E78B-F7D4-42EA-BBE8-4535DF42BFF8}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{3FC3E78B-F7D4-42EA-BBE8-4535DF42BFF8}.Release|AnyCPU.Build.0 = Release|Any CPU
{C876DA71-8573-4CEF-9149-716D72455ED4}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{C876DA71-8573-4CEF-9149-716D72455ED4}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{C876DA71-8573-4CEF-9149-716D72455ED4}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{C876DA71-8573-4CEF-9149-716D72455ED4}.Release|AnyCPU.Build.0 = Release|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Release|AnyCPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -361,7 +355,6 @@ Global
{1D4FC8F1-0DA4-4F38-BE68-11AEBA9A0EA4} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{AFB8F6D1-6EA9-42C3-950B-98F34C669AD2} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
{3FC3E78B-F7D4-42EA-BBE8-4535DF42BFF8} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
{C876DA71-8573-4CEF-9149-716D72455ED4} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
{94BD81F7-B06F-4295-9636-F8A3B6BDC762} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{B501D075-6183-4E1D-92C9-F7B5002475B1} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{D14A1B5C-2060-4930-92BE-F7190256C735} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
Expand Down

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@
<_MSBuildFiles Include="@(_LocalizationLanguages->'$(MicrosoftAndroidSdkOutDir)%(Identity)\Xamarin.Android.Build.Tasks.resources.dll')" />
<_MSBuildFiles Include="@(_LocalizationLanguages->'$(MicrosoftAndroidSdkOutDir)%(Identity)\Xamarin.Android.Tools.AndroidSdk.resources.dll')" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.BuildInfo.txt" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Cecil.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Cecil.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Cecil.Mdb.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Cecil.Mdb.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Cecil.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Cecil.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Cecil.Mdb.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.Cecil.Mdb.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.props" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.D8.targets" />
Expand Down
42 changes: 0 additions & 42 deletions build-tools/remap-assembly-ref/remap-assembly-ref.cs

This file was deleted.

18 changes: 0 additions & 18 deletions build-tools/remap-assembly-ref/remap-assembly-ref.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_XamarinAndroidCecilVersion>@MonoCecilVersion@</_XamarinAndroidCecilVersion>
<CecilSourceDirectory>$(MSBuildThisFileDirectory)..\..\external\mono\external\cecil</CecilSourceDirectory>
<UtilityOutputFullPath>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\</UtilityOutputFullPath>
<UtilityOutputFullPathCoreApps>@MicrosoftAndroidSdkOutDir@</UtilityOutputFullPathCoreApps>
<XamarinAndroidToolsDirectory>$(MSBuildThisFileDirectory)..\..\external\xamarin-android-tools</XamarinAndroidToolsDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ static class KnownProperties
public const string Pkg7Zip_CommandLine = "Pkg7-Zip_CommandLine";
public const string PkgXamarin_LibZipSharp = "PkgXamarin_LibZipSharp";
public const string ProductVersion = "ProductVersion";
public const string RemapAssemblyRefToolExecutable = "RemapAssemblyRefToolExecutable";
public const string XABuildToolsFolder = "XABuildToolsFolder";
public const string XABuildToolsVersion = "XABuildToolsVersion";
public const string XABuildToolsPackagePrefixMacOS = "XABuildToolsPackagePrefixMacOS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace Xamarin.Android.Prepare
properties.Add (KnownProperties.Pkg7Zip_CommandLine, StripQuotes (@"@Pkg7-Zip_CommandLine@"));
properties.Add (KnownProperties.PkgXamarin_LibZipSharp, StripQuotes (@"@PkgXamarin_LibZipSharp@"));
properties.Add (KnownProperties.ProductVersion, StripQuotes ("@ProductVersion@"));
properties.Add (KnownProperties.RemapAssemblyRefToolExecutable, StripQuotes (@"@RemapAssemblyRefToolExecutable@"));
properties.Add (KnownProperties.XABuildToolsFolder, StripQuotes (@"@XABuildToolsFolder@"));
properties.Add (KnownProperties.XABuildToolsVersion, StripQuotes ("@XABuildToolsVersion@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefixMacOS, StripQuotes ("@XABuildToolsPackagePrefixMacOS@"));
Expand Down
31 changes: 0 additions & 31 deletions build-tools/xaprepare/xaprepare/Application/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,37 +107,6 @@ static void FillCurrentAbis (Context context, ref HashSet<string>? currentAbis)
Utilities.AddAbis (context.Properties.GetRequiredValue (KnownProperties.AndroidSupportedTargetAotAbis).Trim (), ref currentAbis);
}

public static void PropagateXamarinAndroidCecil (Context context)
{
const string CecilAssembly = "Xamarin.Android.Cecil.dll";

CopyFile (
Path.Combine (Configurables.Paths.InstallMSBuildDir, CecilAssembly),
Path.Combine (Configurables.Paths.ExternalJavaInteropDir, "bin", context.Configuration, CecilAssembly)
);
}

public static async Task<bool> BuildRemapRef (Context context, bool haveManagedRuntime, string managedRuntime, bool quiet = false)
{
if (!quiet)
Log.StatusLine ("Building remap-assembly-ref");

var msbuild = new MSBuildRunner (context);
string projectPath = Path.Combine (Configurables.Paths.BuildToolsDir, "remap-assembly-ref", "remap-assembly-ref.csproj");
bool result = await msbuild.Run (
projectPath: projectPath,
logTag: "remap-assembly-ref",
binlogName: "build-remap-assembly-ref"
);

if (!result) {
Log.ErrorLine ("Failed to build remap-assembly-ref");
return false;
}

return true;
}

public static string ToXamarinAndroidPropertyValue (ICollection<string> coll)
{
if (coll == null)
Expand Down
32 changes: 0 additions & 32 deletions build-tools/xaprepare/xaprepare/ConfigAndData/Runtimes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,38 +649,6 @@ partial class Runtimes
shared: true
),

// Xamarin.Android.Cecil.dll
new RuntimeFile (
sourceCreator: (Runtime runtime) => Path.Combine (Configurables.Paths.BuildBinDir, "Xamarin.Android.Cecil.dll"),
destinationCreator: (Runtime runtime) => "Xamarin.Android.Cecil.dll",
strip: false,
shared: true
),

// Xamarin.Android.Cecil.pdb
new RuntimeFile (
sourceCreator: (Runtime runtime) => Path.Combine (Configurables.Paths.BuildBinDir, "Xamarin.Android.Cecil.pdb"),
destinationCreator: (Runtime runtime) => "Xamarin.Android.Cecil.pdb",
strip: false,
shared: true
),

// Xamarin.Android.Cecil.Mdb.dll
new RuntimeFile (
sourceCreator: (Runtime runtime) => Path.Combine (Configurables.Paths.BuildBinDir, "Xamarin.Android.Cecil.Mdb.dll"),
destinationCreator: (Runtime runtime) => "Xamarin.Android.Cecil.Mdb.dll",
strip: false,
shared: true
),

// Xamarin.Android.Cecil.Mdb.pdb
new RuntimeFile (
sourceCreator: (Runtime runtime) => Path.Combine (Configurables.Paths.BuildBinDir, "Xamarin.Android.Cecil.Mdb.pdb"),
destinationCreator: (Runtime runtime) => "Xamarin.Android.Cecil.Mdb.pdb",
strip: false,
shared: true
),

new RuntimeFile (
sourceCreator: (Runtime runtime) => Path.Combine (MonoRuntimesHelpers.GetRootDir (runtime), "lib", "libmonosgen-2.0.dll.a"),
destinationCreator: (Runtime runtime) => Path.Combine (GetRuntimeOutputDir (runtime), "libmonosgen-2.0.dll.a"),
Expand Down
Loading

0 comments on commit 8f33823

Please sign in to comment.