Commit graph

12 commits

Author SHA1 Message Date
Luis Useche
342fa6b927 Add global C flags to compile_commands
This solves linter warnings in editor by adding flags to ignore errors
we don't care about. This also means that compile_commands.json is
closer to the flags we actually use for compilation.

Test: Checked generated compile_commands for new flags.

Change-Id: Id583da6eb5151a9baa9a47771f5f937c88bc43f7
2024-04-02 13:58:13 -07:00
LaMont Jones
0c10e4dcc0 Parallelize singleton execution
Bug: 281536768
Test: manual, presubmits
Change-Id: I57fdc76ba6b277e88e196b506af87127a530fd37
2023-05-19 20:31:32 +00:00
Colin Cross
988414c2cf Sandbox soong_build by changing to root directory
This relands I12a0f907753fefd1997ab8b4ea2ac331234093cf along with
a fix to blueprint for absolute paths.

Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Change-Id: I24ac485677aa102eec1a2521d16820da6ee1ae77
Fixes: 146437378
Test: m checkbuild
Test: m OUT_DIR=/tmp/out nothing
2020-01-11 01:11:46 +00:00
Colin Cross
47e4f9e1e8 Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
2020-01-10 18:51:04 +00:00
Colin Cross
05c25ccb4a Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Fixes: 146437378
Test: m checkbuild
Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
2020-01-09 14:19:46 -08:00
Changyeon Jo
96279252d7 Generate Compdb file in the output directory
This change modifies the location of generated compdb file from
$ANDROID_BUILD_TOP to where compdbOtuputProjectsDirectory points to,
under $OUT_DIR.  This is especially required for the build environment
that maps $ANDROID_BUILD_TOP as read-only, such as Gitc.

Test: m SOONG_GEN_COMPDB=1 nothing
      examine generated compile_commands.json
Signed-off-by: Changyeon Jo <changyeon@google.com>

Change-Id: I86700f89b613a443a33982ecd5501b0f68a62be7
2019-12-20 00:10:02 +00:00
Colin Cross
4af21ed26f Split local and global cflags
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
2019-11-07 15:27:58 -08:00
Colin Cross
d34ab7c6b2 Treat .cxx files as c++
Fixes: 135749365
Fixes: 135667566
Test: m checkbuild
Change-Id: If47274812dfe781ebbb9f8a60a395650573727d5
2019-06-27 14:46:10 -07:00
Alex Light
e812818656 Update compdb to put full path to compiler
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
2019-01-29 17:27:37 +00:00
Alex Light
be96aeac1a Use the real compiler for compdb
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
2018-11-07 11:35:47 -08:00
Alex Light
0c7cc1caa1 Don't include empty-string arguments in compile_commands.json
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
2018-10-02 11:28:25 -07:00
Alex Light
ec868fc42a Add support for generating Compdb file
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
2018-04-24 08:15:02 -07:00