wafsamba: always generate compile_commands.json again, but only when the samba depend...
authorStefan Metzmacher <metze@samba.org>
Wed, 25 Aug 2021 14:33:03 +0000 (16:33 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 26 Aug 2021 13:06:09 +0000 (13:06 +0000)
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 <asn@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 26 13:06:09 UTC 2021 on sn-devel-184

buildtools/wafsamba/samba_deps.py
buildtools/wafsamba/wscript
script/autobuild.py
wscript_build_embedded_heimdal
wscript_build_system_heimdal
wscript_build_system_mitkrb5

index 29bebc349c4264154c1a4f609ad2bf6dfbb1d267..cb8acfae34e8b5615fce839b9f44237b032f3e8b 100644 (file)
@@ -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'''
index 1aadb9570e1b087362d731b8e2745382018ffeeb..7be61e80abb4367eec6d070477cb253ba0753330 100644 (file)
@@ -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()
 
index 6a15722b263f16e6f70290bbf59cee478f877869..9c343d1f29c0fb0fbacc73db091b48d43d8ad433 100755 (executable)
@@ -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"),
index 84829fe8b622a237cb76e4d3624f4a040f18eb5d..7b0a8af448963ca796fb835db42e749b0c1f7a9f 100644 (file)
@@ -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')
index b97944b44c3e3d6f87feac9d43e6aaaa754c7217..4b3a46d88f903d641ee6f171c822fc67c4fce834 100644 (file)
@@ -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')
index b54e2ded22e132286dfed96bb7dd8e28cd25ffb6..03c8fbc2a93c3a9db2de3887afa693602d45c8d0 100644 (file)
@@ -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')