forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeGenerator.targets
More file actions
98 lines (74 loc) · 3.21 KB
/
CodeGenerator.targets
File metadata and controls
98 lines (74 loc) · 3.21 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<Target Name="DefineProperties">
<PropertyGroup>
<NativeDllNamePath>$(IntermediateOutputPath)NativeDllName.g.cs</NativeDllNamePath>
<UniqueIdentifierPath>$(IntermediateOutputPath)UniqueIdentifier.g.cs</UniqueIdentifierPath>
<AssemblyCommitIdsPath>$(IntermediateOutputPath)AssemblyCommitIds.g.cs</AssemblyCommitIdsPath>
</PropertyGroup>
</Target>
<Target Name="GenerateNativeDllNameCs" Inputs="$(libgit2_propsfile)" Outputs="$(NativeDllNamePath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties">
<PropertyGroup>
<NativeDllNameSourceLines>
namespace LibGit2Sharp.Core
{
internal static class NativeDllName
{
public const string Name = "$(libgit2_filename)"%3b
}
}
</NativeDllNameSourceLines>
</PropertyGroup>
<WriteLinesToFile File="$(NativeDllNamePath)" Lines="$(NativeDllNameSourceLines)" Overwrite="true" />
<ItemGroup>
<Compile Include="$(NativeDllNamePath)" />
<FileWrites Include="$(NativeDllNamePath)" />
</ItemGroup>
</Target>
<Target Name="GenerateUniqueIdentifierCs" Inputs="$(MSBuildThisFileFullPath);$(MSBuildAllProjects);@(Compile)" Outputs="$(UniqueIdentifierPath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties">
<PropertyGroup>
<UniqueIdSourceLines>
namespace LibGit2Sharp.Core
{
internal static class UniqueId
{
public const string UniqueIdentifier = "$([System.Guid]::NewGuid())"%3b
}
}
</UniqueIdSourceLines>
</PropertyGroup>
<WriteLinesToFile File="$(UniqueIdentifierPath)" Lines="$(UniqueIdSourceLines)" Overwrite="true" />
<ItemGroup>
<Compile Include="$(UniqueIdentifierPath)" />
<FileWrites Include="$(UniqueIdentifierPath)" />
</ItemGroup>
</Target>
<Target Name="AddNativeDllCommitShaToBuildMetadata" BeforeTargets="GetBuildVersion">
<ItemGroup>
<BuildMetadata Include="libgit2-$(libgit2_hash.Substring(0,7))" />
</ItemGroup>
</Target>
<Target Name="GenerateAssemblyCommitIdsCs" Inputs="$(libgit2_propsfile);$(VersionSourceFile)" Outputs="$(AssemblyCommitIdsPath)" BeforeTargets="CoreCompile" AfterTargets="GenerateAssemblyVersionInfo" DependsOnTargets="DefineProperties">
<PropertyGroup>
<LibGit2SharpCommitSha>unknown</LibGit2SharpCommitSha>
<LibGit2SharpCommitSha Condition="'$(GitCommitId)' != ''">$(GitCommitId)</LibGit2SharpCommitSha>
<AssemblyCommitIdsSourceLines>
namespace LibGit2Sharp
{
internal static class AssemblyCommitIds
{
public const string LibGit2CommitSha = "$(libgit2_hash)"%3b
public const string LibGit2SharpCommitSha = "$(LibGit2SharpCommitSha)"%3b
}
}
</AssemblyCommitIdsSourceLines>
</PropertyGroup>
<WriteLinesToFile File="$(AssemblyCommitIdsPath)" Lines="$(AssemblyCommitIdsSourceLines)" Overwrite="true" />
<ItemGroup>
<Compile Include="$(AssemblyCommitIdsPath)" />
<FileWrites Include="$(AssemblyCommitIdsPath)" />
</ItemGroup>
</Target>
</Project>