* Default checks include only google* minus google-readability*.
* Some google-* checks are disabled for external projects.
* Each project can add more or disable checks through LOCAL_TIDY_CHECKS.
Bug: http://b/27779618
Change-Id: I83eed73bd2bddaace565a6dde532fb2036b4fac4
The NDK doesn't support mips32r6, and the update of prebuilts/ndk to
r11 doesn't have the hack that r10 did. Revert back to r10, until we
decide on a more appropriate solution.
Change-Id: I7891603d8ccbb20398aad893b62c1debf353ef41
* Call clang-tidy before every C/C++ compilation if
(1) clang-tidy is found at $(PATH_TO_CLANG_TIDY)
(2) $(my_clang) is true
(3) LOCAL_TIDY is 1 or true, or
LOCAL_TIDY is undefined and WITH_TIDY is 1 or true.
* clang-tidy is called with -checks=$(my_tidy_checks),
which has default '-*,google*,-google-readability*'
and can be overwritten by WITH_TIDY_CHECKS.
* LOCAL_TIDY_CHECKS is appended to $(my_tidy_checks)
* Extra flags are passed to clang-tidy through
WITH_TIDY_FLAGS or LOCAL_TIDY_FLAGS.
* To quickly find and fix clang-tidy warnings, set $(WITH_TIDY_ONLY)
to 1 or true to skip compilation of C/C++ files.
* Add a PHONY tidy_only target,
which includes all $(cpp_objects) and $(c_objects).
* The 'mm' and 'mmm' functions are changed to call make with
the 'tidy_only' target when WITH_TIDY_ONLY is true or 1.
In that case, only clang-tidy is called for C and C++ files.
Bug: http://b/27779618
Change-Id: I8adcfff217d68af49849b79aacee7d7654cafb1b
Listing a library in any of:
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS
will cause the headers exported by that library to be exported from
the current library target as well.
This means that when library A's public headers include headers from
library B, library C which consumes A no longer has to explicitly list
A and B in its LOCAL_SHARED_LIBRARIES for the purpose of picking up B's
headers.
Bug: 27804373
Test: Introduced dependency on libbase to libbinder at the header level.
Libraries that consume libbinder do not need to explicitly depend
on libbase.
Change-Id: If69079f058a4a182c5ef5a3c5ba15035570da22d
Used to select between releases of the NDK (r10, r11, etc).
Some of the libraries we use in Android come as prebuilts from
google3, which are most likely built against an older NDK than what
we have in the platform. Since things may not be ABI compatible
release to release, we need to keep legacy versions accessible for
those to keep building.
Change-Id: Ia3df42fa6f3a7bd5108ff6bbb0f2ca06239c3be9
Clang and MinGW are not expected to work together currently, and you get
strange errors when this is attempted. Instead, error out with a clear
error message.
Before the windows build rewrite, we'd just explicitly set my_clang to
false without checking what the module asked for. Now, error out if the
module explicitly asked for clang, since by default they'd have it
already if it wasn't for windows. That way when Clang+Windows does
become possible, it can gradually be tested by setting LOCAL_CLANG to
true.
Change-Id: I9e0b0dca30946d94894119443f2fd0593cee1793
On Darwin ar would fail if there is no object file to add.
We work around by adding a dummy.o to the .a and then deleting it.
Bug: 27800477
Change-Id: I68bbebea2726058c25863d7026a645a520d05167
Why? For one, libgcc's unwinder makes use of `dl_iterate_phdr`. Also,
libgabi++ (the home grown C++ RT we use for stlport) uses
`dlopen` for liblog when reporting fatal errors. The LLVM unwinder
which is used by libc++ also uses libdl.
Requiring a dependency on libdl seems less objectionable than
requiring one on liblog. We could always change libgabi++ to use
syslog instead, but that will only reach logcat for newer devices
(possibly L+, definitely M+).
Requiring libdl seems like the best option here, especially given
that libgcc needs it anyway.
Change-Id: I4acfaf38145c39fc15a76fbb282a46786e5322f1
There was a typo in binary.mk. compile-dotdot-XXX-file in
definitions.mk was also using -include.
Bug: 26839129
Change-Id: I4a0145fb70413998cc65d30d2efcd68af07b4800
When a static library uses LOCAL_EXPORT_C_INCLUDE_DIRS, then is included
entirely in another library with LOCAL_WHOLE_STATIC_LIBRARIES, all the
symbols are reexported, so reexport the headers too.
Change-Id: I92cf17894fc991a5b5ecb59ca5e095e407c98de4
Also specify "-d keepdepfile" to ninja so .P files won't be
deleted by ninja.
-include for .s files are removed because GCC doesn't
generate .d files for .s files.
Bug: 26839129
Change-Id: If00e93c7a33449ec314a5cdba438475a32979f4e
And everything special-cased on that. Add a warning if USE_NINJA is
set to let users know that it no longer changes anything.
Change-Id: Ib8739151fe26ea6bf8f76b7ac2b8f4097dab0b47
There are some code policies we want to enforce more strictly, but
it's hard to do so for third party code because we have to either
carry the diff burden or upstream the patch, and in the latter case
the turnaround time for fixes can be problematic, and sometimes
upstream won't accept changes (sometimes people just need to win the
obfuscated C contest).
We define ANDROID_STRICT for any code that we expect to be able to
make these policy fixes as we change policies.
Change-Id: I15faf62cec1932dd859a082f66942b2606d0ff45
* When WITH_STATIC_ANALYZER is set and non-zero, and clang compiler is used,
call new clang ccc-analyzer or c++-analyzer.
* Otherwise, if WITH_SYNTAX_CHECK is set and non-zero,
call compiler with -fsyntax-only.
* Replace "--sysroot=path" with "--sysroot path", to work with ccc-analyzer.
* ccc-analyzer executes the original compilation command to generate
object files before calling clang with --analyze to do static analysis.
* When clang is called with --analyze, macro __clang_analyzer__ is defined.
BUG: 13287788
Change-Id: I5edb25b52998d871385dd000778db2ce83224078
*.o files that are passed in via LOCAL_GENERATED_SOURCES are added
directly to all_objects, they are not mixed with the normal_objects that
we track. So omit them from they my_gen_src_files list so that we don't
warn that they're unused.
Change-Id: I94b85504032e70fbcc00207d6200557700dd0a89
Objective-C .m/.mm files were not being tracked, so they were showing
up as unused source files (on Darwin). They were also triggering an
internal build system warning because the new object list did not
match the current list.
Change-Id: I01fff8c5587fe168106c60782080d60744311f6f
We have been reordering objects to the linker based on how they were
generated. In soong, they're ordered based on the order listed in the
src_files.
Keep track of which source files created which object files so that we
can create the ordered list. Optionally change the order, based on
BINARY_OBJECTS_ORDER. That way we can compare make and soong builds.
Since we're keeping track of the used source files, warn when an entry
in LOCAL_SRC_FILES is not used. (whether it is an unused file like a
header, or a typo)
LOCAL_GENERATED_SOURCES is not verified, since it is valid to add
headers and other files in that list (to set up dependencies).
Change-Id: I1dfbbb3aa570c11c1db3b7133e46ed0b8c3b8989
This was a regression since kati has been introduced. This CL
introduces include-depfile function to make it easier to write
Makefiles which work with both make and kati.
As ninja can handle only a single dependency file per a build
rule, now we merge multiple .d files generated by llvm-rs-cc
into a .d file.
Change-Id: Iaf64a8f0523ab98115837e6e06abd50f06620363
Both aidl and clang/gcc were putting their dependencies in the same
place. Move aidl's dependencies to a file ending with .aidl.P rather
than the compiler's .P.
While here, inform kati that we have these special dep files.
Bug:26409006
Test: Rebuild, note both files being generated
Change-Id: I29d2eea822235d60713c2059f3a314e475eb5aa3
Transform ../ to dotdot/ for C++ generateds from .aidl source files.
This forces us to use one layer of indirection to calculate the build
rules for .aidl files, since we can no longer use a pattern rule.
This was tested by modifying system/tools/aidl's Android.mk to refer to
its .aidl files by going up two directories and then repeating the
directories again. When I print the build rules with $(info) I see that
dotdot/ appears in appropriate places (C++ paths, but not .aidl paths).
Bug: 26407018
Test: Described above.
Change-Id: I397c9d10408c0c66d8b5a247a1f34eb4bf4f74ce
This effectively changes the default instruction set of assembly files
from arm to thumb in order to match the default for C/C++.
Change-Id: I8684f144a1195b53b3e0fdd04cacf77f6a131c7e
- For .l/.y source files, generate .c files; for .ll/.yy source files,
generate c++ files.
- Simplified the rules by adding the generated sources to
my_generated_sources.
- Simplified generated header file naming by always using .h extension
with bison's "--defines=" option.
- Removed the unnecesarry conditional inclusion to the generated
headers. Bison already automatically generates such things.
Bug: 26492989
Change-Id: I9ab6dc149c258f7642bc36c3fa32f90ff7ee51a4
Host binaries may be run during the build process and the internal
implementation of the shared libraries makes a difference for the build
result. This change makes sure host tools get re-linked and re-run when
any of its dependency libraries gets updated.
DEX2OAT is such a host tool. We also changed DEX2OAT as full dependency
of dex-preoptimization, so we rebuild the odex files if DEX2OAT itself,
or any dependency libraries changed.
Bug: 24597504
Change-Id: Idf0d9be82ccebd826d9c5b405a39cff437e0af29
This was previously working because for some reason prebuilts/ndk had
a tangled mess of hand assembled symlinks that pointed lib -> lib64
for the multilib architectures.
Change-Id: I294d67f58f2008b1a53790cf676f5223df449cbc
When USE_CLANG_PLATFORM_BUILD is not set, default will be clang/llvm.
USE_CLANG_PLATFORM_BUILD=false can be used to select gcc as default.
BUG: 23163853
BUG: 26102335
Change-Id: I00604c2aef4849e8c3505b2c4002eb1c46cd1fd1
Error out if there is a file listed in LOCAL_SRC_FILES_EXCLUDE but not in
LOCAL_SRC_FILES. This should catch typos or other mistakes that would
otherwise be missed.
Change-Id: Iaddf575a6ce35238998ac47b59591a7d05fbcd0d
There is currently an intentional incremental rebuild issue with
import_includes. export_includes might get updated with an identical
version, but we don't want to force everything downstream of it to
rebuild.
When BUILDING_WITH_NINJA==true, only update export_includes if it
changes, and use .KATI_RESTAT to only run downstream rules if it
changes. import_includes will only be updated if one of the
export_includes files is updated, so object files can have a normal
dependency on import_includes instead of an order-only dependency.
All downstream object files will now be recompiled if their imported
include paths change.
Bug: 25910568
Change-Id: I626f3b24ac02ac1309049cf1ce66cfe8ec816513
The export_includes file for a library needs to express a dependency on
all generated exported headers. For aidl generated headers, express a
dependency on the .cpp file instead, since the generator promises to
generate this file last. Unfortunately, the C++ headers generated from
a .aidl file depend on the contents of the file.
Change-Id: I9402b364e4538b502c0958ac8c7bd72cb0add724
It is common for developers to generate/compile AIDL in a static
library, then link that library into an executable. When doing this,
developers need to export the generated headers.
Bug: 25779424
Test: a refactoring of the aidl Android.mk shows this works
Change-Id: I4f7d471a601d2a683cb5a9da5e02e3fab576c26a
When a shared object is rebuilt, all dependent libraries and
executables are rebuilt. Such rebuild is unnecessary when there
is no interface change. With this patch, .toc files will be
generated for all .so files. The rule which generates .toc files
has ninja's restat=1 and .toc files are not changed ninja won't
rebuild dependent targets.
Performance:
$ m && touch bionic/libc/stdio/stdio.c && time m
Before: 1m03s (2563 targets)
After: 21s (90 targets)
Bug: 24597504
Change-Id: Ia5dd950273d143f4e99eee8bef7478f1a94cd138