Native bridge modules never need to build against NDK stubs, so
don't create SDK variants. Also clear the sdk_version property
for modules that don't have SDK variants so that later code doesn't
use it to trigger SDK behaviors.
Test: m checkbuild
Change-Id: I1920fa82e9fab06235f01a62624382efa16cc6e3
Storing ndkKnownLibs prevents multiple tests from running in parallel
as one may be writing to the list while another is reading from it.
Store it in the config so each test has its own copy.
Test: go test -race ./apex
Change-Id: Iba57c9494012c9e0ae9e5ffaa63b9b2bd2c77492
The stubs methods are very specific to cc for now, move them out
of LinkableInterface so they are not shared with rust. Instead,
create a cc.Module.library field that contains the libraryInterface
to simplify calling libraryInterface methods on cc modules.
Test: all Soong tests
Test: no change to Soong outputs
Change-Id: I0289d866ce1f7a765631fe3101a62b1b4988ba1c
Prepare for making the relationship between an llndk_library stubs
module and the cc_library implementation module explicit by
adding an llndk_stubs property. Each cc_library will be updated
to point to its llndk_library, and the llndk_library name will
be changed to make the .llndk suffix explicit. Then the implicit
connection and suffix can be removed.
Bug: 170784825
Test: m checkbuild
Change-Id: I6b0482a3f286ec29b2e928551aa4317749f2b499
Implement stubsVersions on *llndkStubDecorator and *stubDecorator to
handle the special cases in versionSelectorMutator.
Test: m checkbuild
Change-Id: Idc985c52f91450df42c0275b2b2acef3f2ed8868
Move the CRT objects into the version mutator and retire the
ndk_api mutator.
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: Ibbbde323e3e0e8e4702dda4f3828a49786280118
The ndk_api mutator is similar to the version mutator. Move the
ndk_library ndk_api variations into the version mutator instead,
which will help later when consolidating the stubs handling
between NDK, LLDNK and Apex libraries.
Test: No change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: I51417cf669265762c15f7289e1dc186d017ef4a9
Keeping the int constant around for now as FutureApiLevelInt because
it's still useful in places that haven't adopted ApiLevel yet for
testing if their non-ApiLevel API level is current or not.
Test: treehugger
Bug: http://b/154667674
Change-Id: I47a7012703f41fdeb56f91edf9c83afa93042deb
Handling of API levels within Soong is currently fairly difficult
since it isn't always clear based on context what kind of API level a
given string represents, how much canonicalizing and error checking
the code receiving the string are expected to do, or how those errors
should be treated.
The API level struct does not export its raw data, so as to keep its
"constructor" private to the android package, and to prevent misuse of
the `number` field, which is only an implementation detail for preview
API levels. API levels can be parsed with either
`android.ApiLevelFromUser`, which returns any errors to the caller, or
`android.ApiLevelOrPanic`, which is used in the case where the input
is trusted and any errors in parsing should panic. Even within the
`android` package, these APIs should be preferred over direct
construction.
For cases where there are context specific parsing requirements, such
as handling the "minimum" alias in the cc module,
`nativeApiLevelFromUser` and `nativeApiLevelOrPanic` should be used
instead.
Test: treehugger
Bug: http://b/154667674
Change-Id: Id52921fda32cb437fb1775ac2183299dedc0cf20
The cc stripping logic can be reused for Rust. Export the Stripper
structure for that purpose. Extract the strip-related flags from
builderFlags into StripFlags. Add the method flagsToStripFlags
(similarly to flagsToBuilderFlags).
Add the helper method disableStripping on libraryDecorator.
Test: m
Bug: 153430439
Change-Id: I11aef1abb8d498a4c1672500a7398279edf7f548
We don't need the prebuilt versions. The NDK CRT objects are (now)
built from the platform sources and the only difference is that the
NDK CRT objects also include an ELF note that identifies the NDK
version, which isn't helpful for anything built by the platform.
Add a `crt` property to cc_object that allows CRT objects to identify
themselves. CRT objects, unlike other modules, will have a variant
built per-API level they support, rather than just an SDK variant and
a platform variant. This is needed because new CRT objects will rely
on APIs not available in old libcs and old CRT objects will not
support all the features of a modern one.
Test: treehugger
Bug: http://b/159925977
Change-Id: I6595485fa1bfe0ad4945193d344b863f64eec654
Imports weren't working in tests because the package had been created.
The Python "binaries" built by Soong don't seem to take their own
pkg_path into account, so I split the separate pieces of code here out
into their own packages.
Note that the ndk_api_coverage_parser tests do not actually pass
before or after this change (seems like it might be a
non-deterministic ordering issue in the attributes of the generated
output?), but they can at least be run now.
Test: pytest ndkstubgen
Test: pytest symbolfile
Test: pytest ndk_api_coverage_parser
Test: out/host/linux-x86/nativetest64/test_ndkstubgen/test_ndkstubgen
Test: out/host/linux-x86/nativetest64/test_symbolfile/test_symbolfile
Test: out/host/linux-x86/nativetest64/test_ndk_api_coverage_parser/test_ndk_api_coverage_parser
Bug: None
Change-Id: I2ac22f7ced7566e4808070f2f72fd04355846e0b
This doesn't need to be manually maintained. It briefly did need to be
during the transition from the old prebuilts, but that's long gone.
Test: treehugger
Bug: http://b/113547923
Change-Id: If05633f3cf622ab39e560a3dfcc88f3eb50406bf
Add missing dependency for file 'api_levels.json' in rule
'parseNdkApiRule'
Forest test build link: http://shortn/_iCbktdkPsT
Test: m ndk
Change-Id: I9bcd3f8d261e40b6033ec82c4a50971ccb8b45b1
Enable ndk_library processing for api code coverage. All parsed generated xml files will be dist and later upload to artifacts.
Test: m ndk
Change-Id: I76ac52f60d5bbb106308658cf7417b845af9a49e
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.
Bug: 152655956
Test: m
Merged-In: I077ad7b2ac5d90b4c8708921e43846206f05ba70
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
(cherry picked from commit 29e91d2121)
Revert submission 1242911-sdk_version_variant
Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...
Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
Compiling native modules against the NDK disables platform features
like ASAN. For anything shipped on the system image there is no
reason to compile against the NDK. Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant. The
SDK variant will be used for embedding in APKs that may be installed
on older platforms. Apexes use their own variants that enforce
backwards compatibility.
Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
This reverts commit 862eb4648a.
Re-upgrades the compiler to clang-r370808, after first dealing with
regressions in ndk_translate and execute only pages.
Bug: 139945549
Bug: 145807809
Bug: 145827049
Bug: 145825270
Test: atest \
CtsSelinuxTargetSdk27TestCases:android.security.SELinuxTargetSdkTest#testNoExecuteOnly
Test: m ndk_translation_host_unit_tests && \
./out/host/linux-x86/nativetest/ndk_translation_host_unit_tests/ndk_translation_host_unit_tests
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I714b582faffa8c92384818a7b12338d621968548
Because aidl_interface depends on some ndk modules, their factories are
exposed so that aidl_test.go can use them.
Bug: n/a
Test: m
Change-Id: I98d282cc77310d5896a7abaf3936456a14d56ccf
-Wc99-designators warns for the use of nested and array initializers in
C++20 code. Many internal projects have pushed back against this
warning.
Disables:
- -Wimplicit-int-float-conversion
- -Wpointer-compare
- -Wxor-used-as-pow
- -Wfinal-dtor-non-final-class
- -Wreorder-init-list
For projects under external/, vendor/, etc, but only if they use
Android.bp (not Android.mk) and -Wreorder-init-list may be re-enabled by
-Wall if set locally.
-Wno-incomplete-setjmp-declaration is needed for NDK stubs that get
generated (functions without full definitions of their parameters).
Sets
- -Wno-error=implicit-int-float-conversion
- -Wno-error=reorder-init-list
for all projects in order to unblock landing the compiler upgrade due to
internal projects not being able to disable or fix these before the
upgrade.
Bug: 139945549
Test: build (aosp_crosshatch, crosshatch, aosp_x86_64-eng,
walleye), boot internal devices, bionic + RS atests, kernel builds.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I18e3c0eb657fd59824526f36c6dd57bdcf0526ba
Fixing the bug that -fvisibility=hidden in a cc_library is used even
when compiling stub.c file where the symbols shouldn't be hidden.
Bug: 144781653
Test: add folowing to libEGL and build
+ stubs: {
+ symbol_file: "libEGL.map.txt",
+ versions: ["29"],
+ },
Change-Id: Iab70f36a4fb98737fc35827dbc9e1ca1a99d4354
Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags
This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags. A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs
We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them. This CL prepares to reorder them
by splitting the global and local cflags into separate variables.
Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
This isn't an effective issue with local builds currently, since the
version script is generated from the same rule as the sources used to
compile the objects that are also used in the link command. But if we
ever separated those paths or adopted restat, we could miss this
dependency.
This is also required for my RBE build to actually expose this file to
the link step.
Test: treehugger
Change-Id: I32bbb18cf7edddc88759d4f445d081868f3e9b44
blueprint.BaseModuleContext is the set of methods available to all
module-specific calls (GenerateBuildActions or mutators). The
android package split the same functionality across baseContext (nee
androidBaseContext), BaseModuleContext, and BaseContext.
Consolidate all of them into android.BaseModuleContext.
Test: m checkbuild
Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
The ndk_library, ndk_prebuilt_object and ndk_prebuilt_static_stl
modules are natural targets to have native bridge support enabled,
since they build user facing object which have to be supported for
translated architectures.
Bug: http://b/77159578
Test: make
Change-Id: Ic556f4c1c41e5b3dc92f9c290b4482dee8faed33
Added synopsis to the following modules under cc package:
* ndk_headers
* ndk_library
* versioned_ndk_headers
* preprocessed_ndk_headers
Bug: b/128337482
Test: Generated the documentation and verified that the synopsis was
added to each of the module.
Change-Id: I2146919528cf039ed9327b3358de5b1bdb28275a
Bug: http://b/128524141
Include libprofile-extras (defined in system/extras/toolchain-extras) to
all modules that need a coverage variant. Also add
'-uinit_profile_extras' when linking with coverage. This causes the
setup code in libprofile-extras to be linked into binaries/libraries
with coverage enabled.
We add the static library to the non-coverage variants as well but is a
no-op for them (since the '-u...' flag is not added for them).
Adding this dependency creates several circular dependencies since
coverage variants were being created for other module types that never
had any compilation or linking done during the build. This change stops
creating coverage variants for toolchain_library, cc_prebuilt_library_*,
cc_library_headers module types (by adding a function to the linker
interface to specify whether native coverage is enabled).
Test: m NATIVE_COVERAGE=true COVERAGE_PATHS=*
Test: blueline_coverage target in internal branch (using forrest)
Change-Id: I5db876eb953639a55ba007248dd24e497f987730
Apparently this isn't autogenerated based on the list of ndk_library
modules?
Fixes: 124019854
Test: try to use libsync from a cc_library with sdk_version: "current"
Change-Id: I5016e1b7d77ed9255bf4b185c168efe8d0b73d12
Now, symbols that are only to be visible to across APEXes can be tagged
as # vndk. Then when generating the stubs library, the tagged symbol
is included. The symbol is NOT included in other cases; build NDK stubs,
etc.
Bug: 120638081
Test: m (apex_test updated.)
Change-Id: Idb2b552badddfc26af113cc8d4b984788f478813
Draft APIs are available to the platform and to CTS to allow
developers to iterate on an API, but hidden from the NDK artifacts to
avoid releasing the API until it is ready.
Test: Mark binder_ndk headers and library as drafts, make checkbuild,
build-ndk-prebuilts.sh, verify missing from NDK artifact.
Bug: http://b/120091134
Change-Id: I8685e92bdaaea581e17fe98e7a2bfb9388f9f132
JNI testing will need to create basic native shared library
modules, export the minimum mutators and module types for
the required dependencies of a native shared library.
Bug: 80095087
Test: cc_test.go
Change-Id: Ibe7bc88b69cb0851291cb09a4c0c6cdb421b8651
This reverts commit e67144e302.
Keep the getApiLevelsMap function and keep using it in
shouldUseVersionScript. It seems useful. (Also, keeping it probably avoids
an AOSP->internal merge conflict...)
Bug: https://github.com/android-ndk/ndk/issues/750
Test: m out/soong/ndk.timestamp, examine dynsym in stubs
Change-Id: Icbb26fc46a9a1dc99f22af195468f08713c4f216
Test: make ndk # readelf various stubs to check version info
Bug: https://github.com/android-ndk/ndk/issues/622
Merged-In: Ic2930cfe5ee8377bb89bfb1bc051b6975f6e57d3
Change-Id: Ic2930cfe5ee8377bb89bfb1bc051b6975f6e57d3
Bug: http://b/70820751
Bug: http://b/70857959
Clang does not output file dependencies from the -fprofile-use= flag
during -MD/-MM. Add this and other path dependencies as implicit Ninja
dependencies. Generated header dependencies are retained as OrderOnly
dependencies.
Test: Perturb profdata files for hwui/skia in internal branch and verify
that the sources get rebuilt.
Change-Id: I3247d995ee27a4882172eb15ff36acf56536b6f7
AConfig() now duplicates Config(). Replace the uses of AConfig()
with Config(). Leave AConfig() for now until code in other
projects is cleaned up.
Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
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
* When -Wno-error and -Werror are not used:
add -Wall to the front of cflags
if the project is in the WarningAllowedProjects,
otherwise add -Wall -Werror.
* Add -Wall -Werror to ndk_library build targets.
* Collect names of modules with -Wno-error or without -Werror,
and pass them to makefile variables:
SOONG_MODULES_USING_WNO_ERROR
SOONG_MODULES_ADDED_WERROR
SOONG_MODULES_ADDED_WALL
* Generate ANDROID_WARNING_ALLOWED_PROJECTS for old makefiles.
Bug: 66996870
Test: normal build
Change-Id: I31385e12b80ca946c7395a5a184ef259b029aac6
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