Commit graph

49 commits

Author SHA1 Message Date
Dan Willemsen
62b9cf952c Update NDK library list
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
2019-02-06 18:41:27 -08:00
Jiyong Park
3fd0baf651 When a stub is built for APEX, it is generated with --apex
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
2018-12-16 02:13:14 +09:00
Dan Albert
23d37e09e9 Allow NDK APIs to be marked as drafts.
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
2018-11-28 09:52:12 -08:00
Colin Cross
e40b4eaeb0 Export cc module types and mutators needed for JNI testing
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
2018-10-08 15:20:56 -07:00
Steven Moreland
fa287846ea Add libbinder_ndk to the NDK.
Bug: 111445392
Test: atest android.binder.cts.NdkBinderTest
Change-Id: If7e25f6e856524c531c41dacf3e7f798f42cc7a5
2018-08-29 21:45:51 -07:00
Ryan Prichard
37ebbdee6c Revert part of "Stop versioning NDK stubs pre-M."
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
2018-07-24 12:46:35 -07:00
Dan Albert
e67144e302 Stop versioning NDK stubs pre-M.
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
2018-07-17 23:26:00 +00:00
Pirama Arumuga Nainar
70ba5a38d1 Add compile-time pathDeps as implicit dependencies
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
2017-12-19 15:44:38 -08:00
Colin Cross
6510f91a1c Replace ModuleContext.AConfig() with Config()
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
2017-11-30 00:44:18 +00: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
Chih-Hung Hsieh
64a38dcb18 Add default -Wall -Werror or -Wall.
* 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
2017-11-20 18:28:26 -08: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
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
Colin Cross
ae88703df5 Move ModuleContext.ModuleBuild to ModuleContext.Build
Now that android.ModuleContext does not include blueprint.ModuleContext
we can rename android.ModuleContext.ModuleBuild to
android.ModuleContext.Build without colliding with
blueprint.ModuleContext.Build.  Leave ModuleBuild as a wrapper around
Build for now to avoid having to update all the users outside
build/soong simultaneously.

Test: m checkbuild
Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
2017-10-24 10:59:00 -07:00
Colin Cross
5c51792926 Make binaries executable
Split InstallFileName into InstallExecutable that does chmod +x
after copying the file.  Also remove InstallFile and rename
InstallFileName to InstallFile.

Test: m -j checkbuild
Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
2017-08-31 13:48:52 -07:00
Dan Albert
f5415d7cc6 Expose the minimum supported SDK version to make.
Right now this is hard coded in two places (here and in
core/binary.mk). Keep it in one place so it's easier to change.

Test: make checkbuild
Bug: None
Change-Id: I2a2c784d4c667b326f871e6144db92753c16c85f
2017-08-17 16:54:03 -07:00
Dan Albert
31384debd7 Adapt to PLATFORM_VERSION_FUTURE_CODENAMES.
Don't preserve the confusing names from make. Rename AllCodenames to
ActiveCodenames, add FutureCodenames, and add CombinedCodenames to
fetch the *real* AllCodenames.

To allow `introduced=P` in NDK library definitions, we need to know
that P exists. Use the combined list of current and future API
codenames generating stubs.

Test: make ndk
Test: check out/soong/api_levels.json
Bug: None
Change-Id: I435f9ce7446236edc268a84e33474044a55a6302
2017-08-02 17:14:10 -07:00
George Burgess IV
f5310e3f88 Add to cflags in compilerFlags()
These compiler flags weren't being properly added to ToolingCFlags,
which was causing clang-tidy to complain a lot about incompatible
redeclarations of library functions. Moving them to compilerFlags()
causes them to be added to ToolingCFlags.

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

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

Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
2017-06-30 21:08:36 +00:00
Dan Albert
15be0c6a36 Require that NDK symbol files end with .map.txt.
We're making an NDK API Council +1 a requirment for changes to these
files, so we need to know that all symbol files will match a given
file pattern.

Test: Changed a symbol file to foo.txt, `make ndk` failed
Test: make ndk
Bug: http://b/35870541
Change-Id: I29690fb97746ad682e57845fea3f1114cfd77598
2017-06-13 15:14:56 -07:00
Colin Cross
67a5c132c5 Prettify soong ninja build descriptions
Descriptions currently look like:
[  0% 4/29328] cc out-soong/.intermediates/external/clang/lib/Sema/libclangSema/android_arm_armv7-a-neon_denver_static_core/obj/external/clang/lib/Sema/SemaCodeComplete.o

