You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[xaprepare] Restore for multiple solutions (#3997)
Context: #3884
Commit 91467bb updated the build system so that instead of trying to
do "everthing" within a single `.sln` file -- which would result in
various file share exceptions when attempting to build
`Xamarin.Android.sln` within Visual Studio on Windows -- the build
tree would instead become "stateful":
1. Build `Xamarin.Android.BootstrapTasks.sln`.
2. Then `Xamarin.Android.sln` can be built.
3. Then `Xamarin.Android-Tests.sln` can be built.
(1) was handled "internally" via `msbuild /t:Prepare`.
A result of 91467bb is that if e.g.
`build-tools/Xamarin.Android.Tools.BootstrapTasks` were changed, building
`src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj`
would no longer cause `Xamarin.Android.Tools.BootstrapTasks` to be
rebuilt.
(This was the point, as rebuilding
`Xamarin.Android.Tools.BootstrapTasks`/etc. is what caused the file
sharing issues that we wanted fixed.)
Overlooked in 91467bb is that `xaprepare` (invoked by
`msbuild /t:Prepare`) is responsible for restoring NuGet packages on
`.sln` files, but it would only restore packages for
`Xamarin.Android.sln`.
This restriction caused problems in PR #3884, which attempted to add
NuGet packages to `build-tools/Xamarin.Android.BootstrapTasks`, but
because that solution never had its NuGet packages restored,
attempting to use the expected *outputs* of NuGet restore would fail:
$ cat build-tools/Xamarin.Android.BootstrapTasks/packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.DotNet.ApiCompat" version="5.0.0-beta.19602.1" targetFramework="net472" />
<package id="Microsoft.DotNet.GenAPI" version="5.0.0-beta.19602.1" targetFramework="net472" />
<package id="Mono.Posix.NETStandard" version="1.0.0" targetFramework="net472" />
<package id="Xamarin.LibZipSharp" version="1.0.6" targetFramework="net472" />
</packages>
$ msbuild -t:restore build-tools/Xamarin.Android.BootstrapTasks/Xamarin.Android.Tools.BootstrapTask.csproj
…
$ ls packages/Microsoft.D*
ls: cannot access 'packages/Microsoft.D*': No such file or directory
Improve build system sanity: when `xaprepare` restores NuGet packages,
it should restore the following solutions:
* `Xamarin.Android.BootstrapTasks.sln`
* `Xamarin.Android.Build.Tasks.sln`
* `Xamarin.Android.sln`
This will allow PR #3884 to work as intended.
0 commit comments