Commit graph

246 commits

Author SHA1 Message Date
Martin Stjernholm
bf37d165f0 Fix missing NOTICE targets for static libs that aren't available to
platform.

The NOTICE file generation depends on the NOTICE targets for all static
library dependencies. If such a dependency didn't have
//apex_available:platform it didn't get any AndroidMk entry and hence
no NOTICE target via soong_cc_prebuilt.mk. If it was then depended upon
by a binary or library that is accessible to platform, the NOTICE
dependency failed.

Normally such a dependency is invalid, but there are corner cases where
binaries go neither into platform nor any APEX module, and they can
legitimately have such dependencies (cf. b/152241137).

With this CL requests to skip installation of such a static libraries
are ignored so that they get AndroidMk entries, which will always have
LOCAL_UNINSTALLABLE_MODULE set.

Test: "m simpleperf_ndk" with https://r.android.com/1273016, which
  removes //apex_available:platform from libs that simpleperf_ndk
  depends on statically.
Bug: 152241137
Bug: 149217815
Change-Id: If36e85dd16ade56d4ec1d6744811df5a15b6242c
2020-04-01 11:08:41 +01:00
Jooyung Han
ad4c18765e Add version suffix for stub modules' Android.mk
Becase there can be more than one stub libraries, LOCAL_MODULE should be
suffixed with SubName just like NDK stub.

Note that suffix should not be appended to the latest version if the
library is provided by APEX, Otherwise, those libs always need to be
referenced with suffix in .mk files.

Bug: 145796956
Test: m
Change-Id: If503fa651a63b0b215742553b250ecf5e0a30971
2020-03-07 03:12:45 +09:00
Colin Cross
d80cbca76d Convert cc to AndroidMkEntries
Use AndroidMkEntries so the next patch can use ExtraFooters, which
doesn't exist in AndroidMkData.

Test: manually diff out/soong/Android.aosp_x86_64.mk
Change-Id: Ia3006b6747813693cf7e2b536030b21f3109f538
2020-02-25 19:53:04 -08:00
Treehugger Robot
07f37120e5 Merge "Do not hide VNDK prebuilts from make" 2020-02-20 00:02:40 +00:00
Inseob Kim
c3b1a166d2 Fix build error on vendor_snapshot_static
Without this, Makefile wasn't able to link against
vendor_snapshot_static library.

Bug: 149252327
Test: manual linking
Change-Id: Idd65656b58d12f8489827df081ef08e40ceb5af9
2020-02-18 12:42:54 +09:00
Inseob Kim
2b96bf5441 Do not hide VNDK prebuilts from make
Flattened APEXes don't install modules hidden from make. This CL unhides
VNDK prebuilt modules to make VNDK APEX work correctly. The suffix for
VNDK prebuilt is still omitted if the version of prebuilt is same with
BOARD_VNDK_VERSION.

Bug: 149542527
Test: build arm64 GSI and flash
Test: Set BOARD_VNDK_VERSION and build
Change-Id: I54a7c14c93eccfefc81603ec3bb474a031bc55af
2020-02-17 19:01:13 +09:00
Inseob Kim
eec88e1de8 Add vendor snapshot modules
This implements four modules (static/shared/header libraries, and
binaries) for vendor snapshot. These modules will override source
modules if BOARD_VNDK_VERSION != current.

Bug: 65377115
Test: 1) VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: 2) install snapshot under source tree
Test: 3) set BOARD_VNDK_VERSION and boot cuttlefish
Change-Id: I24ddb4c3aa6abeab60bbfd31bcbd8753e2592dc5
2020-02-07 02:59:24 +09:00
Yifan Hong
1b3348d50a Add ramdisk image.
It is similar to recovery image.
Test: m nothing -j

Change-Id: I11389777c6bfb0c0d73bbb4c70091c1e70f44077
2020-01-22 16:54:18 -08:00
Vic Yang
d92090fb29 Emit LOCAL_CHECK_SAME_VNDK_VARIANTS
If a VNDK library does not require using different core and vendor
variants, emit LOCAL_CHECK_SAME_VNDK_VARIANTS so that the two variants
can be checked for identicalness.

Bug: 145157349
Test: With the corresponding change in build/make, remove libbinder
      from build/soong/cc/config/vndk.go and check a build fails
      even without TARGET_VNDK_USE_CORE_VARIANT set.

Change-Id: I7698edf9a24b0df150c0e4f7d8dd4926f053eee8
2020-01-08 14:44:38 -08:00
Dan Shi
2468d015fe Pass auto_gen_config setting in Android.bp to makefile
Bug: none
Test: local test with fuzzy_fastboot
Change-Id: I2c62f6fb58737538ef9e1e9fcbe63e03dfa7ee91
2020-01-06 16:21:10 -08:00
Justin Yun
5f7f7e8a39 Create product variant for product partition
When PRODUCT_PRODUCT_VNDK_VERSION is set to 'current', product
modules are enforced to use only VNDK libs from the system partition
as BOARD_VNDK_VERSION does to vendor partition.

Modules with 'vendor_available: true' create product variant as well
as core and vendor variants. The product variant as an image variant
is used for the modules in /product or /system/product.

It must not affect the current build behavior without
PRODUCT_PRODUCT_VNDK_VERSION set.

Bug: 134099726
Bug: 138966004
Bug: 144534640
Test: build without PRODUCT_PRODUCT_VNDK_VERSION set
Change-Id: I4d3585c110d84493e45bf76d550dc240bb26137f
2019-12-20 17:56:08 +09:00
Tri Vo
ad172d88b6 cc_fuzz: add "data" field
"data" field specifies data dependencies that will be installed in
fuzzer's output directory.

"data" behaves similar to "corpus", except "data" preserves directory
structure, e.g.

    data: ["foo/bar.txt"]

is installed into

    $OUT/data/fuzz/<arch>/<target>/data/foo/bar.txt

Test: build a fuzzer with data depenency, check data is installed
correctly
Change-Id: Ia1255026278435181b6d93f91f8f9ad39c96d07f
2019-12-05 14:45:51 -08:00
Mitch Phillips
e1ee1a1297 Soong frontend for shared library fuzzing.
Additional context (for Googlers): go/android-fuzzing-shared

This patch adds the Soong frontend for shared library fuzzing. We
traverse dependencies at soong install time to find all transient shared
libraries that $module depends on. We then ask the Make backend to
depend on the shared library.

We also create the source:destination mappings between where the shared
libraries are built to where they should be installed to for fuzzing.
This is then depended on by the Make backend.

Bug: N/A
Test: m fuzz, note the contents of $ANDROID_PRODUCT_OUT/data/fuzz/lib,
and out/soong/fuzz-target-*.zip now has shared libraries.