This is not very helpful - most of the characters are used to show the
output path, which contains useful information like target architecture,
but also contains most of the path to the source files twice, and less
useful information like the exact variant name used by soong.
Make the descriptions look like:
[  0% 3/29329] //external/clang/lib/Sema:libclangSema clang++ SemaTemplateInstantiate.cpp

This is //path/to/module:modulename tool relative/path/to/source/file

Test: builds, looks pretty
Change-Id: I3087aa7d4eb1860ef6239d77407b8b35445616d7
2017-05-10 11:04:16 -07:00
Dan Albert
49927d29d5 Generate stub libraries for unreleased API levels.
Generating released API levels and android-current is not sufficient
in a trunk-stable world. One branch will have the stable APIs and
possibly multiple unreleased API levels. We need to generate stubs
for each unreleased API level up to our current target.

I still need to add support for things like `# introduced=O` before
this is really done.

Whether or not we still need something like "current" that would map
to the absolute latest even it hasn't been assigned a code name yet
is uncertain.

Test: make ndk
Bug: None
Change-Id: I282be1347ab39c56fa887d4d71c03bb12c300dc5
2017-04-28 16:11:13 -07:00
Colin Cross
ce87b801ea Use ArchType instead of string as map key
There is no need to convert ArchType to a string, it can be used
as a map key directly.  It will also be implicity stringified when
passed as a %q parameter to fmt.Errorf.

Test: builds
Change-Id: I5c316fb543108cb88c0c9c1ebafc1bf0050d143e
2017-04-13 20:40:59 +00:00
Colin Cross
d4025826c3 Skip ndkApiMutator on disabled modules
Builds with no device architectures configured will disable all
device modules, don't run the mutator on them.  Avoids panics
in Config.PlatformSdkVersionInt() (because the sdk version is not
set in soong.variables) and in normalizeNdkApiLevel (no arch
mutator was run on the module so arch is "").

Bug: 37315968
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Iac124e00403eee9f2c1072788e2f51914b0112a5
2017-04-13 12:53:07 -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 Albert
2e5d7d41f4 Add sdk_version: "minimum".
This maps to the lowest supported API level for the given
architecture.

Test: make checkbuild # after setting some things to use this
Bug: None
Change-Id: Ied6d44cb2719b73f35dde38a2dca6d3c87c7c924
2017-03-31 16:19:51 -07:00
Colin Cross
a48ab5b207 Build a static library for header-only libraries
library.static() was being used to determine if a library was static,
shared, or header only, which resulted in header only libraries
behaving like shared libraries, when they should be treated as static
libraries with no sources.  Explicitly use library.static(),
library.shared(), and library.header() instead.

Bug: 35228396
Test: builds, manually examine changes to build.ninja and Android.mk
Change-Id: I51729992cc6338deda1396b86f12bc9f73e674d8
2017-02-14 17:52:10 -08:00
Dan Albert
022e7a3839 Allow unversioned_until: "current".
Since most system libraries aren't actually versioned yet, we
shouldn't be building the stub libraries with version info just yet.
Setting `unversioned_until: "current"` will not use the version
script for anything but android-current (this way when the version
script is applied, we'll immediately catch it if they don't match).

Test: Updated frameworks/wilhelp to use this, make ndk
Bug: https://github.com/android-ndk/ndk/issues/278
Change-Id: I0dab7fd21bb0f063c39368d37feaa3f822e908ce
2017-01-05 15:49:09 -08:00
Dan Albert
98dbb3bc2d Add unversioned_until to ndk_library.
This defaults to the value of first_version, and should almost never
be used. This is only needed to work around platform bugs like
https://github.com/android-ndk/ndk/issues/265.

Test: Set `unversioned_until: "24"` for libGLESv3.ndk, readelf on the
      android-23 and android-24 outputs to check for version info.
Bug: https://github.com/android-ndk/ndk/issues/265

Change-Id: Ie44b170daad692fdc98e7d7c5f10f9077930b8a9
2017-01-03 15:16:29 -08:00
Colin Cross
37047f1c7e Pass DepsContext to dependency methods
Pass a DepsContext that embeds android.BottomUpMutatorContext
instead of android.BaseContext so that dependency methods can
directly add dependencies.

Test: m -j
Change-Id: Id4c157975d3d6f03efd99785d217bef486a76139
2016-12-13 17:32:29 -08:00
Colin Cross
ab3b7323c4 Remove boolean arguments from NewLibrary()
NewLibrary is going to be used for header only libraries.  Instead
of adding more boolean arguments, replace the existing ones with
BuildOnlyStatic and BuildOnlyShared calls on the libraryDecorator
returned by NewLibrary.

