Commit graph

27 commits

Author SHA1 Message Date
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
Jiyong Park
7495504db4 Change exportedDirs and exportedSystemDirs from []string to android.Paths
exportedDirs and exportedSystemDirs are now changed to android.Paths so
that we can later manipulate the paths via Rel(), etc.

Test: m

Change-Id: I6fb02ea4983bcebac351bc284f75b44885379e8f
2019-10-25 09:52:08 +09:00
Inseob Kim
64c4395386 Add version to vendor variants
Vendor variant is now divided into several vendor.{version} variants,
depending on their intended usages:

vendor.{BOARD_VNDK_VERSION}: vendor and vendor_available modules
vendor.{PLATFORM_VNDK_VERSION}: VNDK modules in the source tree
vendor.{snapshot_ver}: VNDK snapshot modules

This also affects exported module names from Soong to Make. But to
maintain backward compatibility, ".{BOARD_VNDK_VERSION}" suffix will not
be emitted for modules having version BOARD_VNDK_VERSION, so that vendor
modules still can be referred as-is.

Bug: 65377115
Bug: 68123344
Test: clean build and boot blueline
Change-Id: Ib9016a0f1fe06b97e9423fd95142653a89a343fa
2019-09-18 10:53:30 +09:00
Jiyong Park
1d1119f4bd Fix sanitizer dep
This change fixes a problem in sanitizerMutator where a module is linked
with of non-sanitized variant of a lib at build-time, but is linked with
the sanitized variant of the lib at run-time.

This happened because, for each sanitizer type, every shared libs are
split into non-sanitized and sanitized variants, and then either of the
variants are suppressed from Make so that it isn't installed to the
device.

This change fixes the problem by NOT splitting for shared libs; only the
sanitized variant is created if needed. Header libs, static libs and
shared libs for a few sanitizer types (asan/fuzzer) are however split
into two. This is because the static and headers libs become part of the
depending module, and asan/fuzzer require that the depending module and
the dependant module should be compiled for the same sanitizer.

Bug: 138103882
Bug: 138426065
Test: m com.android.runtime.debug
Check that libziparchive exists under both
/system/apex/com.android.runtime/[lib|lib64]

Change-Id: Ia447785c485c0d049e19477b32bc638bfe6f1608
2019-08-08 01:51:26 +09:00
Treehugger Robot
b879fb6b4b Merge "Separate exported includes out of flags" 2019-06-11 04:57:47 +00:00
Inseob Kim
6937844c29 Separate exported includes out of flags
Exported includes have been maintained along with other C/C++ flags.
This makes dependencies unclear, and users have had to parse flags to
get exported directories. This separates exported includes and
exported flags, thus making data more structured and explicit.

Bug: 132818174
Test: m
Change-Id: I5c25ac2224988c4a67e4db6fd6e4d39090b74041
2019-06-11 10:37:56 +09:00
Dan Willemsen
939408aa22 Add dependency to version script when linking stub libraries
This isn't an effective issue with local builds currently, since the
version script is generated from the same rule as the sources used to
compile the objects that are also used in the link command. But if we
ever separated those paths or adopted restat, we could miss this
dependency.

This is also required for my RBE build to actually expose this file to
the link step.

Test: treehugger
Change-Id: I32bbb18cf7edddc88759d4f445d081868f3e9b44
2019-06-10 18:02:25 -07:00
Jiyong Park
5e676fe9f0 Fix: HideFromMake is not registered to llndk_* module types
llndk_* module types are not initialized via cc.Module.Init(). As a
consequence, mutated properties like HideFromMake, etc. were not
registered and this caused problem when the mutated properties are set
by one of the mutators like the sanitizerMutator. Specifically, both
asan and non-asan variant of an llndk_header were both exported to Make
although HideFromMake was set to true for the non-asan variant.

Fixing this bug by explicitly registering BaseProperties struct which
contains the mutated properties.

Bug: 130652996
Test: Following works:
$ lunch aosp_cf_x86_pasan-userdebug
$ mkdir frameworks/native/test && mkdir frameworks/native/test/include
$ cat > frameworks/native/test/Android.bp
llndk_headers {
    name: "test_headers",
    export_include_dirs: ["include"],
}
^D
$ SANITIZE_TARGET='address' make

