Commit Graph

211 Commits

Author SHA1 Message Date
Dan Willemsen 615609854f Revert "install *.so in different paths for their types"
This reverts commit 4c48f724e1. It's
causing test failures, warnings and complaints, so backing it out and
we'll resolve those before putting it back in.

Bug: 33681361
Test: m -j
2017-03-16 19:48:32 -07:00
Vishwath Mohan 83d9f71cc5 Allow custom ar flags to be set.
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
2017-03-16 14:06:30 -07:00
Jiyong Park 4c48f724e1 install *.so in different paths for their types
Shared libraries are now installed to different directories depending on
their types.

* NDK libraries: /system/lib/ndk
* VNDK libraries: /system/lib/vndk
* VNDK-ext libraries: /system/lib/vndk-ext
* Framework-only libraries: /system/lib
* Vendor-only libraries: /vendor/lib
* Same-process HALs: /vendor/lib/sameprocess

In addition, a new module type vndk_ext_library is added. It is almost
identical to cc_shared_library but it introduces another attribute
'extends'. This is use to reference the vndk library that this vndk-ext
library is extending.

For example, in order to extend a vndk library libFoo:

cc_library {
  name: "libFoo",
  srcs: [...]
}
---------------------
vndk_ext_library {
  name: "libFoo-extended",
  srcs: [...]
  extends: "libFoo"
}

Then, libFoo will be installed as /system/lib/vndk/libFoo.so and
libFoo-extended will be installed as /system/lib/vndk-ext/libFoo.so.
Note that file name of the latter is libFoo.so, not libFoo-extended.so:
file name of an extending module is automatically set to that of the
extended module.

Bug: 33681361
Test: build & run. Libraries must be in the correct directories.
Change-Id: Ia1eb3940605d582a252c78da0f3a5b36fdab062b
2017-03-14 09:13:44 +09:00
Dan Willemsen 581341d4f2 Native Coverage support in Soong (gcov)
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
2017-02-14 13:05:48 -08:00
Fabien Sanglard d61f1f4559 Add support for CMakefile generation
Test: Manually generated CMakeLists.txt for gui/ui/aapt2.

Change-Id: I7dedc300c1e50b8e39bc58091b650c0bbe2c62da
2017-02-07 09:43:02 -08:00
Colin Cross 068e0feace Support filegroups
filegroup is a module that contains a list of files, and can be used
to export files across package boundaries.  filegroups (and genrules)
can be referenced from srcs properties of other modules using the
syntax ":module".

Test: m -j
Change-Id: I3d6fc4819c0b4225b474e0ad42f0d947f55a5961
2016-12-17 16:34:03 +00:00
Colin Cross 32ec36c631 Only export exported header libs
Test: m -j native
Change-Id: Ia0e5b28495e049ba8037884d2c498a1b59012bbe
2016-12-15 07:40:13 -08:00
Colin Cross 37047f1c7e Pass DepsContext to dependency methods
Pass a DepsContext that embeds android.BottomUpMutatorContext
instead of android.BaseContext so that dependency methods can
directly add dependencies.

Test: m -j
Change-Id: Id4c157975d3d6f03efd99785d217bef486a76139
2016-12-13 17:32:29 -08:00
Colin Cross 5950f3827c Support explicit header-only libraries
To date we have been using static libraries with no source files as
header-only libraries.  Switch to using header_libs to make the user's
expectations clear, in case we need to differentiate the semantics of
static libraries and header-only libraries when we enable transitive
static library dependencies.

Test: mma -j external/llvm
Change-Id: I3ce16df11076b637bd192880e86ec9027738b9e7
2016-12-13 15:03:42 -08:00
Colin Cross a8f5e9a8b2 Allow disabled dependencies when SOONG_ALLOW_MISSING_DEPENDENCIES is set
Push the "depens on a disabled module" dependency to runtime when
SOONG_ALLOW_MISSING_DEPENDENCIES is set so that subsets of the tree
can build when some modules are disabled.

