1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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 <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
This commit is contained in:
Stefan Metzmacher 2021-08-25 16:33:03 +02:00 committed by Andreas Schneider
parent 9b9fd2a0d9
commit 5d53b848f6
6 changed files with 21 additions and 15 deletions

View File

@ -2,7 +2,7 @@
import os, sys, re 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.Logs import debug
from waflib.Configure import conf from waflib.Configure import conf
from waflib import ConfigSet from waflib import ConfigSet
@ -1087,6 +1087,9 @@ def load_samba_deps(bld, tgt_list):
def check_project_rules(bld): def check_project_rules(bld):
'''check the project rules - ensuring the targets are sane''' '''check the project rules - ensuring the targets are sane'''
if bld.__class__.__name__ == "ClangDbContext":
return
loops = {} loops = {}
inc_loops = {} inc_loops = {}
@ -1167,6 +1170,13 @@ def check_project_rules(bld):
Logs.info("Project rules pass") 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): def CHECK_PROJECT_RULES(bld):
'''enable checking of project targets for sanity''' '''enable checking of project targets for sanity'''

View File

@ -132,9 +132,6 @@ def options(opt):
action="store_true", action="store_true",
dest='undefined_sanitizer', dest='undefined_sanitizer',
default=False) 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', gr.add_option('--enable-libfuzzer',
help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"), 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) action="store_true", dest='enable_libfuzzer', default=False)
@ -660,9 +657,6 @@ struct foo bar = { .y = 'X', .x = 1 };
conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1) conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1)
conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS 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 # Create a symlink of the compile db for clangd
symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'),
os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), os.path.join(conf.srcnode.abspath(), 'compile_commands.json'),

View File

@ -786,7 +786,6 @@ tasks = {
"PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} " "PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} "
"./configure.developer ${PREFIX} " "./configure.developer ${PREFIX} "
"--with-selftest-prefix=./bin/ab " "--with-selftest-prefix=./bin/ab "
"--enable-clangdb "
"--with-cluster-support " "--with-cluster-support "
"--without-ad-dc " "--without-ad-dc "
"--bundled-libraries=!tdb"), "--bundled-libraries=!tdb"),

View File

@ -1,4 +1,5 @@
from waflib import Logs from waflib import Logs
if bld.__class__.__name__ != "ClangDbContext":
Logs.info("\tSelected embedded Heimdal build") Logs.info("\tSelected embedded Heimdal build")
bld.RECURSE('source4/heimdal_build') bld.RECURSE('source4/heimdal_build')

View File

@ -1,4 +1,5 @@
from waflib import Logs from waflib import Logs
if bld.__class__.__name__ != "ClangDbContext":
Logs.info("\tSelected system Heimdal build") Logs.info("\tSelected system Heimdal build")
bld.RECURSE('source4/heimdal_build') bld.RECURSE('source4/heimdal_build')

View File

@ -1,4 +1,5 @@
from waflib import Logs from waflib import Logs
if bld.__class__.__name__ != "ClangDbContext":
Logs.info("\tSelected system MIT krb5 libraries, Heimdal use is disabled") Logs.info("\tSelected system MIT krb5 libraries, Heimdal use is disabled")
#bld.RECURSE('source4/heimdal_build') #bld.RECURSE('source4/heimdal_build')