Change-Id: Id7afbd34bc9c055110af96cd3c668b730d404aee
2019-11-08 08:48:13 -08:00
Jooyung Han
b01c114d27 Do not install VNDK lib in favor of VNDK APEX
Since VNDK APEX replaces VNDK lib /system/lib/vndk{-sp}, VNDK libs are
not installed.

Bug: 141451661
Test: m && boot device
Change-Id: I14686927a56ded5176839c89f29a2fd7e0fca658
2019-10-30 00:07:25 +00:00
Ivan Lozano
765fe7a501 Merge changes Ia7deed13,I7378a46f
* changes:
  Add support for Rust C libraries.
  Add a common interface for cc linkable libraries.
2019-10-29 21:47:14 +00:00
Ivan Lozano
52767be335 Add support for Rust C libraries.
Adds the ability for rust modules to be compiled as C libraries, and
allows cc modules to depend on these rust-generated modules. This also
means that soong-rust should not have any dependencies on soong-cc aside
from what's required for testing.

There's a couple small fixes included as well:

 - A bug in libNameFromFilePath that caused issues when library's had
 "lib" in their name.
 - VariantName is removed from rust library MutatedProperties since this
 was unused.

Bug: 140726209
Test: Soong tests pass.
Test: Example cc_binary can include a rust shared library as a dep.
Test: m crosvm.experimental
Change-Id: Ia7deed1345d2423001089014cc65ce7934123da4
2019-10-28 22:09:01 -07:00
Kris Alder
f979ee3873 add additional fields to cc_fuzz build types
Specifically, this adds:
* Owner
* Disable (stop fuzzer from running in Haiku)
* Bug Component
* Bug Hotlist

The fields are all inside a new 'options' struct.

The values from these fields (if any) are written into a config file as
json.

Bug: 142551000
Test: ran locally with a modified build file and verified output in .zip
Change-Id: I86edf74c2cebe9912ac0ad203f99028be4062c8b
2019-10-28 16:15:50 -07:00
Jooyung Han
6db2f177db Partial reverts of vndk-apex
This installs vndk libs under system/lib/vndk
instead of vndk-apex.
(Partial reverts of 31c470b5d5)

Also fixes the bug 097087be53 brought.
This produced incomplete list of vndkcorevariant.libraries.txt.

Bug: 143374795
Test: m && boot
Change-Id: I17864de4770a84431756e0c3765b601d3dc2abb1
2019-10-28 14:12:48 +09:00
Treehugger Robot
b480debbd8 Merge "Change exportedDirs and exportedSystemDirs from []string to android.Paths" 2019-10-28 02:24:41 +00: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
Jooyung Han
31c470b5d5 Revert "Revert "Supports VNDK APEX with different versions""
This reverts commit 48dd4b5ea4.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
2019-10-19 02:28:39 +09:00
Mitch Phillips
8a2bc0b9fd Re-plumb fuzz corpora.
Re-plumb the fuzz corpora through an intermediates directory.
Previously, due to the way that LOCAL_TEST_DATA is implemented, we would
break when corpora were included:
 a) outside of a corpus/ directory, or
 b) not directly under the module directory (i.e. my_module/subdir/corpus)

Corpora are now written into an intermediates directory so that they
play nice with LOCAL_TEST_DATA, because unfortunately the key-value pair
required there is not as simple as source:destination.

Test: m example_fuzzer && ls \
$ANDROID_PRODUCT_OUT/data/fuzz/arm64/example_fuzzer/corpus
Bug: N/A

Change-Id: I5888b06ed349781c6712f1ae77cc3582283a9552
2019-10-17 16:11:00 -07:00
Jooyung Han
48dd4b5ea4 Revert "Supports VNDK APEX with different versions"
This reverts commit 394951da73.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I4ce2e4a4c683c71958bc4f73e45a5ddd4a4ae32a
2019-10-16 23:50:39 +00:00
Jooyung Han
394951da73 Supports VNDK APEX with different versions
Older VNDK libraries are provided as vndk_prebuilt_shared modules. Those
are added to corresponding VNDK APEX as dependencies.

With VNDK APEX installed, VNDK libs are unnecessary. By the way, since
there can be vendor modules which depend on VNDK libs, Make targets are
still emitted with UNINSTALLABLE=true.

Android.mk has additional modules for vndk libraries which are named
with apex name as suffices. For example, if libfoo is a vndk library,
then libfoo.vendor is its vendor variant and it would be in
/system/lib/vndk. But with vndk apex, it has additional
libfoo.com.android.vndk.current variant.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
Change-Id: I269c28a4d4c4e2f1518bd51df558438fe5316774
2019-10-15 07:33:49 +09:00
Colin Cross
ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Treehugger Robot
4e839ec3a5 Merge "Add corpus and dictionary properties to cc_fuzz." 2019-09-19 13:51:17 +00:00
Mitch Phillips
4e4ab8a141 Add corpus and dictionary properties to cc_fuzz.
Adds the corpus and dictionary properties to the cc_fuzz target.
Propagates these entries to the makefile backend via LOCAL_FUZZ_DATA, in
a similar manner to LOCAL_TEST_DATA.

Bug: 141026328
Test: m example_fuzzer, fuzz target should have adjacent corpus/dict
files.

Change-Id: If5add5a597cc479f4e084bdafbd0fc175cfd6321
2019-09-18 18:55:27 -07: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
Ivan Lozano
022a73b9ad Move splitFileExt to the android package.
Both Rust and cc use this function, so move it over to android
package's util.go and export it.

Bug: 140734195
Test: m -j

Change-Id: Ibe8b7a94592e402468a027ad6027b187f29c8e07
2019-09-09 20:29:31 -07:00
Martin Stjernholm
cc4b0ad706 Update dexpreopt for the ART APEX name change.
Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
Merged-In: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
2019-08-30 17:47:30 +01: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
Treehugger Robot
75fcf98038 Merge "exports LOCAL_SOONG_VNDK_VERSION for VNDK libs" 2019-05-25 00:16:31 +00:00
dimitry
db41747c8b Fix override for native_bridge modules
Native_bridge modules should override only native_bridge modules
and not regular ones.

Bug: http://b/77159578
Test: make 4-arch product
Change-Id: I79d96736082397abeb36d653840679a7aa0edbf5
2019-05-23 13:35:13 +02:00
dimitry
4320449c97 Apply native_bridge suffix to all cc_modules
This fixes the problem with cc_object not having this suffix and
as a result overriding non-bridged variants for modules using mk files.

Bug: http://b/77159578
Test: build 4arch product
Change-Id: Ie958f997c6f54f93d8b2987ca5ba605004e1eb70
2019-05-23 13:31:10 +02:00
Jooyung Han
76106d977e exports LOCAL_SOONG_VNDK_VERSION for VNDK libs
For vndk_prebuilt_shared module, it is set by 'version' property.
For other vndk libs(e.g. cc_library with vndk.enabled), it is set as
PLATFORM_VNDK_VERSION.

