Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.
Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
Package checks were not being run for java libraries that were in an
APEX and not on the platform. This change fixes that and updates the
script to report all failing classes to make it easier to update the
list of packages.
Test: m java
Bug: 157633658
Change-Id: I28044e08d3a40e9f3464bb2158ef6a28d57264d1
- We can pass all targets at once to build-aml-prebuilts.sh.
- Less noise from build-mainline-modules.sh.
- Default to the same out directory in both build scripts.
- Addressed post-submit comments on https://r.android.com/1170907.
- Various minor cleanups.
Test: build/soong/scripts/build-mainline-modules.sh
Change-Id: Id21ef80c2334462836e217032fc5bf63b7cd04e1
Not sure whether sort, tr or xargs returning non-zero status, but
one of them sometimes does.
Test: manually
Change-Id: I8f2b862de9d6e22dd90068252e393533ec992dfd
Empty results cause grep/egrep to return a non-zero status.
Bug: 145347092
Bug: 141258651
Bug: 69058154
Bug: 143285996
Test: manual run for notice files
Change-Id: I25d54ae307b97a07a98e99c54f283437718fe657
This is an unchanged copy of build/make/tools/generate-notice-files.py
After this change, the make implementation of generate-notice-files.py
will change to take a required parameter for $(PRODUCT_OUT) and will
only include notices for files built under $(PRODUCT_OUT).
Because soong has the ability to walk dependency trees, the soong
version will likely change in the future to use that ability causing
both versions to move in different directions.
After those changes are complete, we can look into factoring out any
remaining shared logic.
Test: run manually and system image notices checked for changes
Change-Id: Id139a66503457615548b46e7996349ca0817e831
Makes them more editor friendly, primarily when copied into
system/linkerconfig/testdata/root.
Test: m
Test: No diff between apex_manifest_full.json in out/
and in linkerconfig/testdata/root/
Bug: 140599044
Change-Id: I6dacdd4baa59e6d70586c4a6343b9b8fd1b574f6
This utility can also be used for parsing and
managing the Android Manifest for apex under
system/apex/apexer.
Test:
python manifest_fixer_test.py
python manifest_check_test.py
BUG: 148198056
Change-Id: Iffe465b5f36b2a3fbf81414d6f19e241c5f5648f
Unit test: go test ./... -test.v -run TestOverrideAndroidApp
Unit test: python manifest_fixer_test.py
BUG: 148198056
Change-Id: Ib5ff235d2a93e88b86aec1c0b16327ea938a094d
This can now discover which make module types have been deprecated and
suggest what needs to happen with the BUILD_BROKEN_USES_* flags.
Bug: 130720555
Test: go run .../build_broken_logs.go * (see header comment)
Change-Id: Iffaa32c0b0079e99b926162257a7c15c530c15a1
If the install apk name is different than the module name, use
test_config_fixer to update the test-file-name value in the config.
Test: app_test.go
Fixes: 147375216
Change-Id: I2141eeebbb3552995400b45634712306673fd812
For modules that provide API surfaces in addition to the standard
current, test and system it is useful to be able to specify the
directory containing the api's .txt files to make it easy to create
multiple API surfaces from within the same Android.bp file. e.g. This
is useful for conscrypt, icu and libcore to manage their intra core
and core platform APIs.
Bug: 145998881
Test: m checkbuild
Change-Id: I753631d9b6993fbf30019fef5c052a9429e519de
If the library does not provide system and test APIs then do not
generate/require corresponding .txt files.
Bug: 145998881
Test: m checkbuild
Change-Id: I21cfdb0b63fd575e8c8c63ea2b436e0c4aa8f3fc
prebuilts.
This runs Soong in skip-make mode, using normal in-make mode only to query
platform versions.
The same ${OUT_DIR} cannot be used for both skip-make and in-make builds,
because Soong generates a smaller build.ninja file in in-make builds where
many build targets are expected to be provided by the mk files. Thus this
script avoids using ${OUT_DIR} if it's an in-make build, defaulting instead
to out-aml/.
The script is based on build-ndk-prebuilts.sh, but uses a separate Soong
variable Aml_abis to enable the appropriate target architectures for
Mainline modules. Aml_abis is very similar to Ndk_abis, except "armeabi-v7a"
is used instead of "armeabi", which is necessary to match prebuilt
dependencies, e.g. for LLVM.
Test: build/soong/scripts/build-aml-prebuilts.sh libart libdexfile_external
(verify that libraries for arm, arm64, x86, x86_64 are built)
Test: build/soong/scripts/build-aml-prebuilts.sh \
out-aml/soong/.intermediates/external/conscrypt/conscrypt-module-sdk/android_common/conscrypt-module-sdk-current.zip
(verify that the zip file contains libconscrypt_jni.so's for all four arches)
Test: build/soong/scripts/build-aml-prebuilts.sh com.android.art.{release,debug,testing,host}
(verify that the build completes)
Test: Two identical build/soong/scripts/build-aml-prebuilts.sh runs after each other
(verify that the 2nd run completes both Soong and ninja steps quickly without any building)
Change-Id: I35712f9f8f0b1cbb77107314c5927c6720e6c3bf
If package_name is set for an android_test module, package names in its
AndroidTest.xml config need to be updated too.
Test: test_config_fixer_test.py
Fixes: 145011263
Change-Id: I52f17ef1d1902364b9bcfec4f6e246bd655dbf09
Previous solution by using objcopy uses a quirky behaviour of the GNU
objcopy and there is no equivalent option in llvm-objcopy.
Instead of removing symbols, extract and repack libgcc to only include
required objects.
Bug: 142585047
Test: presubmit
Change-Id: I58af74c18838f797e481da38c3265f0624fddf99
We rely on a weird, GNU specific behaviour of objcopy:
$ aarch64-linux-android-objcopy -w libgcc.a stripped.a --strip-unneeded-symbol=*
$ llvm-nm --defined-only stripped.a | grep multi
0000000000000000 T __multi3
$ aarch64-linux-android-objcopy -w libgcc.a stripped.a --strip-unneeded-symbol=* --keep-symbol=FOO
$ llvm-nm --defined-only stripped.a | grep multi
llvm-objcopy has a different, more consistent behaviour that does not
mark exported symbols as unneeded when "--keep-symbol" flag exists.
However this behaviour will leave most symbols not deleted in the
libgcc_stripped library.
Revert the change while I'm implementing an alternative solution.
Test: presubmit
Bug: 142585047
Change-Id: I175e811f8a1f6afc6558267fc54e159ad5e12acf
Also fix an issue with deps file introduced in ab5e5142. Now correctly
depends on llvm-readelf insteaf of GNU readelf.
Test: presubmit
Change-Id: Id287e2844626c07917348a62820f8b5edbb22c3d
We had a typo in the original checkin. We need two hypens before
"remove-section" for llvm-strip, just like we have for strip.
Bug: 140721128
Test: Clean build of Go device
Change-Id: Ifb83dc4e6ad8f8070d9ced678f9147d6a040aee7
llvm-objcopy now implements '--regex' option, which allows it to replace
GNU objcopy for creating libgcc_stripped archieve.
Test: build
Bug: 131631155
Change-Id: Ie1733ac8e9b3765f7652a562406dcedb4735cc1a
sysprop_library now checks the API stability itself, cutting dependency
on java_sdk_library. Under the directory {module_dir}/api,
{module_name}-current.txt and {module_name}-latest.txt hold API
signatures.
When sysprop_library is built, or a user run "m {module_name}-check-api"
command, API check is performed. First, current.txt must have exactly
same signature with built sysprop_library module. Second, current.txt
must be compatible with latest.txt.
Build system emits a handy error message to generate/update those API
files, in case of missing or mismatching. Also, a script file for
freezing API files is introduced.
Bug: 131637873
Test: 1) m && boot blueline
Test: 2) m {sysprop_library} performs API check
Test: 3) manual test for check-api, freezing api
Change-Id: I9d25f5dc64299e666527ca8e23d7233966901c4e
Merged-In: I9d25f5dc64299e666527ca8e23d7233966901c4e
Merged-In: Ib7ad4f17e82c90da5ef3f80e2ab88c0b53112c60
(cherry picked from commit 093f0eb133)
This tool is used to modify apex_manifest.json when building apex
module.
Here's the usage:
usage: jsonmodify [-h] [-o output] [-v path value] [-s path value]
[-r path] [-a path [value ...]]
[input]
positional arguments:
input JSON file
optional arguments:
-h, --help show this help message and exit
-o output, --out output
write result to a file. If omitted, print to stdout
-v path value, --value path value
set value of the key specified by path. If path
doesn't exist, creates new one.
-s path value, --replace path value
replace value of the key specified by path. If path
doesn't exist, no op.
-r path, --remove path
remove the key specified by path. If path doesn't
exist, no op.
-a path [value ...], --append_list path [value ...]
append values to the list specified by path. If path
doesn't exist, creates new list for it.
Bug: 138695532
Test: m jsonmodify
Test: echo {} | jsonmodify -v name hello -a list.nested a b c
{
"name": "hello",
"list": {
"nested": [
"a",
"b",
"c"
]
}
}
Change-Id: I2cd043c614b3ad2306a0c27ccee302633c6d2525
If sort_bss_symbols_by_size is true, a shared library is built twice.
The first build generates an unsorted output file, which is used to
generate the symbol ordering file. The output of the second build is
a shared library with its bss symbols sorted by their size.
With this, the only user of symbol_ordering_file, libc, is migrated to
use the new property, so we remove symbol_ordering_file support as well.
Bug: 135754984
Test: Build and check the resulting libc.so has its bss symbols sorted.
Change-Id: I5c892b44d82eb99cbc070cfa2c680be3087f3364
Make the jar wrapper script correctly handle quoted arguments with
spaces in them. Also allow JVM arguments in the form -J-XX, not just
-JXX.
Test: m checkbuild
Change-Id: Iec5105bc390f2a12c6a4cda7f76d37585c39f520
clang-format tries to automatically detect the Cpp standard used,
particularly when determining to put spaces in template definitions:
Cpp03: std::vector<std::pair<bool, bool> >
vs
Cpp11: std::vector<std::pair<bool, bool>>
It doesn't always get this correct as seen in
https://android-review.googlesource.com/c/platform/system/core/+/973463/8
but since we know that all code within Android is C++17, we can safely
assume it should be formatted with the newer standard.
Test: clang-format doesn't break the above change.
Change-Id: I7d1d709690b7bca6da3863cc9a58e53eaec751b0
As of [1], the Google format, which we default to, uses IncludeBlocks:
Regroup, which sorts all includes with <> and without .h into the top
group reserved for libc headers, e.g.:
+#include <android-base/properties.h>
+#include <android-base/strings.h>
#include <ctype.h>
#include <stdlib.h>
#include <sys/system_properties.h>
#include <iostream>
-#include <android-base/properties.h>
-#include <android-base/strings.h>
This is accurate to the Google C++ style guide, which states that
other library headers should be included with "", however we have a
strong tendency to use <> for these headers for Android, so we must
revert this change.
Note, clang-format allows regexes for creating the blocks as well,
however, short of including all possible libc headers, I don't think
there's a way to differentiate between <sys/wait.h> and
<other_lib/header.h>.
[1]:
62e3198c4f (diff-b689ebff2e51e675b346a88289e74542)
Test: clang-format doesn't do the above.
Change-Id: Ifef605ffd6b4c8a36512377644e64ddd26b68a21
The new package manager behavior requires packages without source code
to have an application element with hasCode attribute set to false in
their manifest. With this change, Soong can now automatically insert one
for codeless apps.
Test: app_test.go, manifest_fixer_test.py
Fixes: 124375490
Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
All users have been removed.
Test: treehugger
Change-Id: I35e55f3ce79c8e68585be120b5dec810563c7a83
Merged-In: I35e55f3ce79c8e68585be120b5dec810563c7a83
Add a tool that can check that the <uses-library> tags in an
AndroidManifest.xml file match a list provided by the build.
Bug: 132357300
Test: manifest_check_test
Change-Id: If15abf792282bef677469595e80f19923b87ab62
In preparation for making it use multiple files so that some
implementation can be shared with a new tool.
Also make manifest_fixer_test a python_test_host, and add it
to TEST_MAPPING.
Test: m checkbuild
Change-Id: Iaae177efcb978187b126d90359b82cdfd3176857
New strip option named keep_symbols_and_debug_frame, that will keep the
symbols and the .debug_frame. This is meant for use by libc.so only on
arm32. Other libraries might want to use it to keep better unwinding
information on device.
Bug: 132992102
Test: Built libc.so with this option and verified that it contains
Test: the .debug_frame section.
Change-Id: I823a28199dec8316e8b26fe31ff9f17e6b11d406
The jars containing the merged header classes from transitive
static dependencies were stripping all of META-INF/. Kotlin
puts metadata in META-INF that is used to map the package to
the static class that contains the package-level functions.
This also exposed that the metadata in META-INF is always
called "name.kotlin_module", so a library that contains
kotlin files with a dependency that also contains kotlin files
would shade the metadata file. Use a unique name instead.
Fixes: 131709692
Test: m checkbuild
Change-Id: I5cd276e563206e37c4c0d90fe9f346e9396f88c0
We use libgcc as fallback for symbols not present in libclang_rt
builtins, however we didn't know what exact symbols were being used,
some may not be intended to fallback.
Create libgcc_stripped, which only contains unwind symbols from libgcc.
Bug: 29275768
Test: bionic-unit-tests
Change-Id: I5b349fa6138e51663bf3b67109b880b4356da8e8
There are no remaining users.
Also mark BUILD_BROKEN_ANDROIDMK_EXPORTS and BUILD_BROKEN_ENG_DEBUG_TAGS
as deprecated in scripts/build_broken_logs.go
Test: treehugger
Change-Id: If7892bef1b9001f12a99565f886b395cf1985e70
Some people apparently still talk to the network during their build.
Allow this temporarily with a BUILD_BROKEN_USES_NETWORK check.
Bug: 129992021
Test: attempt to talk to the network during the build with and without
this flag.
Change-Id: Ifb967c656aa24c4599e7232d0f1b5a303b5bac52
Looks like the reason for it existing has been fixed. It should probably
just be removed.
Bug: None
Test: WITH_TIDY=1 m
Change-Id: I770b2fec4ac44f265ff31731c9c0bd4da14d5b0f
The setup_go_workspace_for_soong now allows the reverse operation
of unbinding the directories of the previous operation. Also,
refactored the script to easily add more directories to bind/unbind
in the future, catch failures on running in subshell commands and
a cleaner way to find the repo top directory.
Bug: b/129407866
Test: Manually tested by running the script on binding and unbinding
the directories. Tested both darwin and linux OS.
Change-Id: I7c93230aeab819ab5747e990e95aa26077071d9e
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
Notice file for an APEX is created by merging notice files for the
modules included in it (plus the notice file for the APEX itself if
specified).
Notice files having the same content are not duplicated; it is emitted
only once.
Bug: 128701495
Test: m (apex_test is amended)
Test: m and inspect $(PRODUCT_OUT)/obj/NOTICE.txt to check there are
license entries for /system/apex/*.apex files
Change-Id: I169d91038291a6c71615de97cf5b03174afab5d4
Some non-interpretable error messages has been shown in case of missing
current api files. Instead of that messy errors, This clearly tells
users what is the problem and how to fix it.
Bug: 126259114
Test: 1) try to build a sysprop_library and a java_sdk_library without
creating txt files under api/, and see it fails.
Test: 2) Copy and paste the emitted command, and try to build again.
Change-Id: I986781cc710475647c2b996b0f1c51a6f50c0ba2
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.
Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
And add a helper script that can help parse the output from
build_test.bash
Test: check for BUILD_BROKEN_ENG_DEBUG_TAGS in soong.log
Test: go run ../build/soong/scripts/build_broken_logs.go *
Change-Id: Idd0fc8b59770dcdbe44eeba262558708a9497f96
... except for Darwin Mach-O, as it is not supported by llvm-strip.
Test: m checkbuild
Bug: 119221035
Change-Id: I021637b6dd3530bff1f563f2ec7c2168e1083b7e
Bug: http://b/122481018
The '-keep' option of llvm-strip has changed to '-keep-section'. Update
scripts/strip.sh accordingly.
Test: Tested on various targets in AOSP and internal branch. Googlers
see http://go/clang-r349610-testing
Change-Id: Ibfc97ecdcdc305c97a4169cead1e1e3cddda9c4c
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
The last change should have changed this from taking a boolean to a
simple switch.
Test: build a package with LOCAL_PREFER_INTEGRITY=true
Bug: 112037137
Change-Id: I5ce3b1455404b5c8e781496d26c0431db52a170f
These are all overwritten by setting Ndk_abis.
Bug: 73545680
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I1c922f5cd1611ed055653d449709fec69dca410b
soong.config is not cleared between builds, which can cause
problems when switching between an ndk build and a platform build.
Bug: 118398924
Test: OUT_DIR=out_ndk DIST_DIR=dist build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: Ifc03a0c25f46625375cdda5723e4a09d7d8050d5
If provided (--prefer-integrity=true/false), the script will set the
value in the the manifest. The script will fail if the value mismatches
the original in the manifest, if any.
Test: scripts/manifest_fixer_test.py
Test: aapt dumps the attribute and observe
Bug: 112037137
Change-Id: I2b333a7c0747dbcbed4d419f1c9ed46d4a4c98e9
The intermediate files generated by strip.sh --keep-symbols can be
very large, and are not useful after the build. Remove them once
the final output file has been generated.
Saves ~6GB on an aosp_sailfish-userdebug build.
Test: m checkbuild
Change-Id: I0413f16ac5f423bc1b010cc9b8538f19bdea561e
The two java shared libraries do not exist in the pre-P devices.
Therefore, marking the dependencies to the libraries as optional so that
an app is still installable to the old devices.
This is safe because the classes in the java shared libs exist in other
shared libraries (bootclasspath or android.test.runner).
Bug: 113800422
Test: run aapt dump badging on the built GtsBackupHostTestCases
uses-library tags for android.test.base|mock are with
android:required=false, while the same tag for other libs are without
the attribute.
Change-Id: I266c8efb9686e8975be37f31aea0dc22f82370c3
Instead, hardcode the ~dozen paths into build/soong/Android.bp, which
will unblock removing more GCC support.
Bug: 114286031
Test: m
Change-Id: I2508432e00b1469141f01e667f3c6a2fe30cd805
Setting targetSdkVersion to '1' causes ManifestMerger to add
implicit permissions when merging to a higher targetSdkVersion.
It should really be unset, but ManifestMerger treats unset
targetSdkVersion as 'Q' if minSdkVersion is 'Q' (but not if
minSdkVersion is '28'). Set it to something low so that it
will be overriden by the main manifest, but high enough that
it doesn't cause implicit permissions grants.
Bug: 115415671
Bug: 117122200
Test: m checkbuild
Change-Id: I1d2d031a21314f6b55d8ea1cc7c4c8e3ecae7f06
This also changes over llvm-strip to use the -o flag, rather than
relying on nonstandard (and no longer functional) positional arguments.
Bug: http://b/111998531
Test: Multiple new builds. For googlers - http://go/clang-r339409-testing
Change-Id: I8c82d06304af24a001e6552e36e2f540d8e364ce
Stripping static executables prints a warning:
bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-nm: No such file or directory
The message is harmless, just hide it.
Also turn on pipefail so that the script will exit if the command
returns an error.
Bug: 24409581
Test: m checkbuild
Change-Id: I9647c55c3509e4573e6d4f2f6d88119bdf31e9fb
targetSdkVersion should stay as "current" when min_sdk_version
is set but sdk_version is not.
Bug: 112438448
Test: atest CtsTelecomTestCases
Change-Id: I11dc27eccd31200d1ce27c7e332106bb825651b4
strip.sh --keep-mini-debug-info matches the default for Make, and
is currently used on lots of files that are not elf files. For
now, just make the behavior match Make and skip files when
strip --strip-all fails.
Bug: 113936524
Test: m checkbuild
Change-Id: I3648c914c0fd7cc9b68aa93fd3cb0b77504d42f6
strip.sh --keep-mini-debug-info had extra $$ escaping from when it
was copied from make.
Bug: 113936524
Test: m checkbuild
Change-Id: I47dec958152584ca94c6149b11a06e64be2f22f9
Remove the ability for Soong to build 32-bit darwin code. We've already
disabled this in Make, this is just removing the unused bits in Soong
and simplifing the toolchain config.
Test: m host
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I968c5d98bdf162297d639f7988918dadb7ba6e07
Add new command line flag to manifest_fixer.py which will add
'android:usesNonSdkApi="true"' attribute to the <application> tag.
Bug: 113315999
Test: build/soong/scripts/manifest_fixer.py
Change-Id: If030c90a4ced3f5c5176727c579a87d0ecab6cf8
* Some flags are accepted by clang but not clang-tidy.
They could cause the diagnostic-unused-command-line-argument warning.
Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.
Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889