blob: 213daf5e6711ecb8e0e35d3fd59cea7aa2e3c3b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<?xml version="1.0" encoding="utf-8"?>
<Project>
<UsingTask TaskName="Microsoft.Build.Tasks.Git.LocateRepository" AssemblyFile="$(MicrosoftBuildTasksGitAssemblyFile)"/>
<UsingTask TaskName="Microsoft.Build.Tasks.Git.GetUntrackedFiles" AssemblyFile="$(MicrosoftBuildTasksGitAssemblyFile)"/>
<PropertyGroup>
<!--
Sets the scope of git repository configuration. By default (no scope specified) configuration is read from environment variables
and system and global user git/ssh configuration files.
If "local" is specified the configuration is only read from the configuration files local to the repository (or work tree).
In addition, any use of home relative paths in these configuration files (paths that start with '~/') is disallowed.
By default, the scope is restricted to "local" when building in CI (ContinuousIntegrationBuild is true) to avoid introducing
dependencies on CI machine state into the build.
-->
<GitRepositoryConfigurationScope Condition="'$(GitRepositoryConfigurationScope)' == '' and '$(ContinuousIntegrationBuild)' == 'true'">local</GitRepositoryConfigurationScope>
</PropertyGroup>
<Target Name="InitializeSourceControlInformationFromSourceControlManager">
<!--
Reports a warning if the given project doesn't belong to a repository under source control.
-->
<Microsoft.Build.Tasks.Git.LocateRepository
Path="$(MSBuildProjectDirectory)"
RemoteName="$(GitRepositoryRemoteName)"
ConfigurationScope="$(GitRepositoryConfigurationScope)" >
<Output TaskParameter="RepositoryId" PropertyName="_GitRepositoryId" />
<Output TaskParameter="Url" PropertyName="ScmRepositoryUrl" />
<Output TaskParameter="Roots" ItemName="SourceRoot" />
<Output TaskParameter="RevisionId" PropertyName="SourceRevisionId" Condition="'$(SourceRevisionId)' == ''" />
</Microsoft.Build.Tasks.Git.LocateRepository>
<PropertyGroup>
<RepositoryType Condition="'$(RepositoryType)' == ''">git</RepositoryType>
</PropertyGroup>
</Target>
<!--
Embed files to the PDB that either do not belong to any of the SourceRoot directories
or belong to the source repository, but are explicitly ignored (excluded) from source control.
-->
<Target Name="SetEmbeddedFilesFromSourceControlManagerUntrackedFiles"
DependsOnTargets="InitializeSourceControlInformationFromSourceControlManager">
<Microsoft.Build.Tasks.Git.GetUntrackedFiles
RepositoryId="$(_GitRepositoryId)"
ConfigurationScope="$(GitRepositoryConfigurationScope)"
ProjectDirectory="$(MSBuildProjectDirectory)"
Files="@(Compile)">
<Output TaskParameter="UntrackedFiles" ItemName="EmbeddedFiles" />
</Microsoft.Build.Tasks.Git.GetUntrackedFiles>
</Target>
</Project>
|