Change-Id: I44e3668460448d79382617df61171b0ab5b4d98d
2019-04-17 13:17:47 +09:00
Patrice Arruda
ea3fcdffc2 Soong: Add synopsis to several modules under the cc package.
Added synopsis to the following modules under cc package:
    * llndk_headers
    * llndk_library
    * vendor_public_library
    * toolchain_library

Bug: b/128337482
Test: Generated the documentation and verified that the synopsis was
added to each of the module.

Change-Id: I0f6e3b01b478d46afeacbe6fc8e05f96d6217c7d
2019-04-03 14:43:03 -07:00
Pirama Arumuga Nainar
65c95ff1fb Include libprofile-extras to all coverage variants
Bug: http://b/128524141

Include libprofile-extras (defined in system/extras/toolchain-extras) to
all modules that need a coverage variant.  Also add
'-uinit_profile_extras' when linking with coverage.  This causes the
setup code in libprofile-extras to be linked into binaries/libraries
with coverage enabled.

We add the static library to the non-coverage variants as well but is a
no-op for them (since the '-u...' flag is not added for them).

Adding this dependency creates several circular dependencies since
coverage variants were being created for other module types that never
had any compilation or linking done during the build.  This change stops
creating coverage variants for toolchain_library, cc_prebuilt_library_*,
cc_library_headers module types (by adding a function to the linker
interface to specify whether native coverage is enabled).

Test: m NATIVE_COVERAGE=true COVERAGE_PATHS=*
Test: blueline_coverage target in internal branch (using forrest)
Change-Id: I5db876eb953639a55ba007248dd24e497f987730
2019-03-29 08:56:42 -07:00
Jiyong Park
da6eb592bf Add use_vendor to APEX module
use_vendor, when set to true, brings vendor variant of the native
libraries and binaries to the APEX.

Bug: 115707625
Test: m (apex_test updated)
Change-Id: Ib4e996f8652f4ce4645a9c22f6914e2ab35edda6
2018-12-20 14:33:02 +09:00
Colin Cross
06080f4137 Fix double space in include argument
The double space is confusing compdb.go.  compdb.go should be fixed,
but the double space is unnecessary so remove it.

Also make -isystem consistently followed by a space.

Bug: 117124308
Test: m checkbuild
Change-Id: I5ce7530d2ef66be8d8285e252d60a39299984a06
2018-10-02 11:16:56 -07:00
Colin Cross
b60190a4f8 Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.

Relands If9008c50920779048480f5eeeb0084f26006c998 with fixes for
mac builds.

Bug: 113936524
Test: m checkbuild
Change-Id: I9710ff57f0793f36eb889eabd08bd60a365a88dd
2018-09-10 23:12:12 -07:00
Colin Cross
cb9342eabd Revert "Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules"
This reverts commit e2874cd99d.

Reason for revert: broke mac builds
Bug: 113936524

Change-Id: Id0311d6b202b18e80953da632133548d56ed851a
2018-09-10 21:35:34 +00:00
Colin Cross
e2874cd99d Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.

Bug: 113936524
Test: m checkbuild
Change-Id: If9008c50920779048480f5eeeb0084f26006c998
2018-09-10 11:04:01 -07:00
Justin Yun
732aa6afdf Set __ANDROID_API__ for vendor modules to vndk version.
When building vendor modules with BOARD_VNDK_VERSION=current, the
API of the vendor modules will be current PLATFORM_VNDK_VERSION.
__ANDROID_API_FUTURE__ will be used as before if the version is a
CODENAME.

If BOARD_VNDK_VERSION is not "current", that means the VNDK version
of the vendor modules is BOARD_VNDK_VERSION.

Bug: 74833244
Test: Build and check boot.
Change-Id: I383c76a36101e39c70575b463880b52d3e9d90bb
2018-03-27 08:21:19 +09:00
Dan Willemsen
540a78c1ce Turn GlobFiles into a Glob for files, use it
GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.

Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.

The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.

Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
2018-03-01 14:05:20 -08:00
Jiyong Park
a46a4d5a13 Fix: duplicated definition of llndk_headers module
A llndk_headers module was double defined; one as a header lib and the
other as a static lib. Since llndk_headers is a header lib, the static
lib is now deleted.

