From dc56205fefcaf2a248ec73299d5a6d1a22b7895f Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 4 Nov 2019 14:19:49 -0600 Subject: [PATCH] [build] improve Xamarin.Android.sln usability in VS Windows Xamarin.Android.sln has two issues that make `Xamarin.Android.sln` not work too well in VS Windows: * It builds MSBuild tasks and uses them within the same solution, such as `xa-prep-tasks.csproj` and `Xamarin.Android.Tools.BootstrapTasks.csproj`. * We have conditional `@(ProjectReference)` To improve things, I completely removed the `$(XAIntegratedTests)` MSBuild property and any `@(ProjectReference)` that were conditional. I moved the two bootstrap `.csproj` files to a new `Xamarin.Android.BootstrapTasks.sln` which gets built during `make prepare` or `msbuild Xamarin.Android.sln /t:Prepare`. VS Windows was also complaining about the `CreateManifestResourceNames` target missing for projects that merely import `Microsoft.Common.targets` such as `r8.csproj`. I added an empty target in `Configuration.props` to fix all cases of this. Unfortunately, things are still not perfect as you can hit errors such as: Unable to copy file "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll". The process cannot access the file 'C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll' because it is being used by another process. Could not copy "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll". Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2019 (26660), MSBuild.exe (18800), MSBuild.exe (17416)" Xamarin.Android.Build.Tasks This occurs if you modify `Xamarin.Android.Build.Tasks.csproj`. I am not yet sure if we can get around this remaining problem, but we can revisit in the future. --- Configuration.props | 4 ++- .../building/windows/instructions.md | 2 +- Makefile | 5 +++ Xamarin.Android.BootstrapTasks.sln | 31 +++++++++++++++++++ Xamarin.Android.sln | 16 ++-------- build-tools/automation/azure-pipelines.yaml | 2 +- build-tools/create-vsix/create-vsix.csproj | 8 ----- build-tools/scripts/PrepareWindows.targets | 4 +-- build-tools/scripts/RunTests.targets | 2 +- build-tools/timing/timing.csproj | 7 ----- .../Test/Mono.Android-Tests.csproj | 12 ------- .../Xamarin.Android.Build.Tasks.csproj | 5 --- .../Xamarin.Android.NUnitLite.csproj | 6 ---- .../Mono.Android-TestsAppBundle.csproj | 12 ------- .../Mono.Android-TestsMultiDex.csproj | 12 ------- 15 files changed, 46 insertions(+), 82 deletions(-) create mode 100644 Xamarin.Android.BootstrapTasks.sln diff --git a/Configuration.props b/Configuration.props index edcef9ccb97..53ed10428eb 100644 --- a/Configuration.props +++ b/Configuration.props @@ -100,7 +100,6 @@ 29 29.0.0 29.0.1 - False False 0.10.2 $([System.IO.Path]::PathSeparator) @@ -180,5 +179,8 @@ <_NUnit>$(_Runtime) packages\NUnit.ConsoleRunner.3.9.0\tools\nunit3-console.exe + + + diff --git a/Documentation/building/windows/instructions.md b/Documentation/building/windows/instructions.md index 3a481d06f82..0e376e531fa 100644 --- a/Documentation/building/windows/instructions.md +++ b/Documentation/building/windows/instructions.md @@ -90,7 +90,7 @@ So for example: Once `msbuild Xamarin.Android.sln` has completed, the unit tests may be built with: - msbuild Xamarin.Android-Tests.sln /p:XAIntegratedTests=False + msbuild Xamarin.Android-Tests.sln *NOTE*: There is currently no equivalent to [`make jenkins`](../unix/instructions.md) on Windows. diff --git a/Makefile b/Makefile index 198191dd79a..8d0c1491e55 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,10 @@ _PREPARE_CI_MODE_PR_ARGS = --no-emoji --run-mode=CI _PREPARE_CI_MODE_ARGS = $(_PREPARE_CI_MODE_PR_ARGS) -a _PREPARE_ARGS = +BOOTSTRAP_SOLUTION = Xamarin.Android.BootstrapTasks.sln +BOOTSTRAP_BUILD_LOG = bin/Build$(CONFIGURATION)/bootstrap-build.binlog +BOOTSTRAP_MSBUILD_FLAGS = /binaryLogger:"$(BOOTSTRAP_BUILD_LOG)" $(PREPARE_COMMON_MSBUILD_FLAGS) + all: $(call MSBUILD_BINLOG,all,$(_SLN_BUILD)) $(MSBUILD_FLAGS) $(SOLUTION) @@ -198,6 +202,7 @@ prepare-build: prepare-build-init .PHONY: prepare prepare: prepare-build mono --debug $(PREPARE_EXE) $(_PREPARE_ARGS) + msbuild $(BOOTSTRAP_MSBUILD_FLAGS) $(BOOTSTRAP_SOLUTION) .PHONY: prepare-help prepare-help: prepare-build diff --git a/Xamarin.Android.BootstrapTasks.sln b/Xamarin.Android.BootstrapTasks.sln new file mode 100644 index 00000000000..032ccf098ac --- /dev/null +++ b/Xamarin.Android.BootstrapTasks.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29411.108 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xa-prep-tasks", "build-tools\xa-prep-tasks\xa-prep-tasks.csproj", "{7CE69551-BD73-4726-ACAA-AAF89C84BAF8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.BootstrapTasks", "build-tools\Xamarin.Android.Tools.BootstrapTasks\Xamarin.Android.Tools.BootstrapTasks.csproj", "{E8492EFB-D14A-4F32-AA28-88848322ECEA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Release|Any CPU.Build.0 = Release|Any CPU + {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {368B5B8B-7CA0-4D02-B36A-95CF69A960CD} + EndGlobalSection +EndGlobal diff --git a/Xamarin.Android.sln b/Xamarin.Android.sln index 8842dc98383..2a668a686ad 100644 --- a/Xamarin.Android.sln +++ b/Xamarin.Android.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 15.0.27428.2037 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build-Tools", "Build-Tools", "{E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.BootstrapTasks", "build-tools\Xamarin.Android.Tools.BootstrapTasks\Xamarin.Android.Tools.BootstrapTasks.csproj", "{E8492EFB-D14A-4F32-AA28-88848322ECEA}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "java-runtime", "src\java-runtime\java-runtime.csproj", "{1D4FC8F1-0DA4-4F38-BE68-11AEBA9A0EA4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jnienv-gen", "build-tools\jnienv-gen\jnienv-gen.csproj", "{AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}" @@ -73,8 +71,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "src\OpenTK-1.0\Op EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "create-bundle", "build-tools\create-bundle\create-bundle.csproj", "{1640725C-4DB8-4D8D-BC96-74E688A06EEF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xa-prep-tasks", "build-tools\xa-prep-tasks\xa-prep-tasks.csproj", "{7CE69551-BD73-4726-ACAA-AAF89C84BAF8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil", "external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.csproj", "{15945D4B-FF56-4BCC-B598-2718D199DD08}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil.Mdb", "external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.Mdb.csproj", "{C0487169-8F81-497F-919E-EB42B1D0243F}" @@ -150,10 +146,6 @@ Global Release|AnyCPU = Release|AnyCPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU - {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|AnyCPU.Build.0 = Debug|Any CPU - {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Release|AnyCPU.ActiveCfg = Release|Any CPU - {E8492EFB-D14A-4F32-AA28-88848322ECEA}.Release|AnyCPU.Build.0 = Release|Any CPU {1D4FC8F1-0DA4-4F38-BE68-11AEBA9A0EA4}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU {1D4FC8F1-0DA4-4F38-BE68-11AEBA9A0EA4}.Debug|AnyCPU.Build.0 = Debug|Any CPU {1D4FC8F1-0DA4-4F38-BE68-11AEBA9A0EA4}.Release|AnyCPU.ActiveCfg = Release|Any CPU @@ -262,10 +254,6 @@ Global {5EB9E888-E357-417E-9F39-DDEC195CE47F}.Debug|AnyCPU.Build.0 = Debug|Any CPU {5EB9E888-E357-417E-9F39-DDEC195CE47F}.Release|AnyCPU.ActiveCfg = Release|Any CPU {5EB9E888-E357-417E-9F39-DDEC195CE47F}.Release|AnyCPU.Build.0 = Release|Any CPU - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Debug|AnyCPU.Build.0 = Debug|Any CPU - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Release|AnyCPU.ActiveCfg = Release|Any CPU - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8}.Release|AnyCPU.Build.0 = Release|Any CPU {15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU {15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|AnyCPU.Build.0 = Debug|Any CPU {15945D4B-FF56-4BCC-B598-2718D199DD08}.Release|AnyCPU.ActiveCfg = Release|Any CPU @@ -379,12 +367,12 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {E8492EFB-D14A-4F32-AA28-88848322ECEA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {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} {FE789F04-5E95-42C5-AEF1-E33F8DF06B3F} = {04E3E11E-B47D-4599-8AFC-50515A95E715} {74598F5C-B8CC-4CE6-8EE2-AB9CA1400076} = {04E3E11E-B47D-4599-8AFC-50515A95E715} @@ -408,7 +396,6 @@ Global {7387E151-48E3-4885-B2CA-A74434A34045} = {864062D3-A415-4A6F-9324-5820237BA058} {B8F799C5-D7CE-4E09-9CE6-BAA4173E7EC8} = {04E3E11E-B47D-4599-8AFC-50515A95E715} {5EB9E888-E357-417E-9F39-DDEC195CE47F} = {04E3E11E-B47D-4599-8AFC-50515A95E715} - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {15945D4B-FF56-4BCC-B598-2718D199DD08} = {864062D3-A415-4A6F-9324-5820237BA058} {C0487169-8F81-497F-919E-EB42B1D0243F} = {864062D3-A415-4A6F-9324-5820237BA058} {4B9D96BB-95AB-44E8-9F87-13B12C8BCED1} = {04E3E11E-B47D-4599-8AFC-50515A95E715} @@ -426,6 +413,7 @@ Global {1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63} = {04E3E11E-B47D-4599-8AFC-50515A95E715} {0C31DE30-F9DF-4312-BFFE-DCAD558CCF08} = {04E3E11E-B47D-4599-8AFC-50515A95E715} {A0AEF446-3368-4591-9DE6-BC3B2B33337D} = {04E3E11E-B47D-4599-8AFC-50515A95E715} + {D93CAC27-3893-42A3-99F1-2BCA72E186F4} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {F3CFF31C-037B-450F-B22D-1D6E529B2DCC} = {864062D3-A415-4A6F-9324-5820237BA058} {46529930-A5CC-4205-A50D-0AAAC639F082} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {DBDC804F-8406-4F5E-83C6-720CB0CB6C6F} = {864062D3-A415-4A6F-9324-5820237BA058} diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index c5554fc0c4f..b5f1419839f 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -192,7 +192,7 @@ stages: displayName: xabuild Xamarin.Android-Tests inputs: filename: bin\$(XA.Build.Configuration)\bin\xabuild.exe - arguments: Xamarin.Android-Tests.sln /p:Configuration=$(XA.Build.Configuration) /p:XAIntegratedTests=False /bl:$(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\msbuild-build-tests.binlog + arguments: Xamarin.Android-Tests.sln /p:Configuration=$(XA.Build.Configuration) /bl:$(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\msbuild-build-tests.binlog - task: MSBuild@1 displayName: nunit Xamarin.Android.Build.Tests diff --git a/build-tools/create-vsix/create-vsix.csproj b/build-tools/create-vsix/create-vsix.csproj index ea0b56c98b3..2c2ff3ba066 100644 --- a/build-tools/create-vsix/create-vsix.csproj +++ b/build-tools/create-vsix/create-vsix.csproj @@ -122,12 +122,4 @@ - - - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8} - xa-prep-tasks - False - False - - diff --git a/build-tools/scripts/PrepareWindows.targets b/build-tools/scripts/PrepareWindows.targets index 044e2a04725..f4cdd0b8dfc 100644 --- a/build-tools/scripts/PrepareWindows.targets +++ b/build-tools/scripts/PrepareWindows.targets @@ -9,8 +9,7 @@ - - + @@ -23,5 +22,6 @@ Condition="$(AndroidToolchainDirectory.Contains (' '))" /> + diff --git a/build-tools/scripts/RunTests.targets b/build-tools/scripts/RunTests.targets index 17bbc3337a7..37b8d5b65aa 100644 --- a/build-tools/scripts/RunTests.targets +++ b/build-tools/scripts/RunTests.targets @@ -12,7 +12,7 @@ <_XABuild>$(_TopDir)\bin\$(Configuration)\bin\xabuild <_XABinLogPrefix>/v:normal /binaryLogger:"$(MSBuildThisFileDirectory)\..\..\bin\Test$(Configuration)\msbuild <_XABuildDiag Condition=" '$(USE_MSBUILD)' == '0' And '$(V)' != '' ">/v:diag - <_XABuildProperties>$(_XABuildDiag)/p:Configuration=$(Configuration) /p:XAIntegratedTests=$(XAIntegratedTests) + <_XABuildProperties>$(_XABuildDiag)/p:Configuration=$(Configuration) <_TestAssembly Include="$(_TopDir)\bin\Test$(Configuration)\Xamarin.Android.Build.Tests.dll" /> diff --git a/build-tools/timing/timing.csproj b/build-tools/timing/timing.csproj index 6eb0fdc7944..337bfc2a443 100644 --- a/build-tools/timing/timing.csproj +++ b/build-tools/timing/timing.csproj @@ -19,11 +19,4 @@ ResolveReferences; - - - {E8492EFB-D14A-4F32-AA28-88848322ECEA} - Xamarin.Android.Tools.BootstrapTasks - False - - diff --git a/src/Mono.Android/Test/Mono.Android-Tests.csproj b/src/Mono.Android/Test/Mono.Android-Tests.csproj index 4364a8d886c..0d018ae3ea2 100644 --- a/src/Mono.Android/Test/Mono.Android-Tests.csproj +++ b/src/Mono.Android/Test/Mono.Android-Tests.csproj @@ -91,18 +91,6 @@ {8CB5FF58-FF95-43B9-9064-9ACE9525866F} Mono.Android-Test.Library - - Xamarin.Android.Build.Tasks - {3F1F2F50-AF1A-4A5A-BEDB-193372F068D7} - False - False - - - Xamarin.Android.NUnitLite - {4D603AA3-3BFD-43C8-8050-0CD6C2601126} - False - False - diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj index 8ef1c4b5052..b855eedd028 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj @@ -710,11 +710,6 @@ Xamarin.Android.Build.Tasks.targets uses several tasks located in Xamarin.Android.Tools.BootstrapTasks, such as --> - - {E8492EFB-D14A-4F32-AA28-88848322ECEA} - Xamarin.Android.Tools.BootstrapTasks - False -