8000 Generate NativeDllName in tests · vrkcse2011/libgit2sharp@9aadf0b · GitHub
[go: up one dir, main page]

Skip to content

Commit 9aadf0b

Browse files
committed
Generate NativeDllName in tests
1 parent fe71caa commit 9aadf0b

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@
3737
<Content Include="@(_TestAppFile)" CopyToOutputDirectory="PreserveNewest" Visible="false" />
3838
</ItemGroup>
3939
</Target>
40+
41+
<Import Project="..\Targets\GenerateNativeDllName.targets" />
4042

4143
</Project>

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.0" />
3939
</ItemGroup>
4040

41-
<Import Project="CodeGenerator.targets" />
41+
<Import Project="..\Targets\CodeGenerator.targets" />
42+
<Import Project="..\Targets\GenerateNativeDllName.targets" />
4243

4344
<Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
4445
<PropertyGroup>

LibGit2Sharp/CodeGenerator.targets renamed to Targets/CodeGenerator.targets

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,12 @@
66

77
<Target Name="DefineProperties">
88
<PropertyGroup>
9-
<NativeDllNamePath>$(IntermediateOutputPath)NativeDllName.g.cs</NativeDllNamePath>
109
<UniqueIdentifierPath>$(IntermediateOutputPath)UniqueIdentifier.g.cs</UniqueIdentifierPath>
1110
<AssemblyCommitIdsPath>$(IntermediateOutputPath)AssemblyCommitIds.g.cs</AssemblyCommitIdsPath>
1211
</PropertyGroup>
1312
</Target>
1413

1514

16-
<Target Name="GenerateNativeDllNameCs" Inputs="$(libgit2_propsfile)" Outputs="$(NativeDllNamePath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties">
17-
<PropertyGroup>
18-
<NativeDllNameSourceLines>
19-
namespace LibGit2Sharp.Core
20-
{
21-
internal static class NativeDllName
22-
{
23-
public const string Name = "$(libgit2_filename)"%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-
3915
<Target Name="GenerateUniqueIdentifierCs" Inputs="$(MSBuildThisFileFullPath);$(MSBuildAllProjects);@(Compile)" Outputs="$(UniqueIdentifierPath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineProperties">
4016

4117
<PropertyGroup>

Targets/GenerateNativeDllName.targets

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
</PropertyGroup>
6+
7+
<Target Name="DefineNativeDllName">
8+
<PropertyGroup>
9+
<NativeDllNamePath>$(IntermediateOutputPath)NativeDllName.g.cs</NativeDllNamePath>
10+
</PropertyGroup>
11+
</Target>
12+
13+
<Target Name="GenerateNativeDllNameCs" Inputs="$(libgit2_propsfile)" Outputs="$(NativeDllNamePath)" BeforeTargets="CoreCompile" DependsOnTargets="DefineNativeDllName">
14+
<PropertyGroup>
15+
<NativeDllNameSourceLines>
16+
namespace LibGit2Sharp.Core
17+
{
18+
internal static class NativeDllName
19+
{
20+
public const string Name = "$(libgit2_filename)"%3b
21+
}
22+
}
23+
</NativeDllNameSourceLines>
24+
</PropertyGroup>
25+
26+
<WriteLinesToFile File="$(NativeDllNamePath)" Lines="$(NativeDllNameSourceLines)" Overwrite="true" />
27+
28+
<ItemGroup>
29+
<Compile Include="$(NativeDllNamePath)" />
30+
<FileWrites Include="$(NativeDllNamePath)" />
31+
</ItemGroup>
32+
</Target>
33+
</Project>

0 commit comments

Comments
 (0)
0