Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags
This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags. A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs
We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them. This CL prepares to reorder them
by splitting the global and local cflags into separate variables.
Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
Some language servers (vscode) seem to have started to rely on the
compiler being an absolute path recently. This updates the compdb
generator to match this expectation.
Bug: https://github.com/Microsoft/vscode-cpptools/issues/3112
Test: m nothing && m SOONG_GEN_COMPDB=1 SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
Test: Open vscode
Change-Id: Id146d69c2b808b23896132bbd4bc38ed5c7fd9c7
Some tools (eg ccls) require that the compiler in argv[0] of the
compdb be an actual compiler binary. Until now we had simply filled
that slot with /bin/false. This change fills it with the current
default clang binary instead.
Test: make -j50 SOONG_GEN_COMPDB=1 SOONG_GEN_COMPDB_DEBUG=1 SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
Test: Use ccls
Change-Id: I920e8d3113e398b629228070a904dbf1535856e0
compdb.go was incorrectly splitting compiler arguments. This could
cause empty strings to be included in compile_commands.json,
potentially confusing tools.
Bug: 117124308
Test: m checkbuild
Test: m SOONG_GEN_COMPDB=1 \
SOONG_GEN_COMPDB_DEBUG=1 \
SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
Examine $ANDROID_BUILD_TOP/compile_commands.json
Change-Id: I375baf255c50a1329cd644ac584d200aba9daa69
Some tools (i.e. you-complete-me) make use of a 'compdb' file
(compile_commands.json) that records (among other things) the
arguments needed to compile a file. These tools can use this with
libclang to provide semantic completions and perform other IDE
actions. This CL adds support for soong to generate a (simple)
compile_commands.json file.
Test: make SOONG_GEN_COMPDB=1 SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
examine $ANDROID_BUILD_TOP/compile_commands.json
Change-Id: I751bb344b90dfcdad1dfd71c2a85bacd345f0464