Background:
To support "skip installing current VNDK".

You can get a system.img without current VNDK libs.
This may help when you want a smaller system.img given that the image
will be used with a specific version (not current) of vendor image.

Bug: 132140714
Test: m TARGET_SKIP_CURRENT_VNDK=true && see if current VNDK is not
installed

Change-Id: I1c603efc3e95fe8bdf870f2de91994077899fca7
2019-05-21 14:56:27 +09:00
Inseob Kim
9516ee9556 Attach global variables to Context
Global variables make testing difficult, and they should attached to
Context.

Bug: N/A
Test: m
Change-Id: Ic671dda755e99d036c7ddce0eed114496374d7ec
2019-05-09 12:29:58 +09:00
Logan Chien
41eabe63e8 Support opt-in ABI checks
This commit allows a module to opt in for ABI checks even when it is
not an LLNDK/VNDK module.

Bug: 131421213
Test: Add `header_abi_checker { enabled: true, }` to some module
Change-Id: Ie09d262e651cbb44d7d0eba652f55dc1e1e52962
2019-04-27 01:55:50 +08:00
Vic Yang
efd249e62a Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.

Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.

Bug: 119423884
Test: Add a dummy VNDK library and build with
      TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
      build/make change.

Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
2019-03-21 04:29:24 +00:00
Jiyong Park
f11943527d Create symlink for bionic files
This change creates following symlinks for bionic files.

/system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so
/system/lib/libm.so -> /apex/com.android.runtime/lib/bionic/libm.so
/system/lib/libdl.so -> /apex/com.android.runtime/lib/bionic/libdl.so
/system/bin/linker -> /apex/com.android.runtime/bin/linker
...

This allows us to not have mountpoints under /bionic.

Bug: 125549215
Test: m and inspect the symlinks in the system partition.
Change-Id: I3a58bf4f88c967862dbf06065a1af8fc4700dda3
2019-03-15 03:04:52 +09:00
Jiyong Park
47e4fcb6d3 Don't emit symbol for stubs libraries
The stubs libraries are buildtime-only artifacts. Since they are not
used at runtime, no need to emit symbol files for them

Test: m
Change-Id: I54410e9289b4bf61e23581386b56ade8fba18dfa
2019-02-06 22:40:29 +09:00
Logan Chien
4fcea3d9a3 Add prebuilt ABI checker support to soong
This commit adds prebuilt ABI checker support to soong so that
`cc_prebuilt_library_shared` and `cc_prebuilt_binary` are checked.

To opt out the check, add `check_elf_files: false` to your module.

Bug: 119086738
Test: lunch aosp_sailfish-userdebug && CHECK_ELF_FILES=true make check-elf-files
Change-Id: Idb4290c8f48aad545894a7ae718a537cbf832233
2019-01-23 10:15:02 +08:00
Nicolas Geoffray
c22c1bf130 Return false in DirectlyInAnyApex for host libraries.
Host doesn't have apexes.

Bug: 122947954
Test: build dex2oat, check that libnativebridge is installed.
Change-Id: I3548e3f155a200e56d71e88631b71511bad84161
2019-01-16 23:37:07 +00:00
Jiyong Park
b07885714c Rename non-stubs variant of a lib if it is included in APEX
If a lib is directly included in an APEX (via native_shared_libs
property) and the lib has stubs (via stubs.versions property), then the
ordinary non-stubs variant of the library is renamed to
<libname>.bootstrap in the makefile. At the same time, the stubs variant
of the lib becomes visible and it's name is <libname>.

This ensures that modules in Android.mk build against the stubs
variant thus preventing them from using private APIs in the lib.

The non-stubs variant, however, is used if the module explicitly has
set the new 'bootstrap' property to true. This is useful for building
some early binaries (such as init and vold) which need to run before
APEXes are activated. Since they can't use the bionic libs from the
runtime APEX, they should use the bionic libs left in the system
partition which is called the boostrap bionic.

Bug: 120266448
Test: m
Test: m with https://android-review.googlesource.com/c/platform/bionic/+/849044

Change-Id: I882b8aeb5b29460f07b4424e4f8eb844d6c9a9b0
2019-01-10 09:57:29 +09:00
Jiyong Park
f7df9b7e55 Fix: 'required' property is ignored
This change fixes a bug that the 'required' property of a module is
ignored when the module is using a shared from an APEX. This is
happening because LOCAL_REQUIRED_MODULES is overwritten (with := instead
of +=) when ApexesProvidingSharedLibs is not empty.

Fixing the bug by appending ApexesProvidingSharedLibs to
AndroidMkData.Reuired so that it is handled in android/androidmk.go

Test: m
Test: build with https://android-review.googlesource.com/c/platform/bionic/+/849044
and make sure that system/bin/vold_prepare_subdirs exist.

Change-Id: Ie57bca480ba4198b4da0df1c73e92fa42b5ebda8
2019-01-04 01:19:44 +09:00
Jiyong Park
de866cbe50 Stubs dependency is not installed
When the stubs variant of a library is dependend by a platform component
and the library is included in one or more APEX, the library is not
installed to the platform, because it is provided by APEX.

Bug: 120266448
Test: m
Test: add stubs: { versions: ["1"], }, to libnetd_resolv
then build netd. libnetd_resolv.so does not exist under /system.

Change-Id: I09b78e38df285033ef6e9c85f7ea4b0274e85070
2018-12-13 10:48:15 +09:00
Dan Willemsen
569edc5f66 Add dist support to Soong
When dist'ing a library or binary that has use_version_lib set, always
distribute the stamped version, even for the device.

Test: m test_build_version_test dist
Change-Id: I2995ec516b1d182ce18f099aeaa4d186ffbcf01f
2018-11-19 15:26:14 -08:00
dimitry
d95964a350 Enable overrides and add stem library properties
This allows modules to override exiting libraries
with custom implementations.

Bug: http://b/114470065
Test: make
Change-Id: I2692a5416a2620ab2268df8998dd2620074adc1f
2018-11-16 18:45:56 +00:00
Jaewoong Jung
16c7d3d263 Revert "Revert "Revert "Revert "Export static libraries.""""
This reverts commit 555c114283.

Reason for revert: The namespace issue in the pi-dev-plus-aosp-without-vendor branch is now fixed.

Change-Id: I26ed591447797a8ee505f43bdd209162418b6c5e
2018-11-16 01:20:05 +00:00
Jaewoong Jung
555c114283 Revert "Revert "Revert "Export static libraries."""
This reverts commit eb05c2a633.

Reason for revert: Yet another broken build.

Change-Id: I4198f2dd5c7848365d71d03f6dbd598998fb9bd8
2018-11-09 22:25:37 +00:00
Jaewoong Jung
eb05c2a633 Revert "Revert "Export static libraries.""
This reverts commit 3affc07ca0.

