Commit graph

27 commits

Author SHA1 Message Date
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
Pirama Arumuga Nainar
955dc4999e Fix few issues with filegroups
Bug: http://b/64121881
Bug: http://b/78188880

- Allow filegroup's properties to be extended by a LoadHook
- Support a filegroup (':module') in a prebuilt's 'Srcs' property to
export files from a different path as the prebuilt's sources.

This change also includes a refactoring that moves genrule/filegroup.go
to android/filegroup.go so that FileGroupFactory is visible in
prebuilt_test.go.

Test: Test
https://android-review.googlesource.com/c/platform/development/+/469159
in clang-tools branch on Linux, Darwin.  Test regular build in
aosp/master.

Change-Id: I3ff6215ab2e62955f039fd1086c31f1bd50ebcf6
2018-04-18 18:56:33 +00:00
Dan Willemsen
674dc7f7f0 Expose ProductVariables from TestConfig
In preparation for unexporting ProductVariables, explicitly return a
pointer to the structure from TestConfig / TestArchConfig.

Bug: 76168832
Test: m blueprint_tools
Change-Id: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
2018-04-11 01:45:22 +00:00
Logan Chien
d3c59a2b3a Allow VNDK-SP extensions to use vendor lib
This commit changes the VNDK-SP dependencies check.  With the commit,
VNDK-SP-Ext can link to non-VNDK vendor shared libs.  This commit also
refines the "cc_test" so that more error handling cases are properly
tested.

Before this commit, VNDK-SP-Ext could not depend on vendor libs.  It
was disallowed because there were no correct way to load vendor libs.
The fallback link had to specify the shared lib names.  On the other
hand, adding "/vendor/${LIB}" to search paths will lead to
double-loading issue.

In aosp/595067, "allow_all_shared_libs" was added to bionic dynamic
linker.  Now, we can link the "vndk" namespace to "sphal" namespace.
Thus, like VNDK-Ext, VNDK-SP-Ext can link to vendor libs now.

Bug: 77249955
Test: lunch aosp_walleye-userdebug && make -j8  # runs unit tests
Test: lunch aosp_sailfish-userdebug && make -j8  # runs unit tests
Test: Create a VNDK-SP-Ext, link to vendor libs, and run it.
Change-Id: I5511204539a22c998528111076f46756807faf29
2018-03-30 11:46:26 +08: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
Colin Cross
f46e37f5f7 Fix format string issues
Fix issues caught by go vet.

Test: m checkbuild
Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084
2018-03-28 15:54:52 -07:00
Logan Chien
ee97c3ed75 Add unit tests for android/neverallow.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: Ibde685d7213713be219681cb039ad58a43d9c377
2018-03-15 11:02:38 +08:00
Logan Chien
4203971351 Extract failIfErrored() to android/testing.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
2018-03-15 11:02:38 +08:00
Logan Chien
f351174107 Support VNDK extensions
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions.  This is the simplest example:

```
cc_library {
    name: "libvndk",
    vendor_available: true,
    vndk {
        enabled: true,
    },
}

cc_library {
    name: "libvndk_ext",
    vendor: true,
    vndk: {
        enabled: true,
        extends: "libvndk",
    },
}
```

A vndk extension library must extend an existing vndk library which has
`vendor_available: true`.  These two libraries must have the same
`support_system_process` property.

VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.

If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.

Bug: 38340960

Test: lunch aosp_walleye-userdebug && make -j8   # runs unit tests

Test: lunch aosp_arm-userdebug && make -j8  # build a target w/o VNDK

Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.

Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.

Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.

Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
2018-01-23 01:40:54 +00:00
Colin Cross
95d33fe631 Fix crash on test failure
Don't check objs[0] and objs[1] if len(objs) != 2.

