<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the License.txt file in the project root for more information. --> <Project> <UsingTask TaskName="Microsoft.SourceLink.Common.SourceLinkHasSingleProvider" AssemblyFile="$(_MicrosoftSourceLinkCommonAssemblyFile)"/> <Target Name="_SourceLinkHasSingleProvider"> <!-- If there is a single SourceLink provider we can use Repository URL to infer repository host. If the project references multiple SourceLink providers the user needs to specify hosts explicitly (ImplicitHost will be empty) as we do not know which providers should be used to produce SourceLink URL for the repository. Reports an error if there is no SourceLinkUrlInitializerTargets is empty (no SourceLink provider is referenced). --> <Microsoft.SourceLink.Common.SourceLinkHasSingleProvider ProviderTargets="$(SourceLinkUrlInitializerTargets)" > <Output TaskParameter="HasSingleProvider" PropertyName="SourceLinkHasSingleProvider"/> </Microsoft.SourceLink.Common.SourceLinkHasSingleProvider> </Target> <!-- Triggers InitializeSourceControlInformationFromSourceControlManager target defined by a source control package Microsoft.Build.Tasks.{Git|Tfvc|...}. Notes: No error is reported if InitializeSourceControlInformation is not defined. --> <Target Name="_InitializeSourceControlInformationFromSourceControlManager" DependsOnTargets="InitializeSourceControlInformationFromSourceControlManager;_SourceLinkHasSingleProvider;$(SourceControlManagerUrlTranslationTargets);SourceControlManagerPublishTranslatedUrls" BeforeTargets="InitializeSourceControlInformation" Condition="'$(EnableSourceControlManagerQueries)' == 'true'" /> <Target Name="SourceControlManagerPublishTranslatedUrls"> <PropertyGroup> <!-- If the project already sets RepositoryUrl use it. Such URL is considered final and translations are not applied. --> <PrivateRepositoryUrl Condition="'$(PrivateRepositoryUrl)' == ''">$(RepositoryUrl)</PrivateRepositoryUrl> <PrivateRepositoryUrl Condition="'$(PrivateRepositoryUrl)' == ''">$(ScmRepositoryUrl)</PrivateRepositoryUrl> </PropertyGroup> <ItemGroup> <SourceRoot Update="@(SourceRoot)"> <RepositoryUrl Condition="'%(SourceRoot.RepositoryUrl)' == ''">%(SourceRoot.ScmRepositoryUrl)</RepositoryUrl> </SourceRoot> </ItemGroup> </Target> </Project> |