Reason for revert: The notice dependency bug is now fixed.

Change-Id: I5424ade9d742fbe190651097c04914a29db6dfa0
2018-11-09 16:02:34 +00:00
Jaewoong Jung
3affc07ca0 Revert "Export static libraries."
This reverts commit 9d5ca159dc.

Reason for revert: This broke few builds.

Change-Id: Id9c4d7c145602a55ae07bb177f2c236e16f4fb63
2018-11-06 18:00:39 +00:00
Jaewoong Jung
9d5ca159dc Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: If1ca1f9159e80cf8fbe71df7a13ca5d6a1f63b40
2018-11-05 23:48:10 +00:00
Jaewoong Jung
3e6b1fbcfb Revert "Export static libraries."
This reverts commit 5d19e1de88.

Reason for revert: Broke aosp-build-tools/darwin_mac

Change-Id: I1af36848fb5a00849aec69941ddef33769b1b536
2018-11-02 22:56:30 +00:00
Jaewoong Jung
5d19e1de88 Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: Ic63ca523b40acac82bbe876f7aa40ecd495907c5
2018-11-01 22:45:59 +00:00
Jiyong Park
9d45299ba4 Add ApexModule interface for APEX-aware modules
ApexModule is the interface for APEX-aware modules. The module type apex
uses the interface to get APEX-specific information from other modules,
such as the list of APEXs that a module should be built for.

A module that is included in an APEX will be built specificaly for the
APEX. This is especially required for shared libraries; we shouldn't
just copy the artifacts built for platform, because they may be linking
against private (=unstable) symbols that are not available to APEXs
which are basically unbundled.

This CL, as a first step, makes cc.Module an APEX-aware module type.

Bug: 112672359
Test: m apex.test; the built apex has all the direct and transitive
shared lib dependencies of the libs and executables listed in Android.bp

Change-Id: I21f6a586654779984f0f5154b2a08b2adbf2168b
2018-10-11 11:19:07 +09:00
Dan Willemsen
2e224cae8e *_OUT_INTERMEDIATE_LIBRARIES has been removed from Make
So LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES is no longer necessary. And just
export the object paths directly to make instead of copying into the
intermediate libraries directory.

Test: m
Change-Id: Iba1523aec642fc81e9bf61da3125f714e91cd557
2018-09-15 10:46:17 -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
Colin Cross
22f3795dca Remove relocation packer
The relocation packer prebuilt is gone, remove the references to it.

Bug: 110715614
Test: m checkbuild
Change-Id: Ia20f8198e4fc206f4995dd5168c811dac7c9df89
2018-09-05 16:30:11 -07:00
Colin Cross
303e21f695 Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
2018-08-14 15:44:08 -07:00
Logan Chien
031d2b32e3 Support prebuilt shared libs end with versions
This commit changes how `cc/androidmk.go` generates LOCAL_MODULE_STEM,
LOCAL_MODULE_SUFFIX, and LOCAL_BUILT_MODULE_STEM.  Now, `splitFileExt()`
takes a file name and a list of expected file extensions.
`splitFileExt()` searches the first occurrence of expected file
extensions in the file name.  If it can not find any, it will simply
return the last file extension.

Before this commit, `cc/androidmk.go` simply extracts the last file
extension (e.g. `.so`).  However, if the prebuilt shared libs end with
version numbers (e.g. `libc++.so.1`), it will use `$(LOCAL_MODULE).1` as
LOCAL_BUILT_MODULE_STEM and this will lead to missing target ninja
error.

Bug: 111579848
Test: Build a program that links libc++_host (from prebuilts/clang)
Change-Id: Id96726c69705d518ea725bb6abd8ff4527ca0cbc
2018-08-09 10:45:18 +08:00
Julien Desprez
e146e39fa6 Support 'test_config' into soong modules
Test: make general-tests
Bug: 110982517
Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
2018-08-07 15:51:21 -07:00
Jiyong Park
97686288dd LOCAL_SDK_VERSION is not emitted for recovery variant
recovery variants are not built with NDK (useSdk() is false for
recovery). So LOCAL_SDK_VERSION shouldn't be emitted for the recovery
variants as well.

Test: m -j liblzma.recovery does not show any link type check error

Change-Id: Icb6c4fc766060e3f1555c405d5785ef5a015c629
2018-05-30 10:37:25 +09:00
Jiyong Park
f9332f1c86 Support recovery and recovery_available
`recovery: true` installs a module to the recovery partition.
`recovery_available: true` makes a module to be available to other
`recovery:true` or `recovery_available: true` modules.

These to are very similar to vendor, vendor_available properties, except
for the target partition.

Bug: 67916654
Bug: 64960723
Test: m -j, toybox_recovery is installed to the recovery/root/sbin
Change-Id: Iaebe0593de16c69fa70de251a61f4d018a251509
2018-05-15 16:27:12 +09:00
Logan Chien
43d34c38d8 Introduce runtime_libs to cc_binary and cc_library
This commit adds `runtime_libs` to cc_binary and cc_library.

Similar to the `required` property, if a module specifies the
`runtime_libs` properties and it is installed, then the modules
specified in `runtime_libs` will be installed as well.

Differnt from the `required` property, if a module is using VNDK and the
module names specified in `runtime_libs` are resolved to the modules
with both core and vendor variants, then '.vendor' will be appended to
those module names.

For example, if `libb` is vendor_available and `libd` is a vendor lib,
then LOCAL_REQUIRED_MODULES will contain `libb.vendor` (instead of
`libb`).

Bug: 72343507
Test: lunch aosp_arm64_ab-userdebug && make  # this runs the unit tests
Test: Create a vendor module with runtime_libs property to a
vendor_available shared library and check the generated Android.mk.

Change-Id: I9e245d80004dab597a5d3db5acd8a09117118db7
2018-04-25 14:47:50 +08:00
Nelson Li
1f6b14e822 build/make: set LOCAL_NATIVE_BENCHMARK for Google Benchmark Test
Set LOCAL_NATIVE_BENCHMARK to true. Then, build system can use it
to auto generate the related Test config file of Google Benchmark
Test

Bug:74844131
Test: Use mm to rebuild any module in cc_benchmark
Change-Id: I6a8f1ff78f7aec3f4eb17e218845f0cdf3f57f32
2018-04-18 17:28:57 +00:00
Yifan Hong
946e32e184 Add overrides to cc_binary
Test: use it for healthd, it is not installed.
Bug: 77541952

Change-Id: I170a31d1b4d15f20de6a6b6279a2eeda49ca7447
2018-04-03 16:02:29 -07:00
Jiyong Park
374510bcb6 Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.

However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).

This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:

cc_library {
   name: "libvendor",
   proprietary: true,
   ...
}

vendor_public_library {
   name: "libvendor",
   symbol_file: "libvendor.map.txt",
}