Test: cc_test.go
Change-Id: I2ba459a683764691ebf28db3944d7a1e9088eb76
2018-01-03 16:03:06 -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
Jeff Gaston
f5b6e8f8c7 Have Soong cc static linker dep order account for shared deps too
Bug: b/69639803
Test: m -j nothing # which runs unit tests
Test: m -j checkbuild
Change-Id: I2eedfe8b88ec5c715ef729bf113d168a2bc3524d
2017-11-27 17:14:06 -08:00
Colin Cross
d00350c61b Add license headers to all go and shell files
Test: none
Change-Id: I75c443e05f2b1e17fcb6823182717d2e6f5df7c4
2017-11-17 23:05:26 +00: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
Colin Cross
ad59e75a56 Add cc_library tests
Add tests around reusing objects between static and shared
libraries.

Test: library_test.go
Change-Id: I1a1a01c5ea9f9edfbcaa5b29c39c281630e04f70
2017-11-17 11:22:04 -08:00
Jeff Gaston
d3e141de80 Pass results of Finder into Blueprint
Bug: 64363847
Test: m -j

Change-Id: I79db8c524af6e77c35a0199ec1876e5eb94e8971
2017-11-08 23:48:44 +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
Steven Moreland
f9e621603b Export cc library factories.
Previously not useful, they are required to use CreateModule
to create additional libraries.

Bug: 35570956
Test: manual :)

Change-Id: Ibb6b1c0d365512fce8969e1e6237ebbed0bc9cdc
2017-11-03 00:05:54 +00:00
Colin Cross
b671544973 Move first/last unique elements utility functions to android package
Move firstUniqueElements to android.FirstUniqueStrings,
lastUniqueElements to android.LastUniqueStrings, and lastUniquePaths
to android.LastUniquePaths.

Test: m checkbuild
Change-Id: Ieac840405126c7f8f98afb4a4ef35c01a18fe7fb
2017-10-24 12:12:32 -07:00
Jiyong Park
d08b697828 Allow macro definition with space
cflags: ["-DMACRO=\" definition \""] should not be rejected.

Bug: 66914194
Test: TestCompilerFlags in cc_test.go

Change-Id: I7f96505a83898616415ef1fb7e13596b56a063f3
2017-10-19 22:39:32 +09:00
Jeff Gaston
294356f045 Automatically reorder C/C++ link dependencies in Soong
This uses knowledge of transitive dependencies to reorder
linker command line arguments such that if module A depends
on module B, then module A is automatically listed before
module B in the linker command line.

This should mostly remove the need for Android.bp files to
list all of their static dependencies in link order

Bug: 66260943
Test: reorder the entries of static_libs in an Android.bp and see that linking still succeeds

Change-Id: I20f851ab9f2f30031254e4f30023b6140d15d6c3
2017-10-18 14:30:05 -07:00
Jiyong Park
6a43f04777 Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.

However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume

cc_library {
    name: "libfoo",
    srcs: ["foo.c"],
    target: {
        vendor: {
            srcs: ["bar.c"],
        },
    },
}

Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o

So, bar.o is included twice and this causes multiple symbol definition
error.

In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.

Bug: 67731122
Test: build
Test: cc_test.go

Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-13 14:36:12 +09:00
Colin Cross
dd84e056ed Dedup exported flags from dependencies
Soong command lines have gotten very long due to hidl modules
reexporting lots of libraries.  Dedup the include dir flags.

Test: m -j checkbuild
Change-Id: I6ada1251012da42344e2c00ae66001a649023d2c
2017-05-17 14:22:22 -07:00
Colin Cross
5b52959c99 Use ctx.ModuleBuild for darwin ar
Test: builds
Change-Id: If90975c8545158012bc6201acadd136363c21260
2017-05-09 14:32:45 -07:00
Colin Cross
0af4b8468b Add support for building on Darwin hosts
Add toolchain and build rules for building on Darwin.

Change-Id: I78e21f4051b2941182121b28c9ddfa24396ada41
2015-05-07 14:09:48 -07:00
Colin Cross
74d1ec0c2c Build rule updates for aosp
Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)

Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
2015-05-04 17:02:18 -07:00