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
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
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
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
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
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
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
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
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
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
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
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
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
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
So that make can tell the difference.
Bug: 32177952
Test: Diff build-aosp_arm64.ninja before/after
Change-Id: Icd98ea5f5b4127bf84197c6b651a72708eec57f1
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
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
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
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
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
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
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
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
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
Didn't catch these the first time because I hadn't done a clean build.
Test: rm -rf out && make ndk
Change-Id: Ia66ad614d2163272889ee6937a6449c44db16ac0
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
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
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
The NDK stub libraries need to use subname, but should use "." instead
of "_".
Test: Still builds.
Change-Id: Ib4b0303531e03968c55671ea167ab987adebd783
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
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
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
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
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
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
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
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
Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.
Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
Prevents make installing files with a double /:
Install: out/target/product/generic_arm64/system/lib//libc.so
Change-Id: Iee237f344e8140c4938aa9d1e6940e4fdbfa7cd8
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
LOCAL_MODULE_STEM adds the expected extension to the installation path,
remove the extension from the filename.
Change-Id: I54dbcfa73d8d07fc3630caf2d582160003e28f79
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
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
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
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