This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.

Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-30 10:22:52 +09:00
Jae Shin
43ef264b3a Add target_arch to vndk prebuilt module name
To distinguish libfoo.vndk.$VER prebuilts of various
vndk_v$VER_$ARCH phony package modules, append $ARCH to the
LOCAL_MODULE name for VNDK prebuilts.
e.g. libfoo.vndk.$VER becomes libfoo.vndk.$VER.$ARCH

Test: m -j PRODUCT_EXTRA_VNDK_VERSIONS=27
Bug: 71370248
Change-Id: I3e9ebd929111ceb48e362c500adfb4b7a94444e8
2018-01-04 11:02:39 +09:00
Dan Albert
8ba131b3e2 Expose the NDK STLs to make.
Without this any module exposed to make that uses an NDK STL will
have unsatisfied dependencies.

Test: make native
Bug: None
Change-Id: Ia456cdc230d5ebf5e1256ab131ab78248b790bc8
2017-12-15 14:51:30 -08:00
Colin Cross
5beccee92c Split logtags implementations for cc and java
Logtags files in cc and java are treated fundamentally differently.
In cc, they are not used for compiling at all, but need to be passed
to Make to be combined into the global logtags list, and logtag files
are listed in a logtags property.  In java they are listed in srcs
and produce generated code that is compiled in, and so shouldn't
also need to be listed in a logtags property.

Move the logtags property to cc and export it to Make from there,
and have java extract logtags files from srcs to be exported to
Make.

Test: m checkbuild
Change-Id: I31d49289efe72db60d2f33566df771b4a3ebc8a0
2017-12-07 15:32:30 -08:00
Colin Cross
7a6fcbe302 Run gofmt -w
Test: none
Change-Id: I2b503e06a4ae8e72a08f6bfb64692dfd33e2b7e2
2017-12-06 13:19:14 -08:00
Justin Yun
7154928c93 Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.

Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.

Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
    name: "libfoo",
    version: "27",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    arch: {
        arm64: {
            srcs: ["arm/lib64/libfoo.so"],
        },
        arm: {
            srcs: ["arm/lib/libfoo.so"],
        },
    },
}

The Android.bp for the snapshot modules will be auto-generated by a
script.

Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
      copy a snapshot for v27
      build with make command

Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-12-05 10:19:43 +09:00
Colin Cross
0875c52de7 Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
2017-11-29 05:04:30 +00: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
Orion Hodson
33c252c2f1 Revert "Build system changes for CFI (Soong)"
This reverts commit d4b484b070.

Rationale: second in group of commits that left aosp_x86_64 not
building. (See https://android-build.googleplex.com/builds/
submitted/4426589/aosp_x86_64-eng/latest/logs/build_error.log)

Bug: 30227045
Test: builds
Change-Id: I38ab5284c614d6ee68e7359219bd75c7d50131be
2017-10-31 21:01:00 +00:00
Vishwath Mohan
d4b484b070 Build system changes for CFI (Soong)
This CL makes multiples changes in preparation for platform-wide CFI.

(a) Adds a second -version-script=... to the command line
when building components that use a version script. This ensures that
__cfi_check is also exported, and allows CFI to be enabled for these
components.

(b) Adds both topdown and bottom up mutators for CFI to help propagate
dependencies correctly for components that may need CFI disabled.

(c) Fixes an issue with the mutators to correctly apply settings to
both generated variants

(d) Fixes issues when components have more than a single visibility
flag.

Bug: 30227045
Test: SANITIZE_TARGET=cfi m -j40 # dependencies are correctly built
                                 # with/without CFI

Change-Id: I44793cc03bcbcdaa957cc49c7240b87d7c9db327
2017-10-30 01:42:31 -07:00
Jeff Gaston
af3cc2d23c Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: I88c24a8a31ef68f428919087d206433659265684
2017-10-18 18:06:02 +00: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
Jeff Gaston
7b6118be6b Revert "Some clarifications in preparation to automatically order linker dependencies"
This reverts commit 2370af0e23.

Reason for revert: New Build Breakage: aosp-master/aosp_arm64_ab-userdebug @ 4376965

Change-Id: Ibe4b819c4292457c454bf42e6d94fba3071ec04b
2017-10-04 21:07:42 +00:00
Jeff Gaston
2370af0e23 Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: Ia3fdb8f38e83ad8225a72c8de2804db23a90ef9b
2017-10-03 17:18:01 -07:00
Dan Willemsen
866b563d4c Add target.linux_glibc and target.bionic
target.linux_glibc will apply to host builds with glibc, which is
identical to the current target.linux. In a future change, target.linux
will change to affect all targets using the Linux kernel (android,
linux_bionic, and linux_glibc).

target.bionic will apply to all OS variants using Bionic.

Bug: 31559095
Test: Add target.linux_glibc, target.bionic sections to an Android.bp, build
Test: m host
Change-Id: I677a67c22fba148fec264132311e355283f9d88d
2017-09-26 22:41:37 -07:00
Dan Willemsen
3e5bdf29ba Add cc_genrule
cc_genrule is the same as a normal genrule, but can depend on other cc
modules (like cc_object).

Test: mmma external/minijail
Change-Id: I8df87665c7bdc76ce89c92755c054f967a818e57
2017-09-18 23:33:25 -07:00
Colin Cross
0f86d186b1 Allow AndroidMkData.Custom handlers to extend normal values
Pass accumulated AndroidMkData to AndroidMkData.Custom handlers
and expose WriteAndroidMkData so that Custom handlers can write
out the normal make variables and then add their own.

Test: No change to out/soong/Android-aosp_sailfish.mk
Change-Id: Id9717132bbd6c5cf3af8596f3eaa9bbb05d98e40
2017-08-11 15:24:11 -07:00
Colin Cross
a18e9cfa29 Remove error from AndroidMkDataProvider.AndroidMk
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I3e3b7251f32ffa84dbdfd0448faf248c306ca808
2017-08-11 15:24:11 -07:00
Colin Cross
91825d2279 Remove error from AndroidMkData.Custom
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I021c7971ede3e11bbe08cf1601f4690ed4d1a036
2017-08-11 15:24:11 -07:00
Colin Cross
27a4b05441 Remove error from AndroidMkData.Extra
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I8a117a86aa39aeb07d9d8d0686ef869c52784f19
2017-08-11 15:24:11 -07:00
Jiyong Park
27b188bc86 .vendor suffix is added only for libs having core/vendor variants
When the lib is vendor-only, then .vendor suffix is not added.
Furthermore, this change correctly adds .vendor suffix even to the names
listed in LOCAL_SHARED_LIBRARIES so that we don't need to add the suffix
in the make world.

This also allows us to use the original name (without the .vendor
suffix) of the vendor-only modules in make (e.g. in PRODUCT_PACKAGES or
as a make target).

