Skip to content

Commit d5e9289

Browse files
committed
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 787bfe4 commit d5e9289

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

config.mak.uname

+4-4
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ vcxproj:
755755

756756
# Make .vcxproj files and add them
757757
perl contrib/buildsystems/generate -g Vcxproj
758-
git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
758+
git add -f git.sln {*,*/lib.proj,t/helper/*}/*.vcxproj
759759

760760
# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
761761
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
@@ -765,16 +765,16 @@ vcxproj:
765765
echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
766766
done && \
767767
echo ' </Target>' && \
768-
echo '</Project>') >git/LinkOrCopyBuiltins.targets
768+
echo '</Project>') >git.proj/LinkOrCopyBuiltins.targets
769769
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
770770
echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
771771
for name in $(REMOTE_CURL_ALIASES); \
772772
do \
773773
echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
774774
done && \
775775
echo ' </Target>' && \
776-
echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
777-
git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
776+
echo '</Project>') >git-remote-http.proj/LinkOrCopyRemoteHttp.targets
777+
git add -f git.proj/LinkOrCopyBuiltins.targets git-remote-http.proj/LinkOrCopyRemoteHttp.targets
778778

779779
# Add generated headers
780780
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)

contrib/buildsystems/Generators/Vcxproj.pm

+10-8
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";
@@ -237,7 +239,7 @@ EOM
237239

238240
print F << "EOM";
239241
<ItemGroup>
240-
<ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
242+
<ProjectReference Include="$cdup\\libgit.proj\\libgit.vcxproj">
241243
<Project>$uuid_libgit</Project>
242244
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
243245
</ProjectReference>
@@ -252,7 +254,7 @@ EOM
252254
}
253255
if (!($name =~ 'xdiff')) {
254256
print F << "EOM";
255-
<ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
257+
<ProjectReference Include="$cdup\\xdiff\\lib.proj\\xdiff_lib.vcxproj">
256258
<Project>$uuid_xdiff_lib</Project>
257259
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
258260
</ProjectReference>
@@ -261,7 +263,7 @@ EOM
261263
if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
262264
my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
263265
print F << "EOM";
264-
<ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
266+
<ProjectReference Include="$cdup\\vcs-svn\\lib.proj\\vcs-svn_lib.vcxproj">
265267
<Project>$uuid_vcs_svn_lib</Project>
266268
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
267269
</ProjectReference>
@@ -338,7 +340,7 @@ sub createGlueProject {
338340
my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
339341
$vcxproj =~ s/\//\\/g;
340342
$appname =~ s/.*\///;
341-
print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
343+
print F "\"${appname}.proj\", \"${vcxproj}\", \"${uuid}\"";
342344
print F "$SLN_POST";
343345
}
344346
foreach (@libs) {
@@ -348,7 +350,7 @@ sub createGlueProject {
348350
my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
349351
$vcxproj =~ s/\//\\/g;
350352
$libname =~ s/\//_/g;
351-
print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
353+
print F "\"${libname}.proj\", \"${vcxproj}\", \"${uuid}\"";
352354
print F "$SLN_POST";
353355
}
354356

0 commit comments

Comments
 (0)