Test: external/clang/build.py on llvm branch
Change-Id: I47e4f41d04aa3df173757f03a0c581b0bafb93f0
2016-12-13 12:53:47 -08:00
Dan Willemsen e1240db6ab Support aidl cpp generation
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
2016-12-05 15:49:40 -08:00
Colin Cross 91e9004086 Support .asm files for assembly
Test: mmma -j external/libjpeg-turbo
Change-Id: Id192dae5d74ecbf500fc668931c37f9b91d25ca4
2016-12-02 21:12:30 -08:00
Colin Cross 18c0c5afbd Support grouping static libraries
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
2016-12-02 21:34:42 +00:00
Colin Cross bba99041db Split cc_prebuilt_shared_library into static variants
Prebuilts must have every variant that their source module has, so
split all cc_prebuilt_shared_library modules into both static and
shared variants.

Test: m -j checkbuild
Change-Id: I3c32315227f779e832e041cfab604ff7402c7e13
2016-11-29 15:29:34 -08:00
Dan Willemsen d2ede879b5 Add basic VNDK support in Soong
Export a list of libraries in the VNDK, which is currently empty.

Take in Make's global BOARD_VNDK_VERSION, and use that as the SDK
version for modules that specify use_vndk: true.

Modules that use the vndk have some configuration as if they were
building against the NDK (the absence of globally defined headers), but
in other cases look like platform modules (using the platform libc++,
for now).

This change does not attempt to enforce any linking constraints, that
will come in a later patch.

Test: out/soong/build.ninja doesn't change
Change-Id: I3be206b67015ac5177b7eef4a451c579e3dc903f
2016-11-28 13:45:24 -08:00
Colin Cross 5ed99c6472 genrule: let Android.bp file specify exported header dirs
Instead of exporting the generated sources dir as headers, let
the Android.bp file specify subdirectories as exported.

Test: m -j checkbuild
Change-Id: I18dd900d63ce7485c8fbfcc39dc77abad6f733d7
2016-11-22 15:41:09 -08:00
Dan Albert 90f7a4dcab Allow `first_version: "current"` in ndk_library.
Test: Added a test module that uses this
      find $SOONG_OUT -name libfoo.so # only shows up in current
Bug: None

Change-Id: Ic88d7c598cd5b6ded8fb851a7eaf859806336af7
2016-11-10 14:01:08 -08:00
Dan Willemsen a03cf6d322 Add clang-tidy support
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
2016-10-31 16:21:01 -07:00
Dan Willemsen 5cb580f407 Start using "struct Objects" to store object Paths
So that we can represent other files that get generated along with the
objects, like the gcno coverage information, and per-file clang-tidy
runs.

Test: Soong's build.ninja identical before/after
Change-Id: I5c553a153c436d5403549f62c73fe79c5f101779
2016-10-31 16:18:49 -07:00
Colin Cross 0c461f1f6e Add support for .proto files
.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
2016-10-27 15:28:09 -07:00
Colin Cross ce75d2c6a2 Initial prebuilt support
Support prebuilt shared libraries as an initial proof-of-concept of
prebuilts.  Future changes will support binaries and static libraries,
and the ability to select which to use based on something besides
blueprint properties.

Test: TestPrebuilts run during m -j
Change-Id: I6e84da667e9005ae11844bad01d25cbe4ced1ce3
2016-10-13 14:52:47 -07:00
Colin Cross fc754581fc Add a Name property
Blueprint is going to abdicate responsibility for determining the name
of a module.  Add a name property, and a method to retreive the name.

Test: build.ninja identical
Change-Id: I09c6f5283cd6e28ad4b04c24c5ab8b00f71ae2ab
2016-10-12 17:24:49 -07:00
Colin Cross 1e676bef94 Control mutator order
Register mutators inside lambdas that are called in a defined order to
correctly order mutators before and after the arch and deps mutators.

Test: build.ninja identical
Change-Id: Iefe2a3515aee8570e76a6e76925db4cda0e9e822
2016-10-12 15:33:33 -07:00
Colin Cross 798bfce9d0 Move registration into android package
Mutator registration is tightly coupled with the android package, move
all registration from the soong package to the android package.

Test: build.ninja identical
Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
2016-10-12 14:30:44 -07:00
Colin Cross 26c34ede29 Add support for toc optimization in soong
Skip relinking against shared libraries whose interface hasn't changed.