Test: m -j, compare build.ninja
Change-Id: Id390b66cbf2a5f0932b32f40a5e18eb9e3852ee7
2016-12-13 14:50:51 -08:00
Dan Albert
90f7a4dcab Allow first_version: "current" in ndk_library.
Test: Added a test module that uses this
      find $SOONG_OUT -name libfoo.so # only shows up in current
Bug: None

Change-Id: Ic88d7c598cd5b6ded8fb851a7eaf859806336af7
2016-11-10 14:01:08 -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 Albert
073379e549 Revert "Revert "Use the platform SDK version from the config.""
This reverts commit 74b8b55bb2.

Test: OUT_DIR=ndk-out DIST_DIR=ndk-dist \
          build/soong/scripts/build-ndk-prebuilts.sh
Bug: None

Change-Id: Ia320609ec6fb382b13ff9007a6496b73198ff871
2016-11-10 11:11:07 -08:00
Dan Albert
74b8b55bb2 Revert "Use the platform SDK version from the config."
This reverts commit 9bef523809.

Reason for revert: Broke things

Change-Id: Ic3deac4fb6992572ac0cc95fa04d003e0c29f113
2016-11-09 19:39:42 +00:00
Dan Albert
9bef523809 Use the platform SDK version from the config.
N is in AOSP now.

Test: make ndk && ls out/soong/ndk/platforms/android-24
Bug: None
Change-Id: I846ee12d10e962931bf22c94c37cdf7207dd4ff7
2016-11-08 12:53:39 -08:00
Dan Willemsen
5cb580f407 Start using "struct Objects" to store object Paths
So that we can represent other files that get generated along with the
objects, like the gcno coverage information, and per-file clang-tidy
runs.

Test: Soong's build.ninja identical before/after
Change-Id: I5c553a153c436d5403549f62c73fe79c5f101779
2016-10-31 16:18:49 -07:00
Colin Cross
2f33635542 Simplify compileObjs
None of the direct users of compileObjs were using any of its
complexity (generated sources, excluded sources, extra sources).  Move
the complexity back in to baseCompiler.compile.

Test: m -j
Change-Id: I2e59d216682c00dd12a1395cf2448827d1c48023
2016-10-27 15:18:13 -07:00
Colin Cross
9d45bb78c5 Enable goma in soong
When the UseGoma flag is set, put all rules except the C compilation
rule in an externally defined local_pool, which will have been created
by kati.  The gomacc wrapper will already be in the CC_WRAPPER
environment variable.

Bug: 31142427
Change-Id: I699d4edff2e302eee398dad8692ceb14721a628c
2016-08-31 09:48:08 -07:00
Colin Cross
e8a67a7c58 Make BottomUpMutators parallel
Append .Parallel() to all of the RegisterBottomUpMutator calls to tell
Blueprint it can run them in parallel.

Test: identical build.ninja, passes race detector
Change-Id: I969a0689522d4cba7c8ff51e2aa00fe2fd338a89
2016-08-11 13:20:16 -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
Dan Albert
7fa7b2efd3 Don't generate intermediate NDK libraries.
It's better to clip to the existing versions here rather than build
the lower levels as if they existed.

cc.Module's begin() will now normalize the sdk_version to a valid
value for the given architecture so that doesn't have to be checked
later.

Test: make checkbuild with all other libc ndk_library changes
Change-Id: I2fa834f7a1ac3b03a0723291778d86207fcfda72
2016-08-05 16:48:36 -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
7e9d295807 Auto-fill ndkMigratedLibs.
Change-Id: Ifb91f62eccb17dedb71c1a9a0f5c1471edbcbd44
2016-08-04 16:10:54 -07:00
Dan Albert
2bc91ba549 Use the version script for ndk_library.
We were generating this, but not actually using it yet.

Test: `make ndk` with libc/libm migration patches, readelf generated
      libs.
Change-Id: I9aadf58307bc645b33cab5207409552c5046937a
2016-08-02 13:45:40 -07:00
Colin Cross
42742b8bb0 Rename compiler, linker and installer methods to be unique
compiler, linker, and installer interfaces may be implemented by a
single decorator object, rename their methods to be unique to avoid the
same method being called multiple times.

Test: out/soong/build.ninja unchanged
Change-Id: I1608c41cd68f614ba99c11bb9fcc7936f618d9aa
2016-08-01 13:47:15 -07:00
Colin Cross
4d9c2d17c3 Separate cc.go
Split cc.go into files per module type, plus files for the compiler,
linker, and installer stages.

Change-Id: Id44c03f42fcd180950ccd008d4de0c144ea3597b
2016-07-29 15:17:58 -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