Skip to content

Commit b18ae14

Browse files
dschogitster
authored andcommitted
vcxproj: also link-or-copy builtins
The default location for `.exe` files linked by Visual Studio depends on the mode (debug vs release) and the architecture. Meaning: after a full build, there is a `git.exe` in the top-level directory, but none of the built-ins are linked.. When running a test script in Git Bash, it therefore would pick up the wrong, say, `git-receive-pack.exe`: the one installed at the same time as the Git Bash. Absolutely not what we want. We want to have confidence that our test covers the MSVC-built Git executables, and not some random stuff. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 976aaed commit b18ae14

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

config.mak.uname

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,21 @@ vcxproj:
703703
perl contrib/buildsystems/generate -g Vcxproj
704704
git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
705705

706+
# Generate the LinkOrCopyBuiltins.targets file
707+
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
708+
echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
709+
for name in $(BUILT_INS);\
710+
do \
711+
echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
712+
done && \
713+
for name in $(REMOTE_CURL_ALIASES); \
714+
do \
715+
echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
716+
done && \
717+
echo ' </Target>' && \
718+
echo '</Project>') >git/LinkOrCopyBuiltins.targets
719+
git add -f git/LinkOrCopyBuiltins.targets
720+
706721
# Add command-list.h
707722
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 command-list.h
708723
git add -f command-list.h

contrib/buildsystems/Generators/Vcxproj.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ EOM
274274
</Target>
275275
EOM
276276
}
277+
if ($target eq 'git') {
278+
print F " <Import Project=\"LinkOrCopyBuiltins.targets\" />\n";
279+
}
277280
print F << "EOM";
278281
</Project>
279282
EOM

0 commit comments

Comments
 (0)