Bug: 37480243
Test: BOARD_VNDK_VERSION=current m -j <name> is successful, where <name>
is one of the vendor-only libraries in Soong. (i.e.
android.hardware.renderscript@1.0-impl)
Test: m -j does not break anything

Change-Id: I203e546ff941878a40c5e7cfbb9f70b617df272d
2017-07-27 08:54:52 +09:00
Anders Lewis
b97e818201 Add support for data field in cc_benchmark.
Test: mm -j at source root; Run on blueprint with data in cc_benchmark.
Change-Id: I6647fe95c96a6df27a54633f6a520a032487ca97
2017-07-17 14:42:58 -07:00
Jayant Chowdhary
715cac3971 Optimizations to abi checking.
We now add export_static_lib_headers, export_generated_headers to the
filters while dumping the abi of a library using header-abi-dumper
(through -I<dir> additions to the invocation of header-abi-dumper and
header-abi-linker)

Also add support for zipped reference source based abi dumps.

Test: mm -j64 in hardware/interfaces/nfc/default/1.0 produces
android.hardware.nfc@1.0.so.lsdump with abi filtered out using generated
headers.

Test: Copied the linked abi dumps produced by mm -j64 in bionic/libc to
prebuilts/abi-dumps/ndk and gzipped them. Ran mm -j64 again in
bionic/libc and verified header-abi-diff getting invoked.

Bug: 32750600

Change-Id: I26210af908c87a6143e39fa25f50307acb68a387
2017-05-25 14:46:58 -07:00
Dan Willemsen
58a5c8b206 Export cc_benchmark as NATIVE_TESTS to Make
This fixes some warnings on internal master where the compatibility
suite logic didn't look at EXECUTABLES (it was checking for
LOCAL_MODULE_CLASS == NATIVE_BENCHMARK, which doesn't exist).

Test: Compare out/soong/Android-aosp_arm64.mk
Test: Compare out/build-aosp_arm64.ninja
Change-Id: Ibe3c40e81e26f4c4cb9fd5bea1619b94181764fb
2017-05-23 15:55:12 -07:00
Colin Cross
8ff9ef4c30 Declare dependency on sanitizer runtime libraries
Moving the last users of a sanitizer runtime library to soong was
causing the runtime library to stop getting installed.  Declare
the dependency so make keeps installing it.

Test: builds
Change-Id: Ieeb9ad5c04ac8df0d1a74239da393dac5cab2b03
2017-05-08 15:57:05 -07:00
Colin Cross
e28f4e2acf Support test_suites in cc_benchmark modules
Bug: 35394669
Test: m -j checkbuild
Change-Id: I0b521d866edb1706669b8058dc128d389b5582da
2017-04-24 18:10:29 -07:00
Jayant Chowdhary
3e231fd8bd Add header-abi-checker for Vndk abi checks.
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
2017-04-14 19:48:10 -07:00
Dan Willemsen
4416e5db69 Split /system and /vendor modules, allow multi-installation
Nothing changes if BOARD_VNDK_VERSION isn't set.

When the VNDK is enabled (BOARD_VNDK_VERSION in Make), this will split
/system and /vendor modules into two different variant spaces that can't
link to each other. There are a few interfaces between the two variant
spaces:

The `llndk_library` stubs will be available in the /vendor variant, but
won't be installed, so at runtime the /system variant will be used.

Setting `vendor_available: true` will split a module into both variants.
The /system (or "core") variant will compile just like today. The
/vendor ("vendor") variant will compile against everything else in the
vendor space (so LL-NDK instead of libc/liblog/etc). There will be two
copies of these libraries installed onto the final device.

Since the available runtime interfaces for vendor modules may be
reduced, and your dependencies may not expose their private interfaces,
we allow the vendor variants to reduce their compilation set, and export
a different set of headers:

  cc_library {
      name: "libfoo",
      srcs: ["common.cpp", "private_impl.cpp"],
      export_include_dirs: ["include"],
      target: {
          vendor: {
	      export_include_dirs: ["include_vndk"],
	      exclude_srcs: ["private_impl.cpp"],
	      srcs: ["vendor_only.cpp"],
	  },
      },
  }

So the "core" variant would compile with both "common.cpp" and
"private_impl.cpp", and export "include".

The "vendor" variant would compile "common.cpp" and "vendor_only.cpp",
and export "include_vndk".

Bug: 36426473
Bug: 36079834
Test: out/soong/build.ninja, out/soong/Android- only changes due to _core addition and
      .llndk -> .vendor
Test: attempt to compile with BOARD_VNDK_VERSION:=current
Change-Id: Idef28764043bf6c33dc0d2e7e2026c38867ff769
2017-04-11 12:27:41 -07: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
Dan Willemsen
5853940a18 Pass exportedFlags directly to Make
Instead of using LOCAL_EXPORT_C_INCLUDE_DIRS, use LOCAL_EXPORT_CFLAGS.
This will let us pass -isystem (or potentially other cflags) in the
future. Also refactors the function to be on libraryDecorator instead of
a private lambda so that wrappers can use it.

Test: m -j
Merged-In: Id0dbde7dd03f4e1e1602f7958c445c86f5db15fe
Change-Id: Id0dbde7dd03f4e1e1602f7958c445c86f5db15fe
2017-04-05 03:36:10 +00:00
Dan Willemsen
866810db9f Exclude ndk stubs from notice file list
Set LOCAL_NO_NOTICE_FILE so that we don't list them in the third party
notices:

out/soong/ndk/platforms/android-10/arch-arm/usr/lib/libc.so
out/soong/ndk/platforms/android-10/arch-arm/usr/lib/liblog.so
...

These are just stub libraries, and aren't distributed on the device. The
real versions of these libraries will be distributed on the device, and
already have the license information.

Bug: 36867708
Test: Diff aosp_arm's system/etc/NOTICE.html.gz file before/after
Change-Id: Ib647c64e9ce55f700738b00d2ff685e784ed3801
2017-04-04 14:59:57 -07:00
Dan Shi
4df566d313 Correct variable name LOCAL_COMPATIBILITY_SUITE
Test: m -j checkbuild
Bug: 35394669
Change-Id: I117224b2266520e6aec44aef62551b0836a83520
2017-04-03 12:29:25 -07:00
Dan Willemsen
11b261472a Rework vndk detection
Instead of having a module define `use_vndk: true`, assume that we're
building with the VNDK if we're installed on the vendor partition, and
BOARD_VNDK_VERSION==current. This now matches our behavior in Make.

Once BOARD_VNDK_VERSION!=current, we'll need to disable modules that
need to otherwise compile against the VNDK, since we can only compile
against the current VNDK.

Test: build.ninja for aosp_arm is the same before/after
Test: Ensure there are no boards that set BOARD_VNDK_VERSION
Change-Id: If937fa7bdb119648137af52daebadf486163484b
2017-03-29 04:33:25 +00:00
Colin Cross
a929db05b3 Add support for test_suites property on cc_test modules
Add a test_suites property that is passed through to make as
LOCAL_COMPATIBILITY_SUITES.

