Vcproj.pm: list git.exe first to be startup project

Visual Studio takes the first listed application/library as the default startup project [1]. Detect the 'git' project and place it at the head of the project list, rather than at the tail. Export the apps list before libs list for both the projects and global structures of the .sln file. [1] http://stackoverflow.com/questions/1238553/ vs2008-where-is-the-startup-project-setting-stored-for-a-solution "In the solution file, there are a list of pseudo-XML "Project" entries. It turns out that whatever is the first one ends up as the Startup Project, unless it’s overridden in the suo file. Argh. I just rearranged the order in the file and it’s good." "just moving the pseudo-xml isn't enough. You also have to move the group of entries in the "GlobalSection(ProjectConfigurationPlatforms) = postSolution" group that has the GUID of the project you moved to the top. So there are two places to move lines." Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Philip Oakley committed Jul 29, 2019 at 13:08 UTC 92e2f6e0533df466425c92f6ce7ae10df6d37a2d
1 file changed +19 -14
contrib/buildsystems/Generators/Vcproj.pm
+19 -14
@@ -513,20 +513,18 @@ sub createGlueProject {
513 foreach (@apps) {
514 $_ =~ s/\//_/g;
515 $_ =~ s/\.exe//;
516 - push(@tmp, $_);
516 + if ($_ eq "git" ) {
517 + unshift(@tmp, $_);
518 + } else {
519 + push(@tmp, $_);
520 + }
521 }
522 @apps = @tmp;
523
524 open F, ">git.sln" || die "Could not open git.sln for writing!\n";
525 binmode F, ":crlf";
526 print F "$SLN_HEAD";
523 - foreach (@libs) {
524 - my $libname = $_;
525 - my $uuid = $build_structure{"LIBS_${libname}_GUID"};
526 - print F "$SLN_PRE";
527 - print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
528 - print F "$SLN_POST";
529 - }
527 +
528 my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
529 my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
530 foreach (@apps) {
@@ -540,6 +538,13 @@ sub createGlueProject {
538 print F " EndProjectSection";
539 print F "$SLN_POST";
540 }
541 + foreach (@libs) {
542 + my $libname = $_;
543 + my $uuid = $build_structure{"LIBS_${libname}_GUID"};
544 + print F "$SLN_PRE";
545 + print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
546 + print F "$SLN_POST";
547 + }
548
549 print F << "EOM";
550 Global
@@ -551,17 +556,17 @@ EOM
556 print F << "EOM";
557 GlobalSection(ProjectConfigurationPlatforms) = postSolution
558 EOM
554 - foreach (@libs) {
555 - my $libname = $_;
556 - my $uuid = $build_structure{"LIBS_${libname}_GUID"};
559 + foreach (@apps) {
560 + my $appname = $_;
561 + my $uuid = $build_structure{"APPS_${appname}_GUID"};
562 print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
563 print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
564 print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
565 print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
566 }
562 - foreach (@apps) {
563 - my $appname = $_;
564 - my $uuid = $build_structure{"APPS_${appname}_GUID"};
567 + foreach (@libs) {
568 + my $libname = $_;
569 + my $uuid = $build_structure{"LIBS_${libname}_GUID"};
570 print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
571 print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
572 print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";