From 13de75274b727428355eefd55176277a5f891c47 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 20 Nov 2017 09:04:51 +0100 Subject: clang-format: enforce coding style via Jenkins - factor out common code to a shared module, and quote path to the clang-format binary, just in case. - add a new check-last-commit script that is the CI equivalent of the exiting git pre-commit hook, but this one handles lack of clang-format as an error, not as a warning. - $LODE_HOME/opt/bin is supposed to be in PATH already, so not mentioning LODE_HOME in ClangFormat::find() explicitly. - if both COMPILER_PLUGINS and LODE_HOME is set, invoke solenv/clang-format/check-last-commit as part of 'make check' To test these changes as part of CI, fix a single style violation in an already committed, non-blacklisted file. This depends on the lode.git commit 496123bcae28e06c6d6aeda39a5afd1e1fb1fd98 (utils_Linux: install clang-format in the Jenkins case, 2017-11-16), otherwise erroring out on a not installed clang-format as part of the build would be a problem. Change-Id: Ib3110826194ff78a7f1bed1c3796147e92ccb3ba Reviewed-on: https://gerrit.libreoffice.org/44939 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- Makefile.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Makefile.in') diff --git a/Makefile.in b/Makefile.in index f7de9cce5528..afaa9085cbad 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,6 +19,7 @@ build_goal:=$(if $(filter build check,$(MAKECMDGOALS)),all)\ SRCDIR := @SRC_ROOT@ BUILDDIR := @BUILDDIR@ +COMPILER_PLUGINS := @COMPILER_PLUGINS@ GIT_BUILD := $(if $(wildcard $(SRCDIR)/.git),T) # Run autogen.sh if needed and force make to restart itself. @@ -262,6 +263,7 @@ bootstrap: check-if-root compilerplugins # with some translations like "build"->"all" for historic reasons # build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset) \ + $(if $(filter check,$(MAKECMDGOALS)),$(if $(COMPILER_PLUGINS),$(if $(LODE_HOME),clang-format-check))) \ install-gdb-printers $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal) ifeq ($(OS),IOS) @@ -452,6 +454,9 @@ dump-deps-png: dump-deps-sort: @$(SRCDIR)/bin/module-deps.pl -t $(MAKE) $(SRCDIR)/Makefile.gbuild +clang-format-check: + @$(SRCDIR)/solenv/clang-format/check-last-commit + define gb_Top_GbuildToIdeIntegration $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3.all) cd $(SRCDIR) && \ -- cgit