Skip to content

Commit 21bb69c

Browse files
dschoGit for Windows Build Agent
authored andcommitted
msvc: add a Makefile target to pre-generate the VS solution
The entire idea of generating the VS solution makes only sense if we generate it via Continuous Integration; otherwise potential users would still have to download the entire Git for Windows SDK. So let's just add a target in the Makefile that can be used to generate said solution; The generated files will then be committed so that they can be pushed to a branch ready to check out by Visual Studio users. To make things even more useful, we also generate and commit other files that are required to run the test suite, such as templates and bin-wrappers: with this, developers can run the test suite in a regular Git Bash (that is part of a regular Git for Windows installation) after building the solution in Visual Studio. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 96caeb9 commit 21bb69c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

config.mak.uname

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,65 @@ endif
458458
X = .exe
459459

460460
compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
461+
462+
vcxproj:
463+
# Require clean work tree
464+
git update-index -q --refresh && \
465+
git diff-files --quiet && \
466+
git diff-index --cached --quiet HEAD --
467+
468+
# Make .vcxproj files and add them
469+
unset QUIET_GEN QUIET_BUILT_IN; \
470+
perl contrib/buildsystems/generate -g Vcxproj
471+
git add -f git.sln {*,*/lib,t/helper/*}/{packages.config,*.vcxproj}
472+
473+
# Add command-list.h
474+
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 command-list.h
475+
git add -f command-list.h
476+
477+
# Add scripts
478+
rm -f perl/perl.mak
479+
$(MAKE) MSVC=1 prefix=/mingw64 \
480+
$(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
481+
# Strip out the sane tool path, needed only for building
482+
sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
483+
git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
484+
485+
# Add Perl module
486+
$(MAKE) $(LIB_PERL_GEN)
487+
git add -f perl/build
488+
489+
# Add bin-wrappers, for testing
490+
rm -rf bin-wrappers/
491+
$(MAKE) MSVC=1 prefix=/mingw64 $(test_bindir_programs)
492+
# Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
493+
# path of the repository is not hard-coded (GIT_EXEC_PATH will be set
494+
# by test-lib.sh according to the current setup)
495+
sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
496+
\1="$$(cygpath -u "$$\1")"/' \
497+
-e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
498+
# Ensure that test-* helpers find the .dll files copied to top-level
499+
sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
500+
# We do not want to force hard-linking builtins
501+
sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
502+
bin-wrappers/git-{receive-pack,upload-archive}
503+
git add -f $(test_bindir_programs)
504+
# remote-ext is a builtin, but invoked as if it were external
505+
sed 's|receive-pack|remote-ext|g' \
506+
<bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
507+
git add -f bin-wrappers/git-remote-ext
508+
509+
# Add templates
510+
$(MAKE) -C templates
511+
git add -f templates/boilerplates.made templates/blt/
512+
513+
# Add build options
514+
$(MAKE) MSVC=1 prefix=/mingw64 GIT-BUILD-OPTIONS
515+
git add -f GIT-BUILD-OPTIONS
516+
517+
# Commit the whole shebang
518+
git commit -m "Generate Visual Studio solution" \
519+
-m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"
461520
endif
462521
ifeq ($(uname_S),Interix)
463522
NO_INITGROUPS = YesPlease

0 commit comments

Comments
 (0)