aboutsummaryrefslogtreecommitdiffstats
path: root/cc/util.go
Commit message (Collapse)AuthorAgeFilesLines
* Fixing protoOutParams concatenation.Kweku Adams2018-04-091-1/+1
| | | | | | | | | | ParseGeneratorParameter delimits based on commas, not colons: external/protobuf/src/google/protobuf/compiler/code_generator.cc Bug: 72570104 Test: flash device with new build Change-Id: I00042782a718d288ca6b0cb78f856d0fb223a926 (cherry picked from commit fb5b31ce9675e1acbba2d6eb0c0739195515fb85)
* Add proto.canonical_path_from_rootDan Willemsen2018-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Historically, we've always passed '-I .' as the first argument to protoc, essentially treating all proto file package names as their full path in the android source tree. This would make sense in a monorepo world, but it makes less sense when we're pulling in external projects with established package names. So keep the same default (for now), but allow individual builds to opt into using local paths as the default names with 'canonical_path_from_root: false'. A cleanup effort and/or large scale change in the future could change the default to false. As part of this, run protoc once per input proto file, since the flags may need to change per-file. We'll also need this in order to specify --dependency_out in the future. Bug: 70704330 Test: aosp/master build-aosp_arm.ninja is identical Test: aosp/master soong/build.ninja has expected changes Test: m Test: Build protobuf test Change-Id: I9d6de9fd630326bbcced1c62a4a7e9546429b0ce
* Fix llvm-ar error caused by using lto and sanitizer togetherZhizhou Yang2018-02-141-0/+1
| | | | | | | | | | | | | | | | | LLVM-AR does not allow passing --plugin options more than once. The --plugin ARFLAGS that lto want to add, may already exist if sanitizer is also turned on. Fixed this by adding a new bool Flags.ArGoldPlugin. Set this variable to true whenever LLVM gold plugin is needed for ArFlags. In function TransformObjToStaticLib(), add this option to arFlags using global value ${config.LLVMGoldPlugin} if the bool value is true. Bug: http://b/73160350 Test: build the image with make and succeeded. Change-Id: I62785829b0a4b663225926e4aed98defc1b6da2c (cherry picked from commit 4917049f6efe2d08e67eb26ec77e21dcce5172c5)
* Move string list utility functions to android packageColin Cross2017-12-281-44/+5
| | | | | Test: m checkbuild Change-Id: I50a7ccf9fd7ed82b688e3eb90489c0bc0af33287
* When compiling with the lite protobuf option, pass the option to aprotoc to ↵Joe Onorato2017-12-151-21/+22
| | | | | | | | force the lite runtime. Test: make Merged-In: I450f89d144d496a6ddfccc6a6a5a679a05809595 Change-Id: I450f89d144d496a6ddfccc6a6a5a679a05809595
* List of VNDK-related libs are exported to makeJiyong Park2017-08-171-0/+7
| | | | | | | | | | | | | | | LL-NDK, VNDK-core, VNDK-SP libraries are exported to make as SOONG_LLNDK_LIBRARIES, SOONG_VNDK_CORE_LIBRARIES, and SOONG_VNDK_SAMEPROCESS_LIBRARIES. This can be used to auto-generate ld.config.txt from a template. Bug: 64013660 Test: BOARD_VNDK_VERSION=current m -j successful Test: check out/soong/make_vars*.mk and look for SOONG_*_LIBRARIES Merged-In: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d Change-Id: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d (cherry picked from commit d5b18a55bbde5d7f0ce78c889aacdd4bc2efc994)
* add exclude_shared_libs for vendor_available:true libsJiyong Park2017-06-211-0/+10
| | | | | | | | | | | | | | | | | Adding a mechanism to conditionally exclude some shared library dependencies when a lib is built for vendors. Without this, some libraries cannot be earily marked as vendor_available if they are depending on shared libs can shouldn't be marked as vendor_available. By using exclude_shared_libs with exclude_srcs (or __ANDROID_VNDK__ macro), we can eliminate the unnecessary dependency for vendors. Bug: 62471389 Test: build Change-Id: If94277b45c3769223cea371d0028e75277640356
* Black-list for clang LibTooling Cflags.Jayant Chowdhary2017-06-191-20/+21
| | | | | | | | | | | | Add a list of flags which are not understood by clang LibTooling tools and filter them out of the Cflags the tools are invoked with. Test: In frameworks/av, make libmedia vendor_available (this invokes header-abi-dumper on this module), mm -j64. Bug: 62447349 Change-Id: I46f017212b89f4331145c999103d0ed44da0abaf
* Support .rs and .fs files in cc_* module srcs listsColin Cross2017-05-051-0/+1
| | | | | | | Translate .rs and .fs files to .cpp files using llvm-rs-cc. Test: builds Change-Id: I242cea0d09c9985730a512cec7705c3f1479f4ed
* Add header-abi-checker for Vndk abi checks.Jayant Chowdhary2017-04-141-0/+2
| | | | | | | | | | | | | | | | header-abi-dumper: dumps abi exported by source files for Vndk. header-abi-linker: links abi dumps produced by header-abi-dumper. header-abi-diff: compares linked dumps. Test: mm -j64 showcommands > make_log in bionic/libc. This produced linked dumps in out/soong/.intermediates. Copied these dumps to prebuilts/abi-dumps/ndk/current/arm64/source-based/. Changed the abi and re-ran mm -j64 showcommands > make_log confirmed that the build reported compatibility breakge without actually failing (advisory mode). Change-Id: Iccad6908fe68a80f47230751671d156893b96ead
* Fix include orderColin Cross2017-03-311-0/+2
| | | | | | | | | | | | Include order should be module includes, dependency exported includes, and then global includes. Module includes and global includes are computed during compileFlags, but dependency exported includes are not handled until later. Move the global includes into a new flags variable so that the dependency includes can be appended to the module includes. Test: m -j native Change-Id: Ifc3894f0a898a070d6da8eed4f4b9e8cc0cd2523
* Allow custom ar flags to be set.Vishwath Mohan2017-03-161-0/+1
| | | | | | | | | | | Adds the ability to set custom flags for ar in Soong, similar to how they can currently be set for make. Bug: 36290748 Test: sanitize.go is able to correct set custom ar flags for CFI. CFI enabled Soong components build and boot without issue. Change-Id: I3212793aa84ba51df910c184d8bb376b3650376e
* Native Coverage support in Soong (gcov)Dan Willemsen2017-02-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is configured the same as make -- a global NATIVE_COVERAGE=true flag to allow native coverage, then COVERAGE_PATHS=path1,path2,... to turn it on for certain paths. There are .gcnodir files exported to Make and saved in $OUT/coverage/... files which are `ar` archives containing all of the compiler-produced .gcno files for a particular executable / shared library. Unlike the Make implementation, this only passes links the helper library (automatically through --coverage) when one of the object files or static libraries being used actually has coverage enabled. Host support is currently disabled, since we set -nodefaultlibs, which prevents libclang_rt.profile-*.a from being picked up automatically. Bug: 32749731 Test: NATIVE_COVERAGE=true COVERAGE_PATHS=system/core/libcutils m -j libbacktrace libutils tombstoned $OUT/coverage/system/lib*/libcutils.gcnodir looks correct (self) $OUT/coverage/system/lib*/libbacktrace.gcnodir looks correct (static) $OUT/coverage/system/lib*/libutils.gcnodir doesn't exist (shared) $OUT/coverage/system/bin/tombstoned.gcnodir looks correct (executable) Test: NATIVE_COVERAGE=true COVERAGE_PATHS=external/libcxxabi m -j libc++ Confirm that $OUT/coverage/system/lib*/libc++.gcnodir looks correct (whole_static_libs) Change-Id: I48aaa0ba8d76e50e9c2d1151421c0c6dc8ed79a9
* Support aidl cpp generationDan Willemsen2016-12-051-0/+1
| | | | | | | | | Ideally we'd calculate the headers that are written here too, but I'll add that in a later change that actually enforces the generated header list. Test: mmma -j system/tools/aidl Change-Id: Ifd2e8e8ff444b0f67270fb5156e7bf7bceddb6be
* Support .asm files for assemblyColin Cross2016-12-021-0/+1
| | | | | Test: mmma -j external/libjpeg-turbo Change-Id: Id192dae5d74ecbf500fc668931c37f9b91d25ca4
* Support grouping static librariesColin Cross2016-12-021-0/+2
| | | | | | | | | | | LLVM has complicated static library layering that sometimes changes. The make solution was to list all the static libraries twice, but Soong dedups the list. Add a group_static_libs flag to allow surrounding the static libs with -Wl,--start-group and -Wl,--end-group. Test: mmma -j external/llvm Change-Id: Ic08a183d7def9c9249d4a3014760759f16b68d04
* Add clang-tidy supportDan Willemsen2016-10-311-0/+2
| | | | | | | | | | | | | | | | For every file which we can run clang-tidy (C/C++ clang-built), we add a new build node that depends on the object file (since clang-tidy does not export a depfile), and is depended on by the link step. This is better than how we're doing it in make, since calling tidy can be turned on or off without needing to rebuild the object files. This does not attempt to port WITH_TIDY_ONLY from Make, since the way that it works is broken (due to the lack of a depfile). Bug: 32244182 Test: WITH_TIDY=true mmma -j bionic/libc Test: ./soong (Setting ClangTidy: true) Change-Id: I40bbb5bb00d292d72bf1c293b93080b5f9f6d8ea
* Add support for .proto filesColin Cross2016-10-271-0/+1
| | | | | | | | | .proto files are translated to .pb.cc and .pb.h files, which are then compiled normally. Bug: 32286026 Test: mmma -j system/extras/perfprofd Change-Id: I538071424d667aacf35b4b8bfebe217f5f092726
* Remove unused flags.NocrtColin Cross2016-08-051-1/+0
| | | | | | | Nocrt is handled through deps.CrtBegin/End, flags.Nocrt is unused Change-Id: I8ab5313bb2eb3a00e336504d6dd3813350fbe14d Test: soong builds
* Move toolchain and global variables into separate packageColin Cross2016-08-011-19/+0
| | | | | | Move all of the configuration into a cc/config package Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
* Add flag property checkingDan Willemsen2016-05-251-0/+7
| | | | | | | | | | | | | | | | | | | | Some checks for common errors with user-provided compiler and linker flags: * Using -I instead of include_dirs * Using -l<lib> in ldflags instead of host_ldlibs (or shared_libs) * Using -L in ldflags * Splitting a multi-word flag into two flags * Combining two flags into one list entry * Using a path that could search outside the source or output trees * Using a non-whitelisted library in host_ldlibs Maybe some of the flag checks should happen during a static analysis pass, but we don't have one right now, and this only adds ~1/2 second to our 73 second Mega_device runs (recompile the changed code, run soong_build, then report unknown target). Change-Id: Icea7436260f1caa62c0cec29817a1cfea27b3e7c
* Rename common to androidColin Cross2016-05-181-7/+7
| | | | | | | | | | | | | | | | Rename the "common" package to "android", because common is too generic. Also removes all android.Android naming stutter. Ran: gomvpkg -from 'android/soong/common' -to 'android/soong/android' gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext' gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext' gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase' gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext' gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext' gorename -from '"android/soong/android".AndroidModule' -to 'Module' Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
* Add support for sanitizer propertyColin Cross2016-04-211-4/+18
| | | | | | | | Add a new feature to cc modules that adds the cflags and libraries necessary to implement AddressSanitizer, ThreadSanitizer, and UndefinedBehaviorSanitizer. Change-Id: Ibe5ffadc7ece56080a2521f2c7c00da9ef712584
* Fix arm[64] cflagsDan Willemsen2016-03-301-0/+19
| | | | | | | | Limit arm cpu variants to armv7-a-neon only, and handle a generic armv7-a-neon cpu variant. Add arm64 cortex-a53 cpu variant. Sanity check the arch variant against supported versions. Change-Id: I8ecdea4cd36d9c82e1f29b158efc131f8b1cbc4d
* Refactor ccColin Cross2016-03-211-1/+1
| | | | | | | | | | | | Refactor all of cc in order to use composition instead of inheritance. All cc module types exported by cc are now *cc.Module objects, with compilation, linking, and installing steps delegated to different objects in order to form the full module type. Additional features that modify dependencies and flags can be inserted in a features object list, and custom module types can be created by adding a Customizer object that can modify properties. Change-Id: Ie1283d14920f7856f6947b0530606b2f4d58fab0
* Use `Path` instead of string for file pathsDan Willemsen2015-12-091-4/+4
| | | | | | | | | | | | This centralizes verification and common operations, like converting the path to a source file to the path for a built object. It also embeds the configuration knowledge into the path, so that we can remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that leads to paths like './path' instead of just 'path' like make is doing, causing differences in compiled binaries. Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
* Add support for include_filesColin Cross2015-09-141-0/+4
| | | | | | | Support include_files and local_include_files to pass -include arguments to gcc. Change-Id: Ie3f03218fcbc9732741da91671b20e240f3de3a6
* Simplify flags in c compiling, fix NDK build warningsColin Cross2015-04-221-2/+0
| | | | | | | | | | | | | | | | Reduce the number of flags variables when compiling C by getting rid of the separately-tracked IncludeDirs variables, and putting them directly in GlobalFlags. Also changes exportedIncludeDirs to exportedFlags, which will allow exporting flags besides -I. Also fixes a bug when building a module with the NDK and -Werror by passing NDK exported include directories with -isystem instead of -I, which will ignore warnings from those includes. Also fixes a bug where the default includes were being inserted into all cflags by the arm and arm64 toolchain modules. Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
* Add aidl file support to java buildsColin Cross2015-04-081-28/+5
| | | | | | | Add support for aidl files listed in srcs for java builds, and an aidl_preprocess module type for framework and sdk aidls. Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
* Add yacc and lex supportColin Cross2015-04-081-0/+1
| | | | | | | | Add support for yacc (.y or .yy) and lex (.l or .ll) files. Also tweak locations of .o files for normal and generated sources to makes sure they don't collide. Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
* Refactor ccDynamic for static binariesColin Cross2015-03-271-0/+12
| | | | | | | | | | ccLibrary uses ccDynamic for linking shared libraries, but bypasses it by calling directly into ccBase for static libraries. Instead of duplicating the same mess for ccBinary, rename ccDynamic to ccLinked and add the logic for dealing with static or shared linkage. This also allows moving the stl logic out of ccBase and into ccLinked. Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
* Export cc types for art to inherit fromColin Cross2015-03-251-12/+12
| | | | | | | | | | | | Art needs a custom module type in order to perform complicated build logic like depending on environment variables and varying cflags based on cpu variant. Export enough of the types and functions from cc for art_cc_library to inherit from cc_library. While I'm touching every line, also rename the New* methods to *Factory. Change-Id: I7123aa47019c4ced7a1ab57c394225bc7844b5ea
* Add soong_build primary builderColin Cross2015-03-131-0/+96
Initial build logic for building android with soong. It can build a variety of C and C++ files for arm/arm64 and host. Change-Id: I10eb37c2c2a50be6af1bb5fd568c0962b9476bf0