Test: mmma -j frameworks/native/libs/gui
Test: touch frameworks/native/libs/gui/BufferItem.cpp
Test: mmma -j frameworks/native/libs/gui, see nothing relinks past libgui
Bug: 26014946
Change-Id: I4d4b8da6a35c682341ae51869f5c72b51e192053
2016-09-30 21:05:59 -07:00
Dan Willemsen 847dcc7d2a Handle dependencies with export_generated_headers
This sets up the proper dependencies within Soong by adding the imported
dependencies into GeneratedHeaders, and re-exporting them as necessary.
It also exports them to Make using the new LOCAL_EXPORT_C_INCLUDE_DEPS.

Bug: 31742855
Test: Inspection, build hardware/interfaces (pending)
Change-Id: I6a10ceec377a97966baa9d4876b90fcda391dd01
2016-09-30 01:37:38 +00:00
Dan Willemsen b3454ab24d Add export_generated_headers
Similar to export_shared_library_headers, this will export headers
imported from a gensrcs or genrule.

Bug: 31742855
Test: Add export_generated_headers, ensure it's in out/soong/Android-*.mk
Change-Id: Ieadefd007ece8b249f011a258a9c5b27f5d3f594
2016-09-28 18:31:04 -07:00
Dan Willemsen 4aa75ca244 Expose HostToolPath on the cc module to fix genrule.tool
Bug: 31742855
Test: Use `tool` in a genrule, ensure it runs properly.
Change-Id: Ib9ff35125edd66cdba8ede4f28aa6b753de0689b
2016-09-28 17:38:02 -07:00
Colin Cross b0f28957ae Support mixed ASAN and non-ASAN host builds
Host builds may build binaries that must have ASAN disabled.  Convert
host ASAN to use variants.  Since there is only one install location for
shared libraries, don't install the non-ASAN variant at all for now.

Test: mmma -j art SANITIZE_HOST=address
Change-Id: Iacefecac93df44823316624b4c540c24f643fb80
2016-09-19 16:50:35 -07:00
Colin Cross b4ce0ecad6 Remove cc.Customizer
Remove cc.Customizer, its functionality has been replaced by
android.PropertyCustomizer, and it is not used.

Change-Id: Ice32d554015b0800707bc042b187984f73df7979
2016-09-13 13:44:56 -07:00
Dan Willemsen 7424d61c95 Add InstallerProperties to cc_defaults
Test: Add relative_install_path to a cc_defaults
Change-Id: Id10f78afb3b82117b944b9b53fe7020fb672925b
2016-09-01 13:45:39 -07:00
Colin Cross 9461040154 Fix installation path for asan libraries
Check c.sanitize.inData() when deciding on install paths.
Don't set inData() for sanitized binaries.

Bug: 30773053
Change-Id: I24be75ccc1b25ae53f7f0a98d1632b30735d0931
2016-08-29 13:50:24 -07:00
Colin Cross e1d764e369 Export DefaultsFactory
Add an exported DefaultsFactory so that external module types can extend
cc_defaults.  DefaultsFactory takes a variadic list of additional
property structures.  defaultsFactory remains as the module factory for
cc_defaults.

Change-Id: I03b450ab3a31625e7baca165d393a0007fb3e421
2016-08-22 17:08:06 -07:00
Chris Wolfe 998306e525 Support required property
This adds LOCAL_REQUIRED_MODULES to the generated Android.mk for any
dependencies in the "required" list of a module.

Change-Id: Ibcfe89dce7d247eb441af94e37388a59e71a75a9
2016-08-15 17:10:47 -04:00
Colin Cross e8a67a7c58 Make BottomUpMutators parallel
Append .Parallel() to all of the RegisterBottomUpMutator calls to tell
Blueprint it can run them in parallel.

Test: identical build.ninja, passes race detector
Change-Id: I969a0689522d4cba7c8ff51e2aa00fe2fd338a89
2016-08-11 13:20:16 -07:00
Dan Albert 7fa7b2efd3 Don't generate intermediate NDK libraries.
It's better to clip to the existing versions here rather than build
the lower levels as if they existed.

cc.Module's begin() will now normalize the sdk_version to a valid
value for the given architecture so that doesn't have to be checked
later.

Test: make checkbuild with all other libc ndk_library changes
Change-Id: I2fa834f7a1ac3b03a0723291778d86207fcfda72
2016-08-05 16:48:36 -07:00
Colin Cross b916a38233 Refactor cc modules to use decorators instead of inheritance
For example , instead of trying to have libraryLinker inherit from
baseLinker and libraryCompiler inherit from baseCompiler, create a
single decorator object that wraps both baseLinker and baseCompiler.

