This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathSourceLink.Create.CommandLine.targets
49 lines (46 loc) · 3.1 KB
/
SourceLink.Create.CommandLine.targets
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
<Project>
<PropertyGroup>
<SourceLinkCreateCommandLineDll Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard1.4\SourceLink.Create.CommandLine.dll</SourceLinkCreateCommandLineDll>
<SourceLinkCreateCommandLineDll Condition="'$(MSBuildRuntimeType)' != 'Core'">net461\SourceLink.Create.CommandLine.dll</SourceLinkCreateCommandLineDll>
</PropertyGroup>
<UsingTask TaskName="SourceLink.Create.CommandLine.CreateTask" AssemblyFile="$(SourceLinkCreateCommandLineDll)" />
<PropertyGroup>
<SourceLinkCreate Condition="'$(SourceLinkCreate)' == ''">$(CI)</SourceLinkCreate>
<SourceLinkCreate Condition="'$(SourceLinkCreate)' == '' and '$(BUILD_NUMBER)' != ''">true</SourceLinkCreate>
<SourceLinkCreate Condition="'$(SourceLinkCreate)' == '' and '$(TF_BUILD)' != ''">true</SourceLinkCreate>
<CompileDependsOn Condition="'$(SourceLinkCreate)' == 'true'">SourceLinkCreate;$(CompileDependsOn)</CompileDependsOn>
<SourceLinkFile Condition="'$(SourceLinkFile)' == ''">$(SourceLink)</SourceLinkFile>
<SourceLinkFile Condition="'$(SourceLinkFile)' == ''">$(IntermediateOutputPath)sourcelink.json</SourceLinkFile>
<SourceLinkRootDirectoryCommand Condition="'$(SourceLinkRootDirectoryCommand)' == ''">git rev-parse --show-toplevel</SourceLinkRootDirectoryCommand>
<SourceLinkOriginUrlCommand Condition="'$(SourceLinkOriginUrlCommand)' == ''">git config --get remote.origin.url</SourceLinkOriginUrlCommand>
<SourceLinkCommitCommand Condition="'$(SourceLinkCommitCommand)' == ''">git rev-parse HEAD</SourceLinkCommitCommand>
</PropertyGroup>
<Target Name="SourceLinkCreate">
<Exec StandardOutputImportance="Low" Condition="'$(SourceLinkRootDirectory)' == ''" Command="$(SourceLinkRootDirectoryCommand)" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="SourceLinkRootDirectory" />
</Exec>
<Exec StandardOutputImportance="Low" Condition="'$(SourceLinkUrl)' == '' and '$(SourceLinkOriginUrl)' == ''" Command="$(SourceLinkOriginUrlCommand)" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="SourceLinkOriginUrl" />
</Exec>
<Exec StandardOutputImportance="Low" Condition="'$(SourceLinkCommit)' == ''" Command="$(SourceLinkCommitCommand)" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="SourceLinkCommit" />
</Exec>
<SourceLink.Create.CommandLine.CreateTask
RootDirectory="$(SourceLinkRootDirectory)"
Url="$(SourceLinkUrl)"
OriginUrl="$(SourceLinkOriginUrl)"
Commit="$(SourceLinkCommit)"
File="$(SourceLinkFile)"
ServerType="$(SourceLinkServerType)">
<Output PropertyName="SourceLink" TaskParameter="SourceLink" />
</SourceLink.Create.CommandLine.CreateTask>
<ItemGroup>
<FullPathEmbeddedFiles
Condition="$([System.IO.File]::Exists('%(EmbeddedFiles.Identity)'))"
Include="$([System.IO.Path]::GetFullPath('%(EmbeddedFiles.Identity)'))" />
</ItemGroup>
<CreateProperty Value="@(FullPathEmbeddedFiles)">
<Output TaskParameter="Value" PropertyName="embed" />
</CreateProperty>
</Target>
</Project>