Test: m -j checkbuild, examine out/soong/Android-${TARGET_PRODUCT}.mk
Bug: 35394669
Change-Id: If05b0f5f7d6dd85228546123bebe32859bcc8186
2017-03-27 16:27:50 -07:00
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
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
d5781347e0 Export cc_library_headers as BUILD_HEADER_LIBRARY
And support the reverse translation in androidmk.

Test: Use a cc_library_headers using LOCAL_HEADER_LIBRARIES in make
Test: androidmk with LOCAL_HEADER_LIBRARIES
Test: androidmk with soong's Android-*.mk file for BUILD_HEADER_LIBRARIES
Change-Id: I17adedb62151f62e67e2168b09ad87f1d5648df6
2017-02-16 10:58:26 -08:00
Colin Cross
4ac44809af Export header libraries to make as static libraries
Header libraries were building an empty .a file but setting
LOCAL_MODULE_CLASS := SHARED_LIBRARIES.  Make the static and shared
checks in libraryDecorator.AndroidMk explicit.

Bug: 35228396
Test: builds, examine out/soong/Android-${TARGET_PRODUCT}.mk
Change-Id: I5653ae92bb41d440d8c3ff4b6d509be188feb961
2017-02-15 23:26:15 +00: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
Nan Zhang
6d34b308ff Added phony module type for soong.
The "required" field within "phony" module in .bp file has to be
non-empty. And "phony" module doesn't contain any "src" files.
Bug: b/32981153
Test: make -j out/soong/build.ninja

Change-Id: Iaa2009467c44702572b97ca9cbd02c1d368c8d83
2017-02-06 22:23:19 -08:00
Colin Cross
faeb7aa135 Support data properties for test binaries
Allow tests to specify a data property that lists files or filegroup
modules that will be packaged alongside the test.  Also add a path
property to filegroup modules to allow shifting the path of the
packaged files, and add ExpandSourcesSubDir to expand the filegroup
sources while including a shifted relative path in the Paths objects.

Test: soong tests, manually adding data to a module
Change-Id: I52a48942660e12755d313ef13279313361b4fc35
2017-02-02 16:23:30 -08:00
Dan Willemsen
0fe7253718 Export cc_test as Make class NATIVE_TESTS
So that make can tell the difference.

Bug: 32177952
Test: Diff build-aosp_arm64.ninja before/after
Change-Id: Icd98ea5f5b4127bf84197c6b651a72708eec57f1
2017-01-17 13:25:49 -08:00
Colin Cross
9b09f248d8 Install symlinks with same suffix and extension as installed file
Move symlink installation into the binaryDecorator so that it can
access the suffix and extension when installing symlinks.  Also
consolidates the symlink and symlink_preferred_arch handling.

Test: m -j clang, ls -l out/host/windows-x86/bin/clang++.exe
Change-Id: I1204afb71fac87b276bd6b625b52ee21274855a0
2016-12-07 17:35:37 -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
Dan Albert
fd86e9ee21 Generate "current" API level.
Support for using this coming in an upcoming patch.

Test: nose2
      readelf to check the following:
      * bsd_signal unversioned before current
      * bsd_signal versioned in current
      * catclose missing before current
      * catclose present and versioned in current
Bug: None
Change-Id: I861862161426d3ec5b530e3156d3a8ae96fed468
2016-11-10 13:49:26 -08: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
03ce63eaa6 Trigger binary installation in Soong from Make
We prepended Soong's binary installation path to PATH, but now
rebuilding binaries that are in Soong and exported to Make produces
inconsistent results. From an empty out directory:

Run `m -j hidl-gen`, PATH will get a hidl-gen binary in out/host/...
Run `m -j android.hardware.tests.foo@1.0`, PATH will get a new hidl-gen
binary in out/soong/host/...
Make a change to hidl-gen, then run `m -j hidl-gen`. The hidl-gen first
in PATH is still the one without the changes.

Bug: 31742855
Test: m -j hidl-gen showcommands
Change-Id: If01a76d10d786dac6f16f31d1142634af4964228
2016-09-29 13:56:02 -07:00
Dan Willemsen
394e9dc876 Add Relocation Packer support
This only applies to shared libraries on the device, and like stripping,
we'll let make do the actual packing if we're embedded in Make.

Change-Id: I1585d74ecfc41e18dcbb5ffb70005adf007cc941
2016-09-15 03:39:05 +00:00
Dan Willemsen
391cdde1da Remove extra LOCAL_CXX_STL := none
This was always being set in cc.Module.AndroidMk(), so we don't need to
declare it again. This was causing problems for cc_binary modules that
were using the NDK, since LOCAL_NDK_STL_VARIANT must be used instead.

Test: Manually put ifneq ($(LOCAL_CXX_STL),none); $(error) checks
Change-Id: If937b7b5ad30936e08c99f62ccf83b78d196dbfe
2016-09-14 16:12:29 -07:00
Dan Willemsen
1d577e25a7 Expose module suffixes to Make
These had only been exposed for shared libraries.

Also fixes testDecorator to not have two baseInstallers both being
written out to the Android.mk.

Bug: 31158868
Test: manual diff of out/soong/Android-aosp_flounder.mk
Test: Verify installed windows binaries end in .exe
Change-Id: I2bded5fb090117d48ade575b4438e0dedd2e3763
2016-08-29 16:02:05 -07:00
Colin Cross
1e7d3706d6 Add support for preferred arch symlinks
Add a symlink_preferred_arch property to binaries to allow compiling the
binary for multiple architectures and then creating a symlink to the
preferred archicture, for example dalvikvm32 and dalvikvm64, with
dalvikvm symlinked to dalvikvm64.

Test: mmma -j art/dalvikvm
Change-Id: Ied15f2be9d52c01006fe8ac207c175b78558eab1
2016-08-25 22:42:02 +00:00
Dan Albert
cdd4c24ff7 More fixes for decorator refactor.
Didn't catch these the first time because I hadn't done a clean build.

Test: rm -rf out && make ndk
Change-Id: Ia66ad614d2163272889ee6937a6449c44db16ac0
2016-08-08 14:45:24 -07:00
Dan Albert
705c84b9ee Fix ndk_library following decorator refactor.
https://android-review.googlesource.com/#/c/253603/ accidentally
dropped the ndk_library properties and was using the base cc
properties instead.

Change-Id: Ia2dcd767f98871dbdbbd9d0ff6d2a73b9b4889ac
2016-08-08 12:44:23 -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
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
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
Dan Albert
6a0476930a Remove the implicit "_" in subnames.
The NDK stub libraries need to use subname, but should use "." instead
of "_".