Test: Builds, no unexpected changes to build.ninja
Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
2016-08-05 10:25:09 -07:00
Colin Cross 01344df46e Remove unused flags.Nocrt
Nocrt is handled through deps.CrtBegin/End, flags.Nocrt is unused

Change-Id: I8ab5313bb2eb3a00e336504d6dd3813350fbe14d
Test: soong builds
2016-08-05 10:22:29 -07:00
Dan Albert 7e9d295807 Auto-fill ndkMigratedLibs.
Change-Id: Ifb91f62eccb17dedb71c1a9a0f5c1471edbcbd44
2016-08-04 16:10:54 -07:00
Dan Albert 9e10cd4746 Check NDK API level link compatibility.
Mixing NDK API levels is only supported when linking against something
equal or older.

Change-Id: I2c3022a3d75465b736f2e65160da3113cfd6e635
2016-08-03 14:31:25 -07:00
Colin Cross 42742b8bb0 Rename compiler, linker and installer methods to be unique
compiler, linker, and installer interfaces may be implemented by a
single decorator object, rename their methods to be unique to avoid the
same method being called multiple times.

Test: out/soong/build.ninja unchanged
Change-Id: I1608c41cd68f614ba99c11bb9fcc7936f618d9aa
2016-08-01 13:47:15 -07:00
Colin Cross b98c8b0595 Move toolchain and global variables into separate package
Move all of the configuration into a cc/config package

Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
2016-08-01 13:37:01 -07:00
Colin Cross 4d9c2d17c3 Separate cc.go
Split cc.go into files per module type, plus files for the compiler,
linker, and installer stages.

Change-Id: Id44c03f42fcd180950ccd008d4de0c144ea3597b
2016-07-29 15:17:58 -07:00
Dan Albert 914449fca8 Generate NDK sysroots from the platform build.
The list of migrated libraries is currently empty. Libraries will be
migrated as follow up patches.

Test: Migrated libc to this system and everything still builds.
      build.ninja shows libraries being built and used and headers are
      collected for the sysroot.
Bug: http://b/27533932
Change-Id: Iaba00543c1390f432befe0eed768ed3fbb8a9b96
2016-07-28 00:42:05 -07:00
Colin Cross 76fada06c6 Finish cc.Customizer
The Customizer interface now provides a Flags method that takes a
CustomizerFlagsContext and can call AppendCflags to insert extra cflags
on a module.

Change-Id: I821242e7574e8ff653580325d1bef2998a50e29c
2016-07-27 17:15:49 -07:00
Colin Cross 5dab840e24 Fix static+shared with generated sources
Clear out the generated sources when reusing object files from the
static library for the shared library to avoid linking them twice.

Change-Id: Idc145f817acc93df4c3b266ac7647299399bc8eb
2016-07-27 10:30:21 -07:00
Dan Willemsen 627d83db71 Limit unique_host_soname to just host modules
Change-Id: I41d050806a27473abb3788de43b7bf67f5d049a8
2016-07-22 13:41:24 -07:00
Dan Willemsen 648c8aed4c Support unique_host_soname to add -host for shared libs
In order to distinguish our host libraries from system installed
libraries, support a flag to automatically append -host to host shared
libraries names. Previously, we were implementing this with different modules,
but with Soong, we'd really like to share the module definitions.

This properly exports the module to make, so that
LOCAL_SHARED_LIBRARIES := libcrypto still works, but the final installed
name is libcrypto-host.so.

Change-Id: I63389469fe1b38078b8bbf4c0fd92e54ef90ae1a
2016-07-21 16:42:14 -07:00
Colin Cross f59b69ccaa Refactor bionic includes into a single place
Bionic includes are the same on all architectures, modulo
architecture-specific includes.  Use a single function to populate the
list, passing in bionic's and the kernel's names for the architecture.

Also get rid of the ${LibcRoot} variable, it is not providing any value
and makes grepping harder.

Change-Id: I39e7907d312f52dd1378a3937ab1bcba12c4e97f
2016-07-21 11:17:01 -07:00
Pirama Arumuga Nainar a17442b2f2 Switch to prebuilt clang-3016494
Bug: http://b/29823425

Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

Change-Id: I27e03a611d60a2122f6970d6a33f7abdf433546a
2016-07-19 20:32:01 +00:00