Skip to content

Commit 2098f14

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 10394da commit 2098f14

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
@@ -447,6 +447,65 @@ endif
447447
X = .exe
448448

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

0 commit comments

Comments
 (0)