|
1 | 1 | <Project>
|
2 | 2 |
|
| 3 | + <Target Name="DefineProperties"> |
3 | 4 | <PropertyGroup>
|
4 |
| - <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateNativeDllNameCs</CoreCompileDependsOn> |
5 |
| - <PrepareResourceNamesDependsOn>GenerateCommitIdVersion;$(PrepareResourceNamesDependsOn)</PrepareResourceNamesDependsOn> |
6 |
| - <NativeDllNamePath>$(IntermediateOutputPath)NativeDllName.cs</NativeDllNamePath> |
7 |
| - <UniqueIdentifierPath>$(IntermediateOutputPath)UniqueIdentifier.cs</UniqueIdentifierPath> |
8 |
| - <CommitIdVersionPath>$(IntermediateOutputPath)libgit2sharp_hash.txt</CommitIdVersionPath> |
| 5 | + <NativeDllNamePath>$(IntermediateOutputPath)NativeDllName.g.cs</NativeDllNamePath> |
| 6 | + <UniqueIdentifierPath>$(IntermediateOutputPath)UniqueIdentifier.g.cs</UniqueIdentifierPath> |
9 | 7 | </PropertyGroup>
|
| 8 | + </Target> |
10 | 9 |
|
11 |
| - <Target Name="GenerateNativeDllNameCs" |
12 |
| - Inputs="@(EmbeddedResource)" |
13 |
| - Outputs="$(NativeDllNamePath)"> |
14 |
| - <ReadLinesFromFile File="@(EmbeddedResource)" |
15 |
| - Condition=" '%(Filename)%(Extension)' == 'libgit2_filename.txt' "> |
16 |
| - <Output TaskParameter="Lines" PropertyName="libgit2FileName" /> |
17 |
| - </ReadLinesFromFile> |
18 |
| - <PropertyGroup> |
19 |
| - <NativeDllNameSourceLines> |
20 |
| - namespace LibGit2Sharp.Core |
21 |
| - { |
22 |
| - internal static class NativeDllName |
23 |
| - { |
24 |
| - public const string Name = "$(libgit2FileName)"%3b |
25 |
| - } |
26 |
| - } |
27 |
| - </NativeDllNameSourceLines> |
28 |
| - </PropertyGroup> |
29 |
| - <WriteLinesToFile File="$(NativeDllNamePath)" |
30 |
| - Lines="$(NativeDllNameSourceLines)" |
31 |
| - Overwrite="true" /> |
32 |
| - <ItemGroup> |
33 |
| - <Compile Include="$(NativeDllNamePath)" /> |
34 |
| - <FileWrites Include="$(NativeDllNamePath)" /> |
35 |
| - </ItemGroup> |
36 |
| - </Target> |
37 |
| - |
38 |
| - <Target Name="AddNativeDllCommitShaToBuildMetadata" |
39 |
| - BeforeTargets="GetBuildVersion" |
40 |
| - Condition=" '$(IsCrossTargetingBuild)' != 'true' "> |
41 |
| - <ReadLinesFromFile File="@(EmbeddedResource)" |
42 |
| - Condition=" '%(Filename)%(Extension)' == 'libgit2_hash.txt' "> |
43 |
| - <Output TaskParameter="Lines" PropertyName="libgit2hash" /> |
44 |
| - </ReadLinesFromFile> |
45 |
| - |
46 |
| - <ItemGroup> |
47 |
| - <BuildMetadata Include="LibGit2-$(libgit2hash.Substring(0,7))" /> |
48 |
| - </ItemGroup> |
49 |
| - </Target> |
50 |
| - |
51 |
| - <Target Name="GenerateCommitIdVersion" |
52 |
| - DependsOnTargets="GetBuildVersion"> |
53 |
| - <WriteLinesToFile File="$(CommitIdVersionPath)" |
54 |
| - Lines="$(GitCommitId)" |
55 |
| - Overwrite="true" /> |
56 |
| - |
57 |
| - <ItemGroup> |
58 |
| - <EmbeddedResource Include="$(CommitIdVersionPath)"> |
59 |
| - <LogicalName>$(RootNamespace).libgit2sharp_hash.txt</LogicalName> |
60 |
| - </EmbeddedResource> |
61 |
| - </ItemGroup> |
62 |
| - </Target> |
| 10 | + |
| 11 | + <Target Name="GenerateNativeDllNameCs" Inputs="@(EmbeddedResource)" Outputs="$(NativeDllNamePath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties"> |
| 12 | + |
| 13 | + <ReadLinesFromFile File="@(EmbeddedResource)" Condition=" '%(Filename)%(Extension)' == 'libgit2_filename.txt' "> |
| 14 | + <Output TaskParameter="Lines" PropertyName="libgit2FileName" /> |
| 15 | + </ReadLinesFromFile> |
| 16 | + |
| 17 | + <PropertyGroup> |
| 18 | + <NativeDllNameSourceLines> |
| 19 | +namespace LibGit2Sharp.Core |
| 20 | +{ |
| 21 | + internal static class NativeDllName |
| 22 | + { |
| 23 | + public const string Name = "$(libgit2FileName)"%3b |
| 24 | + } |
| 25 | +} |
| 26 | + </NativeDllNameSourceLines> |
| 27 | + </PropertyGroup> |
| 28 | + |
| 29 | + <WriteLinesToFile File="$(NativeDllNamePath)" Lines="$(NativeDllNameSourceLines)" Overwrite="true" /> |
| 30 | + |
| 31 | + <ItemGroup> |
| 32 | + <Compile Include="$(NativeDllNamePath)" /> |
| 33 | + <FileWrites Include="$(NativeDllNamePath)" /> |
| 34 | + </ItemGroup> |
| 35 | + |
| 36 | + </Target> |
| 37 | + |
| 38 | + |
| 39 | + <Target Name="GenerateUniqueIdentifierCs" Inputs="$(MSBuildThisFileFullPath);$(MSBuildAllProjects);@(Compile)" Outputs="$(UniqueIdentifierPath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties"> |
| 40 | + |
| 41 | + <PropertyGroup> |
| 42 | + <UniqueIdSourceLines> |
| 43 | +namespace LibGit2Sharp.Core |
| 44 | +{ |
| 45 | + internal static class UniqueId |
| 46 | + { |
| 47 | + public const string UniqueIdentifier = "$([System.Guid]::NewGuid())"%3b |
| 48 | + } |
| 49 | +} |
| 50 | + </UniqueIdSourceLines> |
| 51 | + </PropertyGroup> |
| 52 | + |
| 53 | + <WriteLinesToFile File="$(UniqueIdentifierPath)" Lines="$(UniqueIdSourceLines)" Overwrite="true" /> |
| 54 | + |
| 55 | + <ItemGroup> |
| 56 | + <Compile Include="$(UniqueIdentifierPath)" /> |
| 57 | + <FileWrites Include="$(UniqueIdentifierPath)" /> |
| 58 | + </ItemGroup> |
| 59 | + |
| 60 | + </Target> |
| 61 | + |
| 62 | + |
| 63 | + <Target Name="AddNativeDllCommitShaToBuildMetadata" BeforeTargets="GetBuildVersion"> |
| 64 | + |
| 65 | + <ReadLinesFromFile File="@(EmbeddedResource)" Condition=" '%(Filename)%(Extension)' == 'libgit2_hash.txt' "> |
| 66 | + <Output TaskParameter="Lines" PropertyName="libgit2hash" /> |
| 67 | + </ReadLinesFromFile> |
| 68 | + |
| 69 | + <ItemGroup> |
| 70 | + <BuildMetadata Include="libgit2-$(libgit2hash.Substring(0,7))" /> |
| 71 | + </ItemGroup> |
| 72 | + |
| 73 | + </Target> |
63 | 74 |
|
64 | 75 | </Project>
|
0 commit comments