Bug: 70617292
Test: build. (TestLlndkHeaders added)
Change-Id: I1a3e9d1a73616ea4faf03664a7a4b03bd5955629
2017-12-14 21:28:53 +09:00
Colin Cross
f18e11074d Fix using aidl files from filegroups
Compute sources including from filegroup and genrule dependencies
before determining if any sources will cause flags to be added.

Test: gen_test.go
Change-Id: I0434b003bbda07a58bb2ce1a0a72997918c8fae2
2017-11-17 11:22:08 -08:00
Jiyong Park
64ca4b722a Make cc.NewLLndkStubLibrary as public
We need to extend llndk_library to automatically set symbol_file for the
llndk version of libclang_rt.asan* libraries.

Bug: 67011251
Test: build

Change-Id: Ib6964817759f9228456e4fb2a27fce3bc09423a9
2017-11-14 20:53:13 +09:00
Nan Zhang
0007d810e2 Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.

I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
2017-11-07 15:57:16 -08:00
Jiyong Park
2a45412445 LLNDK can re-export headers
Added export_llndk_headers properties to llndk_library module. And a new
module type llndk_headers is added. This is to enable an LLNDK library
to reexport other LLNDK headers.

Bug: 65395259
Test: do the following
// frameworks/native/libs/arect/Android.bp
llndk_headers {
    name: "libarect_vendor_headers",
    export_include_dirs: ["include"],
}

// frameworks/native/libs/nativewindow/Android.bp
llndk_library {
    name: "libnativewindow",
    ....
    export_llndk_headers: ["libarect_vendor_headers"],
}

check that
-Iframeworks/native/libs/arect/include is in LOCAL_EXPORT_CFLAGS of
libnativewindow.vendor in out/soong/Android-<product>.mk

Change-Id: If1650414b2967f2042f4ebe2b593ed3f3ea45d3a
2017-10-25 10:30:05 +09:00
Jiyong Park
82e2bf3b7f vendor_available:false hides a lib from vendors
When a lib is explicitly marked as `vendor_available: false`, then it
can't be directly depended by a vendor lib which is installed to /vendor
partition. This is to hide some VNDK libs (including llndk) from vendors
so that platform owners can have a freedom of modifying their ABI
without breaking vendors.

In addition, the list of the private libs are exported to the make world
as VNDK_PRIVATE_LIBRARIES.

Also, fixed a bug that allowed a vndk lib to link against to vendor
library (or vendor variant of a system lib) if the lib is prebuilt.

Bug: 64730695
Bug: 64994918
Test: Add `vendor_available: false` to libft2 and libcompiler_rt.
Add the libs to shared_libs property of a vendor library in soong
(i.e. libnbaio_mono). The build fails with the error message.

Change-Id: Iab575db96bb4f6739a592f3fa0a75124296bea0c
2017-10-10 19:38:06 +09:00
George Burgess IV
f5310e3f88 Add to cflags in compilerFlags()
These compiler flags weren't being properly added to ToolingCFlags,
which was causing clang-tidy to complain a lot about incompatible
redeclarations of library functions. Moving them to compilerFlags()
causes them to be added to ToolingCFlags.

Bug: None
Test: mma in bionic/. clang-tidy now shows 7,142 fewer high-severity
warnings.

Change-Id: If5148858d9db143a3dd9b0ce6c970258ec4ff9cb
2017-07-19 11:53:54 -07:00
Colin Cross
36242850fd Refactor factories
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.

Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
2017-06-30 21:08:36 +00:00
Dan Willemsen
01a90597bc Remove explicit suffixes from (ll)ndk_library
Soong can rename these automatically for internal use, so don't require
users to set these.

Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Merged-In: Ia92356a0ec079f908fd49812231228046783e50d
Change-Id: Ia92356a0ec079f908fd49812231228046783e50d
2017-04-11 15:14:11 +00:00
Dan Willemsen
b916b80bf3 Add LLNDK support for the VNDK
Instead of using the NDK headers and libraries, add LL-NDK specific
headers and library stubs for VNDK users. This allows us to provide an
expanded liblog interface.

Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ic85f07fa10c695b5baab10c41f5e0ad38700bf3d
2017-04-07 10:18:56 -07:00