Skip to content

Commit 6da208a

Browse files
dschoGit for Windows Build Agent
authored andcommitted
vcxproj: unclash project directories with build outputs
It already caused problems with the test suite that the directory containing `git.vcxproj` is called the same as the Git executable without its file extension: `./git` is ambiguous, it could refer both to the directory `git/` as well as to `git.exe`. Now there is one more problem: when our GitHub workflow runs on the `vs/master` branch, it fails in all but the Windows builds, as they want to write the file `git` but there is already a directory in the way. Let's just go ahead and append `.proj` to all of those directories, e.g. `git.proj/` instead of `git/`. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 1c12b51 commit 6da208a

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

config.mak.uname

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ vcxproj:
709709
# Make .vcxproj files and add them
710710
unset QUIET_GEN QUIET_BUILT_IN; \
711711
perl contrib/buildsystems/generate -g Vcxproj
712-
git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
712+
git add -f git.sln {*,*/lib.proj,t/helper/*}/*.vcxproj
713713

714714
# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
715715
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
@@ -719,16 +719,16 @@ vcxproj:
719719
echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
720720
done && \
721721
echo ' </Target>' && \
722-
echo '</Project>') >git/LinkOrCopyBuiltins.targets
722+
echo '</Project>') >git.proj/LinkOrCopyBuiltins.targets
723723
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
724724
echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
725725
for name in $(REMOTE_CURL_ALIASES); \
726726
do \
727727
echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
728728
done && \
729729
echo ' </Target>' && \
730-
echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
731-
git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
730+
echo '</Project>') >git-remote-http.proj/LinkOrCopyRemoteHttp.targets
731+
git add -f git.proj/LinkOrCopyBuiltins.targets git-remote-http.proj/LinkOrCopyRemoteHttp.targets
732732

733733
# Add command-list.h and config-list.h
734734
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 config-list.h command-list.h

contrib/buildsystems/Generators/Vcxproj.pm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ sub createProject {
5858
my $uuid = generate_guid($name);
5959
$$build_structure{"$prefix${target}_GUID"} = $uuid;
6060
my $vcxproj = $target;
61-
$vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
62-
$vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
61+
$vcxproj =~ s/(.*\/)?(.*)/$&.proj\/$2.vcxproj/;
62+
$vcxproj =~ s/([^\/]*)(\/lib\.proj)\/(lib.vcxproj)/$1$2\/$1_$3/;
6363
$$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
6464

6565
my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
@@ -89,7 +89,9 @@ sub createProject {
8989
$defines =~ s/>/&gt;/g;
9090
$defines =~ s/\'//g;
9191

92-
die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
92+
my $dir = $vcxproj;
93+
$dir =~ s/\/[^\/]*$//;
94+
die "Could not create the directory $dir for $label project!\n" unless (-d "$dir" || mkdir "$dir");
9395

9496
open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
9597
binmode F, ":crlf :utf8";
@@ -236,14 +238,14 @@ EOM
236238

237239
print F << "EOM";
238240
<ItemGroup>
239-
<ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
241+
<ProjectReference Include="$cdup\\libgit.proj\\libgit.vcxproj">
240242
<Project>$uuid_libgit</Project>
241243
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
242244
</ProjectReference>
243245
EOM
244246
if (!($name =~ 'xdiff')) {
245247
print F << "EOM";
246-
<ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
248+
<ProjectReference Include="$cdup\\xdiff\\lib.proj\\xdiff_lib.vcxproj">
247249
<Project>$uuid_xdiff_lib</Project>
248250
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
249251
</ProjectReference>
@@ -252,7 +254,7 @@ EOM
252254
if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
253255
my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
254256
print F << "EOM";
255-
<ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
257+
<ProjectReference Include="$cdup\\vcs-svn\\lib.proj\\vcs-svn_lib.vcxproj">
256258
<Project>$uuid_vcs_svn_lib</Project>
257259
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
258260
</ProjectReference>
@@ -329,7 +331,7 @@ sub createGlueProject {
329331
my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
330332
$vcxproj =~ s/\//\\/g;
331333
$appname =~ s/.*\///;
332-
print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
334+
print F "\"${appname}.proj\", \"${vcxproj}\", \"${uuid}\"";
333335
print F "$SLN_POST";
334336
}
335337
foreach (@libs) {
@@ -339,7 +341,7 @@ sub createGlueProject {
339341
my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
340342
$vcxproj =~ s/\//\\/g;
341343
$libname =~ s/\//_/g;
342-
print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
344+
print F "\"${libname}.proj\", \"${vcxproj}\", \"${uuid}\"";
343345
print F "$SLN_POST";
344346
}
345347

0 commit comments

Comments
 (0)