From 5d53b848f60efbb71e4cd2f51f33a06369ca9055 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Aug 2021 16:33:03 +0200 Subject: wafsamba: always generate compile_commands.json again, but only when the samba dependencies changed This means the costs of the generation on a empty build are not paid anymore, which was the reason for the explicit --enable-clangdb option. Pair-Programmed-With: Andreas Schneider Signed-off-by: Stefan Metzmacher Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Thu Aug 26 13:06:09 UTC 2021 on sn-devel-184 --- buildtools/wafsamba/samba_deps.py | 12 +++++++++++- buildtools/wafsamba/wscript | 14 ++++---------- script/autobuild.py | 1 - wscript_build_embedded_heimdal | 3 ++- wscript_build_system_heimdal | 3 ++- wscript_build_system_mitkrb5 | 3 ++- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index 29bebc349c4..cb8acfae34e 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -2,7 +2,7 @@ import os, sys, re -from waflib import Build, Options, Logs, Utils, Errors +from waflib import Build, Options, Logs, Utils, Errors, Scripting from waflib.Logs import debug from waflib.Configure import conf from waflib import ConfigSet @@ -1087,6 +1087,9 @@ def load_samba_deps(bld, tgt_list): def check_project_rules(bld): '''check the project rules - ensuring the targets are sane''' + if bld.__class__.__name__ == "ClangDbContext": + return + loops = {} inc_loops = {} @@ -1167,6 +1170,13 @@ def check_project_rules(bld): Logs.info("Project rules pass") + timer = Utils.Timer() + + bld.load('clang_compilation_database') + Scripting.run_command('clangdb') + + debug("deps: clang_compilation_database: %s" % str(timer)) + def CHECK_PROJECT_RULES(bld): '''enable checking of project targets for sanity''' diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 1aadb9570e1..7be61e80abb 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -132,9 +132,6 @@ def options(opt): action="store_true", dest='undefined_sanitizer', default=False) - gr.add_option('--enable-clangdb', - help=("Enable use of clang_compilation_database"), - action="store_true", dest='enable_clangdb', default=False) gr.add_option('--enable-libfuzzer', help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"), action="store_true", dest='enable_libfuzzer', default=False) @@ -660,13 +657,10 @@ struct foo bar = { .y = 'X', .x = 1 }; conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1) conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS - conf.env.enable_clangdb = Options.options.enable_clangdb - if conf.env.enable_clangdb: - conf.load('clang_compilation_database') - # Create a symlink of the compile db for clangd - symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), - os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), - force=True) + # Create a symlink of the compile db for clangd + symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), + os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), + force=True) conf.SAMBA_BUILD_ENV() diff --git a/script/autobuild.py b/script/autobuild.py index 6a15722b263..9c343d1f29c 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -786,7 +786,6 @@ tasks = { "PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} " "./configure.developer ${PREFIX} " "--with-selftest-prefix=./bin/ab " - "--enable-clangdb " "--with-cluster-support " "--without-ad-dc " "--bundled-libraries=!tdb"), diff --git a/wscript_build_embedded_heimdal b/wscript_build_embedded_heimdal index 84829fe8b62..7b0a8af4489 100644 --- a/wscript_build_embedded_heimdal +++ b/wscript_build_embedded_heimdal @@ -1,4 +1,5 @@ from waflib import Logs -Logs.info("\tSelected embedded Heimdal build") +if bld.__class__.__name__ != "ClangDbContext": + Logs.info("\tSelected embedded Heimdal build") bld.RECURSE('source4/heimdal_build') diff --git a/wscript_build_system_heimdal b/wscript_build_system_heimdal index b97944b44c3..4b3a46d88f9 100644 --- a/wscript_build_system_heimdal +++ b/wscript_build_system_heimdal @@ -1,4 +1,5 @@ from waflib import Logs -Logs.info("\tSelected system Heimdal build") +if bld.__class__.__name__ != "ClangDbContext": + Logs.info("\tSelected system Heimdal build") bld.RECURSE('source4/heimdal_build') diff --git a/wscript_build_system_mitkrb5 b/wscript_build_system_mitkrb5 index b54e2ded22e..03c8fbc2a93 100644 --- a/wscript_build_system_mitkrb5 +++ b/wscript_build_system_mitkrb5 @@ -1,4 +1,5 @@ from waflib import Logs -Logs.info("\tSelected system MIT krb5 libraries, Heimdal use is disabled") +if bld.__class__.__name__ != "ClangDbContext": + Logs.info("\tSelected system MIT krb5 libraries, Heimdal use is disabled") #bld.RECURSE('source4/heimdal_build') -- cgit v1.2.1