summaryrefslogtreecommitdiff
path: root/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets
diff options
context:
space:
mode:
Diffstat (limited to '.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets')
-rwxr-xr-x.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets127
1 files changed, 127 insertions, 0 deletions
diff --git a/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets b/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets
new file mode 100755
index 0000000000..550ad2987f
--- /dev/null
+++ b/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19577.5/tools/RepositoryInfo.targets
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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 file in the project root for more information. -->
+<Project>
+ <!--
+ Include both GitHub and Azure DevOps (formerly VSTS) packages to enable SourceLink in repositories that mirror to Azure DevOps (formerly VSTS).
+ -->
+ <ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
+ <PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
+ <PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="$(MicrosoftSourceLinkVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
+ </ItemGroup>
+
+ <!--
+ Workarounds for Source Link not being available for source build.
+ Set the SourceRoot to repo root to facilitate deterministic source paths when SCM queries are disabled.
+ Set the RepositoryUrl to the Build.Repository.Uri Azure DevOps build variable if on CI, otherwise to local repo path.
+ -->
+
+ <!-- Disable SourceLink when building from source -->
+ <PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
+ <EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
+ <EnableSourceLink>false</EnableSourceLink>
+ </PropertyGroup>
+
+ <ItemGroup Condition="'$(EnableSourceControlManagerQueries)' != 'true'">
+ <SourceRoot Include="$(RepoRoot)" />
+ </ItemGroup>
+
+ <PropertyGroup Condition="'$(EnableSourceControlManagerQueries)' != 'true' and '$(RepositoryUrl)' == ''">
+ <RepositoryUrl Condition="'$(BUILD_REPOSITORY_URI)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(BUILD_REPOSITORY_URI), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</RepositoryUrl>
+ <RepositoryUrl Condition="'$(BUILD_REPOSITORY_URI)' == ''">file://$(RepoRoot)</RepositoryUrl>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(EnableSourceControlManagerQueries)' != 'true' and '$(RepositoryCommit)' == ''">
+ <RepositoryCommit Condition="'$(BUILD_SOURCEVERSION)' != ''">$(BUILD_SOURCEVERSION)</RepositoryCommit>
+ <RepositoryCommit Condition="'$(BUILD_SOURCEVERSION)' == ''">0000000000000000000000000000000000000000</RepositoryCommit>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(EnableSourceControlManagerQueries)' != 'true' and '$(RepositoryType)' == ''">
+ <RepositoryType>git</RepositoryType>
+ </PropertyGroup>
+
+ <!--
+ The convention for names of Azure DevOps repositories mirrored from GitHub is "{GitHub org name}-{GitHub repository name}"
+ -->
+ <PropertyGroup>
+ <!-- There are quite a few git repo forms:
+ https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-arcade-services
+ https://dev.azure.com/dnceng/internal/_git/dotnet-arcade-services
+ https://dnceng.visualstudio.com/internal/_git/dotnet-arcade-services
+ dnceng@vs-ssh.visualstudio.com:v3/dnceng/internal/dotnet-arcade-services
+ git@ssh.dev.azure.com:v3/dnceng/internal/dotnet-arcade-services
+ -->
+ <_TranslateUrlPattern>(https://dnceng%40dev\.azure\.com/dnceng/internal/_git|https://dev\.azure\.com/dnceng/internal/_git|https://dnceng\.visualstudio\.com/internal/_git|dnceng%40vs-ssh\.visualstudio\.com:v3/dnceng/internal|git%40ssh\.dev\.azure\.com:v3/dnceng/internal)/([^/-]+)-(.+)</_TranslateUrlPattern>
+ <_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
+ </PropertyGroup>
+
+ <Target Name="_TranslateAzureDevOpsUrlToGitHubUrl"
+ DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)"
+ BeforeTargets="SourceControlManagerPublishTranslatedUrls">
+
+ <PropertyGroup>
+ <ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <SourceRoot Update="@(SourceRoot)">
+ <ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
+ </SourceRoot>
+ </ItemGroup>
+ </Target>
+
+ <!--
+ Generates and adds {PackageId}.SourceLink.targets file to the build directory of the source package.
+ -->
+
+ <UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.GenerateSourcePackageSourceLinkTargetsFile" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
+
+ <PropertyGroup Condition="'$(IsPackable)' == 'true' and '$(IsSourcePackage)' == 'true' and '$(EnableSourceLink)' == 'true'">
+ <BeforePack>$(BeforePack);_AddSourcePackageSourceLinkFile</BeforePack>
+ </PropertyGroup>
+
+ <Target Name="_AddSourcePackageSourceLinkFile" DependsOnTargets="_GenerateSourcePackageSourceLinkFile">
+ <ItemGroup>
+ <!-- Add a packable item if the project builds the package with auto-generated .nuspec file -->
+ <None Include="$(_SourcePackageSourceLinkTargetsFilePath)" PackagePath="build" Pack="true" Condition="'$(NuspecFile)' == ''"/>
+
+ <!-- Include path in the nuspec properties if the project builds package using custom .nuspec -->
+ <NuspecProperty Include="SourceLinkTargetsFilePath=$(_SourcePackageSourceLinkTargetsFilePath)" Condition="'$(NuspecFile)' != ''"/>
+ </ItemGroup>
+ </Target>
+
+ <Target Name="_CalculateGenerateSourcePackageSourceLinkFileOutputs">
+ <PropertyGroup>
+ <_SourcePackageSourceLinkTargetsFileName>$([MSBuild]::ValueOrDefault($(SourcePackageSourceLinkTargetsFileName), '$(PackageId).targets'))</_SourcePackageSourceLinkTargetsFileName>
+ <_SourcePackageSourceLinkTargetsFilePath>$(IntermediateOutputPath)$(_SourcePackageSourceLinkTargetsFileName)</_SourcePackageSourceLinkTargetsFilePath>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="_GenerateSourcePackageSourceLinkFile"
+ DependsOnTargets="InitializeSourceControlInformation;$(SourceLinkUrlInitializerTargets);_CalculateGenerateSourcePackageSourceLinkFileOutputs"
+ Inputs="$(MSBuildAllProjects)"
+ Outputs="$(_SourcePackageSourceLinkTargetsFilePath)">
+
+ <Microsoft.DotNet.Arcade.Sdk.GenerateSourcePackageSourceLinkTargetsFile
+ ProjectDirectory="$(MSBuildProjectDirectory)"
+ PackageId="$(PackageId)"
+ SourceRoots="@(SourceRoot)"
+ OutputPath="$(_SourcePackageSourceLinkTargetsFilePath)"/>
+
+ <ItemGroup>
+ <FileWrites Include="$(_SourcePackageSourceLinkTargetsFilePath)"/>
+ </ItemGroup>
+ </Target>
+
+ <!--
+ Validates repository-wide requirements.
+ MSBuild only evaluates the target project once per each set of values of global properties and caches the results.
+ -->
+ <Target Name="_RepositoryValidation" BeforeTargets="Build" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
+ <MSBuild Projects="$(MSBuildThisFileDirectory)RepositoryValidation.proj"
+ Targets="Validate"
+ RemoveProperties="TargetFramework;Platform"
+ Properties="RepoRoot=$(RepoRoot);PackageLicenseExpression=$(PackageLicenseExpression);PackageLicenseExpressionInternal=$(PackageLicenseExpressionInternal);SuppressLicenseValidation=$(SuppressLicenseValidation)"
+ UseResultsCache="true" />
+ </Target>
+
+</Project>