Test: Still builds.
Change-Id: Ib4b0303531e03968c55671ea167ab987adebd783
2016-07-18 23:31:18 -07:00
Colin Cross
3854a60c55 Add symlink installation support
Allow modules to specify a list of names to create alias symlinks, and
pass the list to make so it can create them.  Also pass
LOCAL_FORCE_STATIC_EXECUTABLE for static binaries so that make can avoid
a linker_asan -> linker -> linker_asan dependency loop.

Change-Id: I314d088095ac5f43641ed2cf8247c14c27e23b93
2016-07-15 13:37:03 -07:00
Dan Willemsen
f2c27d7370 Export the default LOCAL_STRIP_MODULE value
In make, BUILD_PREBUILT and BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE use
different defaults for LOCAL_STRIP_MODULE. Explicitly use the
BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE default so that we'll strip
binaries the same way when converting from Make to Soong.

BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE uses the default set in
dynamic_binary.mk: mini-debug-info.

BUILD_PREBUILT (SHARED_LIBRARIES) uses no_debuglink
BUILD_PREBUILT (EXECUTABLES) doesn't strip by default

None of the above support stripping host modules.

Change-Id: I73a6f7bd7d2ed2033936579c78ae4980386dd4a2
2016-07-13 17:33:49 -07:00
Colin Cross
c7a38dc00c Add support for test libraries
Add cc_test_library, which is a combination of a cc_test and a static
library.  Requires adding a libraryInterface to identify libraries that
are embedded in other types.

Change-Id: I2f0dcccb2f7243409210547562d2b41c3fbce44e
2016-07-12 13:13:09 -07:00
Dan Willemsen
72d3993c9b Stop exporting NDK prebuilt modules to Make
Make isn't going to use any of these anytime soon. So hide them from
make for now, and be sure to save the AndroidMk shared library
dependencies before we convert them to NDK dependencies.

And $(ACP) is no longer used by $(copy-file-to-target)

Change-Id: I8f8f7d0177d31ba4206c0bc1f2ff952dce53b6b4
2016-07-08 23:41:36 -07:00
Colin Cross
7b5c22b1f0 Don't specify LOCAL_STRIP_MODULE for static libraries
After I92a838b07fe4116d5a4b8521fe1ce8d44e6e84e2 in build/,
LOCAL_STRIP_MODULE := keep_symbols will be honored for prebuilts, which
will trigger an error if it is set on a static library.  Only set
LOCAL_STRIP_MODULE for binaries and shared libraries.

Change-Id: I4e17a78afa7c5810dbf9003166c14a1ff3a59c9e
2016-07-07 11:21:53 -07:00
Dan Willemsen
7517ed0b46 Export strip information to Make
Change-Id: I3c69451a505ac2b97f3112050acc4b64b1cd7394
2016-06-10 17:20:30 -07:00
Dan Willemsen
a96ff64527 Check NDK linking, expose SDK_VERSION to Make
Modules defining sdk_version should only be allowed to link against the
ndk prebuilt libraries and other modules defining sdk_version. Implement
this, and expose the necessary information to Make so that it can be
implemented there as well.

Change-Id: I051498b595f8711883bc120f0394b8bfe2f65bce
2016-06-07 21:52:12 -07:00
Colin Cross
bc6fb16b26 Support sanitizer variants inside make builds
Create both sanitized and unsanitized variants inside make builds with
sanitizers enabled.  Only export the sanitized version to make, and
always install the sanitized version in /data to match the make build.

Change-Id: I5a17bcbddc7a9d871c929c84d3c116228ef3258f
2016-05-24 17:14:15 -07:00
Colin Cross
635c3b0157 Rename common to android
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
2016-05-18 15:37:25 -07:00
Dan Willemsen
e7932e890b Properly export toolchain static libs
Change-Id: I7fd5308469aee5a43d576d1a72f7738dc6f9fbaa
2016-05-16 15:56:53 -07:00
Dan Willemsen
3b1fffa33b Fix Android.mk LOCAL_EXPORT_C_INCLUDE_DIRS generation
We were keeping the original array, and adding duplicates with -I
removed. Instead, only add entries that start with -I, but continue
stripping that off. This removes the -isystem arguments from the NDK
libraries.

Change-Id: I8fd71bbd6b7a051aad7e80a92a05dbdc05a6b87a
2016-05-05 15:11:48 -07:00
Colin Cross
30d5f514dd Support sanitizer builds inside make
Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.

Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
2016-05-03 18:02:42 -07:00
Colin Cross
e14388b9de Remove trailing / from install path
Prevents make installing files with a double /:
Install: out/target/product/generic_arm64/system/lib//libc.so

Change-Id: Iee237f344e8140c4938aa9d1e6940e4fdbfa7cd8
2016-05-03 14:53:18 -07:00
Colin Cross
c99deeb961 Use blueprint DependencyTags
Blueprint now requres DependencyTags to be passed to AddDependency
calls.  Use the tags to avoid setting member variables on modules, which
will be lost after the mutators have been called.

Change-Id: I8c1d9ed1db85a300e14394b911a516d361ba9f75
2016-04-12 15:24:02 -07:00
Colin Cross
bf305dea81 Remove extension from LOCAL_MODULE_STEM
LOCAL_MODULE_STEM adds the expected extension to the installation path,
remove the extension from the filename.

Change-Id: I54dbcfa73d8d07fc3630caf2d582160003e28f79
2016-03-29 17:32:06 -07:00
Colin Cross
a23446680f Use correct install paths in generated Android.mk
Extract Soong's install path and put it in the generated Android.mk file
so that tests get installed in the correct place.

Change-Id: Id4726855c5677855406de20773a5da533bdd4cea
2016-03-24 13:14:12 -07:00
Colin Cross
ca860ac720 Refactor cc
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
2016-03-21 17:31:04 -07:00
Dan Willemsen
97750520a4 Refactor Android.mk generation
Now, instead of combining multiple binaries into a single BUILD_PREBUILT
definition, use separate instances for every module variant. This fixes
HOST vs HOST_CROSS prebuilts, and should be saner overall. From make,
these should look the same, we're only just using one instance of
prebuilt_internal per BUILD_PREBUILT call instead of multiple.

With that simplification, we don't have to store as much state, and can
directly write into the buffer.

Also switch from io.WriteString to fmt.Fprintln, which will require
fewer explicit string concatentations, and we don't need to worry about
newlines.

Allow the module-provided functions to return errors.

Change-Id: If30453b21fa21387f635626618d8fabfc78e6859
2016-02-09 19:56:22 -08:00
Dan Willemsen
34cc69e4bf Use Path instead of string for file paths
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
2015-12-09 14:29:12 -08:00
Dan Willemsen
218f65628e Hybrid soong/mk build using prebuilts
Change-Id: I96daa69af27bd19c8bfbe327a1318f51c738fc03
2015-12-01 15:08:01 -08:00