From 789285f50ac7cb42a3fc1151b624afea38a14542 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Mon, 9 Mar 2020 19:30:44 -0400 Subject: [PATCH] Remove cecil submodule Cecil is an "interesting" complication: it's a dependency of Java.Interop, but Xamarin.Android use requires that it be "vendorized" -- renamed as `Xamarin.Android.Cecil.dll` -- to avoid previously seen issues because it's an unsigned assembly, and thus There Can Be Only One `Mono.Cecil.dll` loaded into an AppDomain, and whichever is loaded first "wins", but that version may not be compatible with what other assemblies in the AppDomain need, and... Renaming the assembly was just seen as the easiest solution. This choice hasn't been without its own shortcomings; see e.g. commits 168c94d1 ("priorities"), cfa74d34 (downstream build system changes), 5eeb287b ("rebuilds are hard"), 67172759 ("because of 168c94d1, xamarin-android 'owns' the checkout, but that may not be API compatible, oops"), etc., etc. Plus, it kinda became moot with [xamarin/xamarin-android@0c9f83b7][0] which removed the `mono` git submodule from xamarin-android. Instead of building mono from source -- and, implicitly, building *cecil* from source -- mono was instead obtained from a "mono archive" which contained a prebuilt `Mono.Cecil.dll` which was "renamed" to `Xamarin.Android.Cecil.dll`. Which meant that in a xamarin-android build, cecil should *never* be built from source anymore, which in turn meant that -- give or take the occasional build system bug -- `Java.Interop/src/Xamarin.Android.Cecil` and company were "dead code", as far as the commercial product is concerned. Meanwhile, the existance of `src/Xamarin.Android.Cecil` proved to be an ongoing source of maintenance pain, as -- depending on the IDE -- it couldn't build reliably, or would rebuild when it shouldn't have. Rethink the whole Cecil relationship. If xamarin-android doesn't require a cecil source checkout, why not ditch it entirely? Remove the `external/cecil` git submodule, and the `src/Xamarin.Android.Cecil*` projects, and replace them with NuGet package references to the [`Mono.Cecil` NuGet package][1]. What this means is that a "pure Java.Interop" build will now have *different* assembly references than the "same" utilities built from xamarin-android. For example, `generator.exe`, when built from Java.Interop, will reference `Mono.Cecil.dll`, while it will instead reference `Xamarin.Android.Cecil.dll` when built from xamarin-android. The `$(CecilSourceDirectory)` MSBuild property is used to determine whether the Mono.Cecil NuGet package or the `Xamarin.Android.Cecil.dll` assembly reference should be used at build time. [0]: https://github.com/xamarin/xamarin-android/commit/0c9f83b7b15c386ff12b48a7c7295c3d35044adb [1]: https://www.nuget.org/packages/Mono.Cecil/0.11.2 --- .gitmodules | 4 -- Directory.Build.props | 4 +- Java.Interop.sln | 14 ------- Makefile | 1 - README.md | 5 ++- build-tools/scripts/PrepareWindows.targets | 1 - build-tools/scripts/cecil.projitems | 9 ++++ external/Mono.Cecil.AssemblyInfo.cs | 4 -- external/Mono.Cecil.overrides | 9 ---- external/cecil | 1 - .../Java.Interop.Tools.Cecil.csproj | 4 +- .../Java.Interop.Tools.Diagnostics.csproj | 6 +-- ....Interop.Tools.JavaCallableWrappers.csproj | 3 +- .../Xamarin.Android.Cecil.Mdb.csproj | 32 -------------- .../Xamarin.Android.Cecil.csproj | 32 -------------- .../Xamarin.Android.Cecil.targets | 42 ------------------- ...droid.Tools.AnnotationSupport.Cecil.csproj | 3 +- ...op.Tools.JavaCallableWrappers-Tests.csproj | 3 +- tests/generator-Tests/generator-Tests.csproj | 3 +- tools/generator/generator.csproj | 3 +- tools/jcw-gen/jcw-gen.csproj | 3 +- ...oid.Tools.JniMarshalMethodGenerator.csproj | 2 +- tools/logcat-parse/logcat-parse.csproj | 1 - 23 files changed, 30 insertions(+), 159 deletions(-) create mode 100644 build-tools/scripts/cecil.projitems delete mode 100644 external/Mono.Cecil.AssemblyInfo.cs delete mode 100644 external/Mono.Cecil.overrides delete mode 160000 external/cecil delete mode 100644 src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj delete mode 100644 src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj delete mode 100644 src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets diff --git a/.gitmodules b/.gitmodules index d402d02ac..919159a08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "external/cecil"] - path = external/cecil - url = https://github.com/mono/cecil.git - branch = master [submodule "external/xamarin-android-tools"] path = external/xamarin-android-tools url = https://github.com/xamarin/xamarin-android-tools.git diff --git a/Directory.Build.props b/Directory.Build.props index e8bb0a2c5..74174e71e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -32,8 +32,6 @@ $(ToolOutputFullPath) - $(Configuration) - $(MSBuildThisFileDirectory)external\cecil $(MSBuildThisFileDirectory)external\xamarin-android-tools @@ -43,7 +41,7 @@ <_JavacSourceOptions>-source $(JavacSourceVersion) -target $(JavacTargetVersion) -bootclasspath "$(JreRtJarPath)" - $([System.IO.Path]::GetFullPath ('$(CecilSourceDirectory)')) + <_XamarinAndroidCecilPath Condition=" '$(CecilSourceDirectory)' != '' And Exists('$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll') ">$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll $([System.IO.Path]::GetFullPath ('$(XamarinAndroidToolsDirectory)')) diff --git a/Java.Interop.sln b/Java.Interop.sln index 0885babfc..6cd82464e 100644 --- a/Java.Interop.sln +++ b/Java.Interop.sln @@ -77,10 +77,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jcw-gen", "tools\jcw-gen\jc EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop.Tools.JavaCallableWrappers-Tests", "tests\Java.Interop.Tools.JavaCallableWrappers-Tests\Java.Interop.Tools.JavaCallableWrappers-Tests.csproj", "{58B564A1-570D-4DA2-B02D-25BDDB1A9F4F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil", "src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.csproj", "{15945D4B-FF56-4BCC-B598-2718D199DD08}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil.Mdb", "src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.Mdb.csproj", "{C0487169-8F81-497F-919E-EB42B1D0243F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop.GenericMarshaler", "src\Java.Interop.GenericMarshaler\Java.Interop.GenericMarshaler.csproj", "{D1243BAB-23CA-4566-A2A3-3ADA2C2DC3AF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.BootstrapTasks", "build-tools\Java.Interop.BootstrapTasks\Java.Interop.BootstrapTasks.csproj", "{3E8E5C8C-59A6-4A9A-B55D-46AB14431B2A}" @@ -222,14 +218,6 @@ Global {58B564A1-570D-4DA2-B02D-25BDDB1A9F4F}.Debug|Any CPU.Build.0 = Debug|Any CPU {58B564A1-570D-4DA2-B02D-25BDDB1A9F4F}.Release|Any CPU.ActiveCfg = Release|Any CPU {58B564A1-570D-4DA2-B02D-25BDDB1A9F4F}.Release|Any CPU.Build.0 = Release|Any CPU - {15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|Any CPU.Build.0 = Debug|Any CPU - {15945D4B-FF56-4BCC-B598-2718D199DD08}.Release|Any CPU.ActiveCfg = Release|Any CPU - {15945D4B-FF56-4BCC-B598-2718D199DD08}.Release|Any CPU.Build.0 = Release|Any CPU - {C0487169-8F81-497F-919E-EB42B1D0243F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0487169-8F81-497F-919E-EB42B1D0243F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0487169-8F81-497F-919E-EB42B1D0243F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0487169-8F81-497F-919E-EB42B1D0243F}.Release|Any CPU.Build.0 = Release|Any CPU {D1243BAB-23CA-4566-A2A3-3ADA2C2DC3AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D1243BAB-23CA-4566-A2A3-3ADA2C2DC3AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {D1243BAB-23CA-4566-A2A3-3ADA2C2DC3AF}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -286,8 +274,6 @@ Global {64CC4E44-CE3A-4319-BF3F-6CF8BD513870} = {0998E45F-8BCE-4791-A944-962CD54E2D80} {52C7D9B6-E8C8-47D0-9471-652D278D7D77} = {C8F58966-94BF-407F-914A-8654F8B8AE3B} {58B564A1-570D-4DA2-B02D-25BDDB1A9F4F} = {271C9F30-F679-4793-942B-0D9527CB3E2F} - {15945D4B-FF56-4BCC-B598-2718D199DD08} = {C8F58966-94BF-407F-914A-8654F8B8AE3B} - {C0487169-8F81-497F-919E-EB42B1D0243F} = {C8F58966-94BF-407F-914A-8654F8B8AE3B} {D1243BAB-23CA-4566-A2A3-3ADA2C2DC3AF} = {4C173212-371D-45D8-BA83-9226194F48DC} {3E8E5C8C-59A6-4A9A-B55D-46AB14431B2A} = {172B608B-E6F3-41CC-9949-203A76BA247C} {E34BCFA0-CAA4-412C-AA1C-75DB8D67D157} = {172B608B-E6F3-41CC-9949-203A76BA247C} diff --git a/Makefile b/Makefile index f6e575966..69bdd34c3 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,6 @@ include build-tools/scripts/msbuild.mk prepare:: $(BUILD_PROPS) src/Java.Runtime.Environment/Java.Runtime.Environment.dll.config prepare:: prepare-bootstrap - $(MSBUILD) $(MSBUILD_FLAGS) /t:Restore external/cecil/Mono.Cecil.sln $(MSBUILD) $(MSBUILD_FLAGS) /t:Restore Java.Interop.sln prepare-bootstrap: prepare-external bin/Build$(CONFIGURATION)/Java.Interop.BootstrapTasks.dll diff --git a/README.md b/README.md index 8ca44ff2f..05447c7bf 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,9 @@ The `Configuration.Override.props` file is ``ed by Overridable MSBuild properties include: -* `$(CecilSourceDirectory)`: Directory for the `cecil` sources. - Defaults to `external/cecil`. +* `$(CecilSourceDirectory)`: If the empty string, Cecil will be obtained from + NuGet packages. Otherwise, `$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll` + will be used to reference Cecil. * `$(JdkJvmPath)`: Full path name to the JVM native library to link [`java-interop`](src/java-interop) against. By default this is probed for from numerous locations within diff --git a/build-tools/scripts/PrepareWindows.targets b/build-tools/scripts/PrepareWindows.targets index 7cabe2165..12700e739 100644 --- a/build-tools/scripts/PrepareWindows.targets +++ b/build-tools/scripts/PrepareWindows.targets @@ -17,7 +17,6 @@ SourceUris="$(_NuGetUri)" DestinationFiles="$(_NuGet)" /> - + + + + + + + + diff --git a/external/Mono.Cecil.AssemblyInfo.cs b/external/Mono.Cecil.AssemblyInfo.cs deleted file mode 100644 index d0c09384c..000000000 --- a/external/Mono.Cecil.AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo ("Xamarin.Android.Cecil.Pdb, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.Android.Cecil.Mdb, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/external/Mono.Cecil.overrides b/external/Mono.Cecil.overrides deleted file mode 100644 index ce23f6c98..000000000 --- a/external/Mono.Cecil.overrides +++ /dev/null @@ -1,9 +0,0 @@ - - - $(MSBuildProjectName.Replace('Mono', 'Xamarin.Android')) - $(MSBuildThisFileDirectory)..\product.snk - - - - - diff --git a/external/cecil b/external/cecil deleted file mode 160000 index a6a7f5c0f..000000000 --- a/external/cecil +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a6a7f5c0f48c2cbbec699726bbac0816ae097003 diff --git a/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj b/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj index fd89e3cba..1d9bf1059 100644 --- a/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj +++ b/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj @@ -5,13 +5,13 @@ false + + $(ToolOutputFullPath) - - diff --git a/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj b/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj index 398572ae0..5ae7d40b9 100644 --- a/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj +++ b/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj @@ -4,12 +4,10 @@ netstandard2.0 + + $(ToolOutputFullPath) - - - - diff --git a/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj b/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj index 78062e355..de4ceb493 100644 --- a/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj +++ b/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj @@ -17,6 +17,8 @@ JCW_ONLY_TYPE_NAMES;HAVE_CECIL + + JavaNativeTypeManager.cs @@ -26,7 +28,6 @@ - diff --git a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj b/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj deleted file mode 100644 index 0c3114584..000000000 --- a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {C0487169-8F81-497F-919E-EB42B1D0243F} - Library - Mono.Cecil.Mdb - Xamarin.Android.Cecil.Mdb - v4.0 - - - true - full - false - ..\..\bin\Debug - DEBUG; - prompt - 4 - - - full - true - ..\..\bin\Release - prompt - 4 - - - - diff --git a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj b/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj deleted file mode 100644 index 4f5408940..000000000 --- a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {15945D4B-FF56-4BCC-B598-2718D199DD08} - Library - Mono.Cecil - Xamarin.Android.Cecil - v4.0 - - - true - full - false - ..\..\bin\Debug - DEBUG; - prompt - 4 - - - full - true - ..\..\bin\Release - prompt - 4 - - - - diff --git a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets b/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets deleted file mode 100644 index 0be9b63cb..000000000 --- a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets +++ /dev/null @@ -1,42 +0,0 @@ - - - - prepared.flag - ..\..\bin\$(Configuration) - $([System.IO.Path]::Combine ($(MSBuildThisFileDirectory), $(OutputPath))) - $([System.IO.Path]::GetFullPath ($(CecilOutputPath))) - $(OutputPath)\Xamarin.Android.Cecil.dll;$(OutputPath)\Xamarin.Android.Cecil.Mdb.dll - <_CecilSolution>$(CecilFullPath)\Mono.Cecil.sln - - - <_CecilProject Include="$(CecilFullPath)\Mono.Cecil.csproj" /> - <_CecilProject Include="$(CecilFullPath)\symbols\mdb\Mono.Cecil.Mdb.csproj" /> - <_CecilSource Include="$(CecilFullPath)\**\*.cs" /> - - - - - - - - - - - - - diff --git a/src/Xamarin.Android.Tools.AnnotationSupport.Cecil/Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj b/src/Xamarin.Android.Tools.AnnotationSupport.Cecil/Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj index 8a531bdad..39eb4b0cd 100644 --- a/src/Xamarin.Android.Tools.AnnotationSupport.Cecil/Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj +++ b/src/Xamarin.Android.Tools.AnnotationSupport.Cecil/Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj @@ -9,8 +9,9 @@ $(TestOutputFullPath) + + - diff --git a/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj b/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj index 7c7a4e3f0..13e1a3b4e 100644 --- a/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj +++ b/tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers-Tests.csproj @@ -11,6 +11,8 @@ $(TestOutputFullPath) + + @@ -22,7 +24,6 @@ - diff --git a/tests/generator-Tests/generator-Tests.csproj b/tests/generator-Tests/generator-Tests.csproj index 9e5f3f50d..027e26cbe 100644 --- a/tests/generator-Tests/generator-Tests.csproj +++ b/tests/generator-Tests/generator-Tests.csproj @@ -11,6 +11,8 @@ $(TestOutputFullPath) + + @@ -23,7 +25,6 @@ - diff --git a/tools/generator/generator.csproj b/tools/generator/generator.csproj index 237cb731a..a8cdfdc8a 100644 --- a/tools/generator/generator.csproj +++ b/tools/generator/generator.csproj @@ -23,6 +23,8 @@ + +