forked from microsoft/VFSForGit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
140 lines (121 loc) · 6.42 KB
/
Directory.Build.props
File metadata and controls
140 lines (121 loc) · 6.42 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<Project>
<!-- Import version props -->
<Import Project="Version.props" />
<!-- Common project properties -->
<PropertyGroup>
<RepoPath>$(MSBuildThisFileDirectory)</RepoPath>
<RepoSrcPath>$(RepoPath)</RepoSrcPath>
<RepoOutPath>$(RepoPath)..\out\</RepoOutPath>
<ProjectOutPath>$(RepoOutPath)$(MSBuildProjectName)\</ProjectOutPath>
<BuildPackagesPath>$(RepoPath)..\packages\</BuildPackagesPath>
<!--
Ensure `msbuild /t:restore` restores both PackageReference and
package.config styles of NuGet package references.
Native/C++ projects do not support the new PackageReference style,
but our .NET projects do.
-->
<RestorePackagesConfig>true</RestorePackagesConfig>
<!--
Set to true when building locally to allow Terrapin to upload missing
vcpkg assets to the shared cache. CI agents must keep this false so
vcpkg uses x-block-origin (fail fast instead of attempting direct
downloads from the public internet, which is blocked at the agent
network layer).
-->
<IsLocalBuild Condition="'$(IsLocalBuild)' == ''">false</IsLocalBuild>
<!--
Set to true on the official release pipeline to route vcpkg asset
downloads through the internal Terrapin cache via the
Microsoft.Build.Vcpkg SDK (an internal-only package). Defaults to
false so external contributors and the public GitHub Actions
PR-validation workflow continue to use the standard vcpkg flow
with direct downloads from the public internet.
-->
<UseTerrapinAssetCache Condition="'$(UseTerrapinAssetCache)' == ''">false</UseTerrapinAssetCache>
</PropertyGroup>
<!-- Managed project properties -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<TargetFramework>net10.0-windows10.0.17763.0</TargetFramework>
<LangVersion>latest</LangVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
<SelfContained>true</SelfContained>
<PublishAot>true</PublishAot>
<OptimizationPreference>Speed</OptimizationPreference>
<BaseOutputPath>$(ProjectOutPath)bin\</BaseOutputPath>
<BaseIntermediateOutputPath>$(ProjectOutPath)obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<!--
Static native linking: embed libgit2 directly into AOT-compiled executables.
vcpkg builds a static git2.lib (via the x64-windows-static-aot triplet) which
the NativeAOT linker links into the final executable. This eliminates the
"DLL missing" crash vector for libgit2.
How it works:
1. vcpkg install produces git2.lib + transitive deps (pcre, zlib, etc.)
2. <NativeLibrary> items tell the NativeAOT linker where to find the .lib files
3. <DirectPInvoke> tells the linker to resolve P/Invoke calls at link time
4. libgit2_filename is overridden from "git2-XXXXXXX" (NuGet) to "git2" (vcpkg)
A side benefit of this approach: we can apply patches to libgit2 that haven't
been included in an official release yet, via the overlay port in overlays/.
To rebuild vcpkg libs after overlay changes:
vcpkg install [triplet x64-windows-static-aot] [overlay-triplets=triplets] [overlay-ports=overlays]
See THIRD-PARTY-NOTICES.md for license details on these native libraries.
-->
<PropertyGroup Condition="'$(PublishAot)' == 'true'">
<VcpkgInstalledDir>$(RepoOutPath)vcpkg_installed\static\x64-windows-static-aot\</VcpkgInstalledDir>
</PropertyGroup>
<!-- Set libgit2 library name unconditionally — all builds use vcpkg-sourced libgit2 -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<libgit2_filename>git2</libgit2_filename>
</PropertyGroup>
<ItemGroup Condition="'$(PublishAot)' == 'true'">
<DirectPInvoke Include="git2" />
<!-- libgit2 static library and its transitive dependencies -->
<NativeLibrary Include="$(VcpkgInstalledDir)lib\git2.lib" />
<NativeLibrary Include="$(VcpkgInstalledDir)lib\pcre.lib" />
<NativeLibrary Include="$(VcpkgInstalledDir)lib\http_parser.lib" />
<NativeLibrary Include="$(VcpkgInstalledDir)lib\zs.lib" />
<!-- Windows system libraries required by libgit2 (WinHTTP TLS backend) -->
<NativeLibrary Include="winhttp.lib" />
<NativeLibrary Include="crypt32.lib" />
<NativeLibrary Include="rpcrt4.lib" />
<NativeLibrary Include="secur32.lib" />
</ItemGroup>
<!--
Non-AOT projects (tests) need git2.dll for runtime P/Invoke.
Copy from the vcpkg dynamic build output.
-->
<ItemGroup Condition="'$(PublishAot)' != 'true' and '$(MSBuildProjectExtension)' == '.csproj' and '$(IncludeBuildOutput)' != 'false'">
<Content Include="$(RepoOutPath)vcpkg_installed\dynamic\x64-windows-dynamic\bin\git2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<Link>git2.dll</Link>
</Content>
<Content Include="$(RepoOutPath)vcpkg_installed\dynamic\x64-windows-dynamic\bin\pcre.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<Link>pcre.dll</Link>
</Content>
<Content Include="$(RepoOutPath)vcpkg_installed\dynamic\x64-windows-dynamic\bin\z.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<Link>z.dll</Link>
</Content>
</ItemGroup>
<!-- Native project properties -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
<Platform>x64</Platform>
<OutDir>$(ProjectOutPath)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectOutPath)intermediate\$(Platform)\$(Configuration)\</IntDir>
<GeneratedIncludePath>$(IntDir)include\</GeneratedIncludePath>
<!--
Make sure that we don't accidentally use Windows APIs only available after
Windows 10 build 16299 (aka '1709', 'RS3', and 'Fall Creators Update').
The minimum Windows version that includes the final design of the
Projected File System (ProjFS) APIs was actually Windows 10 version 1809
(build 17763), but VFS for Git also supports using the older design of the
ProjFS APIs from that version.
-->
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup>
</Project>