[net8.0] [msbuild] Show an error for a remote build if [Intermediate]OutputPath is an absolute path. (#18900)

This is way better than some obscure build error.

References:

* https://github.com/xamarin/xamarin-macios/issues/18510
* https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1847166
This commit is contained in:
Rolf Bjarne Kvinge 2023-09-05 10:44:59 +02:00 коммит произвёл GitHub
Родитель 50071c37c9
Коммит 4d22b96f21
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -413,6 +413,16 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved.
<Exec SessionId="$(BuildSessionId)" Command="$(RunCommand) $(RunArguments)" WorkingDirectory="$(RunWorkingDirectory)"/>
</Target>
<Target Name="_VerifyNoAbsoluteOutputPath" Condition="'$(AllowAbsoluteOutputPath)' != 'true'" AfterTargets="_SayHello">
<!--
Remote builds won't work if either OutputPath or IntermediateOutputPath are is an absolute path, so just show an error in that case that tells people what the actual problem is (instead of a random and unintelligible build error).
Ref: https://github.com/xamarin/xamarin-macios/issues/18510
Ref: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1847166
-->
<Error Condition="'$(IsMacEnabled)' == 'true' And $([System.IO.Path]::IsPathRooted('$(OutputPath)'))" Text="An absolute OutputPath is not supported when building remotely. Note that this may occur as a consequence of setting UseArtifactsOutput=true or ArtifactsPath." />
<Error Condition="'$(IsMacEnabled)' == 'true' And $([System.IO.Path]::IsPathRooted('$(IntermediateOutputPath)'))" Text="An absolute IntermediateOutputPath is not supported when building remotely. Note that this may occur as a consequence of setting UseArtifactsOutput=true or ArtifactsPath." />
</Target>
<PropertyGroup>
<_PrepareRunDependsOn>
_SetShouldDisconnect;