From fde797dc5c6fc5a0183dfcba03789dc274c0d349 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 -- Configuration.props | 2 - Java.Interop.sln | 14 ------- Makefile | 1 - README.md | 5 ++- build-tools/scripts/cecil.projitems | 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 | 33 --------------- .../Xamarin.Android.Cecil.csproj | 33 --------------- .../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 | 5 +-- tools/jcw-gen/jcw-gen.csproj | 5 +-- ...oid.Tools.JniMarshalMethodGenerator.csproj | 5 +-- 19 files changed, 27 insertions(+), 154 deletions(-) create mode 100644 build-tools/scripts/cecil.projitems 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/Configuration.props b/Configuration.props index 2a8b8f981..50155e249 100644 --- a/Configuration.props +++ b/Configuration.props @@ -20,7 +20,6 @@ /> $(Configuration) - $(MSBuildThisFileDirectory)external\cecil $(MSBuildThisFileDirectory)bin\$(_Configuration)\ $(MSBuildThisFileDirectory)external\xamarin-android-tools @@ -31,7 +30,6 @@ <_JavacSourceOptions>-source $(JavacSourceVersion) -target $(JavacTargetVersion) -bootclasspath "$(JreRtJarPath)" - $([System.IO.Path]::GetFullPath ('$(CecilSourceDirectory)')) $([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 fdbc88155..431b99c42 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,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 7dde8bebf..2af1bc3a5 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,9 @@ it within other project files. 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, `$(CecilSourceDirectory)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/cecil.projitems b/build-tools/scripts/cecil.projitems new file mode 100644 index 000000000..19f158646 --- /dev/null +++ b/build-tools/scripts/cecil.projitems @@ -0,0 +1,9 @@ + + + + + + + + + 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 0b6132ab8..0e0c0898b 100644 --- a/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj +++ b/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj @@ -4,6 +4,8 @@ netstandard2.0 + + ..\..\bin\Debug @@ -14,7 +16,5 @@ - - 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 57070a402..67abbcd01 100644 --- a/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj +++ b/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj @@ -4,6 +4,8 @@ netstandard2.0 + + ..\..\bin\Debug @@ -12,8 +14,4 @@ ..\..\bin\Release - - - - 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 54105d9e4..693d4f021 100644 --- a/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj +++ b/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj @@ -14,6 +14,8 @@ JCW_ONLY_TYPE_NAMES;HAVE_CECIL + + JavaNativeTypeManager.cs @@ -23,7 +25,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 6db57ae70..000000000 --- a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj +++ /dev/null @@ -1,33 +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 d57380ce8..000000000 --- a/src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj +++ /dev/null @@ -1,33 +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 8527c2bc8..9bd498790 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 @@ -12,8 +12,9 @@ ..\..\bin\Release + + - 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 c0474c24c..c81cc0a2f 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 @@ -15,6 +15,8 @@ ..\..\bin\TestRelease + + @@ -26,7 +28,6 @@ - diff --git a/tests/generator-Tests/generator-Tests.csproj b/tests/generator-Tests/generator-Tests.csproj index ecd6b9906..ba46d8760 100644 --- a/tests/generator-Tests/generator-Tests.csproj +++ b/tests/generator-Tests/generator-Tests.csproj @@ -15,6 +15,8 @@ ..\..\bin\TestRelease + + @@ -27,7 +29,6 @@ - diff --git a/tools/generator/generator.csproj b/tools/generator/generator.csproj index 9c5f6f426..2e4f3509e 100644 --- a/tools/generator/generator.csproj +++ b/tools/generator/generator.csproj @@ -18,6 +18,7 @@ v4.6.1 + True full @@ -147,10 +148,6 @@ {D48EE8D0-0A0A-4493-AEF5-DAF5F8CF86AD} Java.Interop.Tools.Cecil - - {15945D4B-FF56-4BCC-B598-2718D199DD08} - Xamarin.Android.Cecil - {D18FCF91-8876-48A0-A693-2DC1E7D3D80A} Java.Interop.Tools.JavaCallableWrappers diff --git a/tools/jcw-gen/jcw-gen.csproj b/tools/jcw-gen/jcw-gen.csproj index 2cce1d077..1b3e618cd 100644 --- a/tools/jcw-gen/jcw-gen.csproj +++ b/tools/jcw-gen/jcw-gen.csproj @@ -12,6 +12,7 @@ v4.6.1 + true full @@ -53,10 +54,6 @@ {64CC4E44-CE3A-4319-BF3F-6CF8BD513870} Java.Interop.Tools.Diagnostics - - {15945D4B-FF56-4BCC-B598-2718D199DD08} - Xamarin.Android.Cecil - diff --git a/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj b/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj index a8186e180..6546cc6f7 100644 --- a/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj +++ b/tools/jnimarshalmethod-gen/Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj @@ -12,6 +12,7 @@ v4.6.1 + true full @@ -56,10 +57,6 @@ {5887B410-D448-4257-A46B-EAC03C80BE93} Java.Runtime.Environment - - {15945D4B-FF56-4BCC-B598-2718D199DD08} - Xamarin.Android.Cecil - {D48EE8D0-0A0A-4493-AEF5-DAF5F8CF86AD} Java.Interop.Tools.Cecil