Commit graph

79 commits

Author SHA1 Message Date
Colin Cross
9dc186f120 Merge "Add robolectric-shadows to setup_go_workspace_for_soong.sh" 2019-04-10 20:28:56 +00:00
Dan Willemsen
25e6f09c06 Add BUILD_BROKEN_USES_NETWORK
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
2019-04-09 10:23:49 -07:00
Vladimir Marko
0975ee0de3 Check package restrictions for Java libs.
Test: m checkbuild; inspect verbose log.
Test: Manual - compile with unmet restrictions.
Bug: 122937705
Change-Id: I9360ae8b6d9ce016b7827be5e8ffc6eb521809b7
2019-04-08 14:02:14 +01:00
Colin Cross
5e5b2c7f1c Add robolectric-shadows to setup_go_workspace_for_soong.sh
Bug: 122331577
Test: setup_go_workspace_for_soong.sh
Change-Id: I173174927f9d107c4a196968b568ace6473394c7
2019-04-08 05:46:07 +00:00
George Burgess IV
c4624c0189 Remove our clang-tidy wrapper
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
2019-04-04 17:58:00 -07:00
Patrice Arruda
b4e93fbdc2 Soong: Add unbind option to setup_go_workspace_for_soong.sh script
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
2019-03-29 15:57:47 -07:00
Treehugger Robot
21c81326ff Merge "Notice support for APEX" 2019-03-21 06:04:14 +00:00
Vic Yang
efd249e62a Add support for no-vendor-variant VNDK
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
2019-03-21 04:29:24 +00:00
Jiyong Park
52818fcde8 Notice support for APEX
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
2019-03-21 08:05:50 +09:00
Inseob Kim
8098faad9f Refine error messages in case of missing api files
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
2019-03-20 15:33:06 +09:00
Colin Cross
e4246abd7f Make manifest and APK agree on uncompressed native libs
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
2019-02-08 15:24:47 +00:00
Dan Willemsen
01f0a05361 Add BUILD_BROKEN_ENG_DEBUG_TAGS to soong.log
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
2019-02-05 15:15:16 -08:00
Yi Kong
b5c34d7f40 Use llvm-{strip,objcopy} by default
... except for Darwin Mach-O, as it is not supported by llvm-strip.

Test: m checkbuild
Bug: 119221035
Change-Id: I021637b6dd3530bff1f563f2ec7c2168e1083b7e
2019-02-04 18:20:28 +08:00
Pirama Arumuga Nainar
03b58e2210 Switch to clang-r349610
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
2019-01-31 16:32:34 +00:00
Treehugger Robot
05f9055505 Merge "Rename preferCodeIntegrity to useEmbeddedDex" 2019-01-30 05:07:22 +00:00
Tom Cherry
eca62454e8 Revert "system-clang-format: DontAlign"
"AlignAfterOpenBracket: DontAlign" is explicitly wrong and was not
common before.

Wrong:

  int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point,
          bool needs_checkpoint) {

Right:

  int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point,
                      bool needs_checkpoint) {


This reverts commit a4319f7800.
Test: clang-format works correctly.
Bug: 122835115

Change-Id: Icd988070f208e1963bb68651c63fa369cb1e2782
2019-01-30 00:29:23 +00:00
Victor Hsieh
d181c8ba76 Rename preferCodeIntegrity to useEmbeddedDex
Test: build and run testing app
Bug: 112037137
Change-Id: Ia82c2c3ba7eb32117a4be078ac31ee2ba510f9eb
2019-01-29 13:09:10 -08:00
Steven Moreland
a4319f7800 system-clang-format: DontAlign
AlignAfterOpenBracket: DontAlign

The main consideration is this:

if (foo && ....
    foo) {
    // code

->

if (foo && ....
        foo) {
    // code

Change-Id: Ife0073c8544b9554df2eb54e10dc2e7611631299
Fixes: 122835115
Test: manual
2019-01-28 18:21:15 -08:00
Steven Moreland
1aa839c275 Move system-clang-format to a central location.
So that system/core clang-format can be used in more places.

Bug: 122835115
Test: manual
Change-Id: I233a5003c4229126f37a89e90eac4a75dc5ad104
2019-01-22 13:27:45 -08:00
Victor Hsieh
a2c16c1aa0 manifest_fixer: rename to --prefer-code-integrity
During code review, the name change was suggested.

Test: local CTS passed
Bug: 112037137
Change-Id: I7eb25210afb45c7477b0d606574048a15c9c721d
2019-01-03 09:51:11 -08: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
Victor Hsieh
f9919c7d52 manifest_fixer: make --prefer-integrity an enabler
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
2018-11-19 19:30:16 +00:00
Dan Willemsen
7481487d24 build-ndk-prebuilts: Remove unused device config
These are all overwritten by setting Ndk_abis.

Bug: 73545680
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I1c922f5cd1611ed055653d449709fec69dca410b
2018-10-30 21:11:42 -07:00
Colin Cross
395f2cfa89 Move Ndk_abis from soong.config to soong.variables
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
2018-10-24 23:20:10 +00:00
Victor Hsieh
ce7818ed6e Add --prefer-integrity option to manifest_fixer.py
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
2018-10-24 10:32:10 -07:00
Colin Cross
3adb2ed734 Remove strip.sh intermediates
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
2018-10-18 18:07:44 +00:00
Jiyong Park
fa17afef53 android.test.{base|mock} are added as optional libraries.
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
2018-10-16 18:05:49 +09:00
Paul Duffin
d616b6719f Make automatically added <uses-library> entries optional
Test: run aapt dump badging on build apk
Bug: 113800422
Change-Id: I8cdfc3bea0c23e93f44b5707414a7a5a1e3af1c0
2018-10-11 14:32:50 +01:00
Dan Willemsen
feea4dff66 Stop using GCC in toolchain_library
Instead, hardcode the ~dozen paths into build/soong/Android.bp, which
will unblock removing more GCC support.

Bug: 114286031
Test: m
Change-Id: I2508432e00b1469141f01e667f3c6a2fe30cd805
2018-10-07 23:50:34 -07:00
Colin Cross
4b176069c3 Don't set targetSdkVersion to '1' for libraries
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
2018-10-02 12:39:38 -07:00
Stephen Hines
c91ab9eb6d Switch to clang-r339409.
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
2018-09-26 21:15:08 +00:00
Colin Cross
8e877af5f4 Hide warning on static executables in strip.sh
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
2018-09-19 23:23:51 +00:00
Colin Cross
b496cfd9d2 Enable toc support for Darwin and Windows
Bug: 113936524
Test: m checkbuild
Change-Id: I0f2030ad75daae2cbe44e8cbedad329d33df55f7
2018-09-10 23:12:11 -07:00
Colin Cross
7b59e7b2d0 Make manifest_fixer.py keep targetSdkVersion high with min_sdk_version
targetSdkVersion should stay as "current" when min_sdk_version
is set but sdk_version is not.

Bug: 112438448
Test: atest CtsTelecomTestCases
Change-Id: I11dc27eccd31200d1ce27c7e332106bb825651b4
2018-09-10 14:41:56 -07:00
Colin Cross
496d66d425 Fix manifest_fixer_test.py
Fix tests after I8fcf0c5f452707565ba1808f6fe552ffed055c47.

Test: manifest_fixer_test.py
Change-Id: Ie55e28b537b960a5e0f4785eda2c0f619b89275c
2018-09-10 14:41:56 -07:00
Colin Cross
0abcbe6a6d Fix inverted logic for objcopy vs. llvm-objcopy with --keep-symbols
Bug: 113936524
Test: m checkbuild
Change-Id: I958c4277342ed6885714a01bd9f35183ed73eda7
2018-09-07 17:36:40 -07:00
Colin Cross
02b04bb299 Allow strip.sh --keep-mini-debug-info to work on non-elf files
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
2018-09-05 16:30:16 -07:00
Colin Cross
f843290eb8 Fix strip.sh --keep-mini-debug-info
strip.sh --keep-mini-debug-info had extra $$ escaping from when it
was copied from make.

Bug: 113936524
Test: m checkbuild
Change-Id: I47dec958152584ca94c6149b11a06e64be2f22f9
2018-09-05 16:30:16 -07:00
David Brazdil
9b106574fa Merge "Support setting android:usesNonSdkApi in manifest_fixer.py" 2018-08-31 09:59:39 +00:00
Dan Willemsen
e97e68a05a Clean up darwin cc toolchain
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
2018-08-28 20:08:50 -07:00
David Brazdil
d5b74996be Support setting android:usesNonSdkApi in manifest_fixer.py
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
2018-08-28 12:41:01 +01:00
Chih-Hung Hsieh
a7aa958e6e Add clang-tidy.sh to filter out troublesome flags.
* 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
2018-08-22 09:21:45 -07:00
Colin Cross
1b6a3cfea4 Set targetSdkVersion in manifest_fixer
If targetSdkVersion is not set in the manifest, set it to the
value it was implicitly using before changing minSdkVersion.
Requires passing --library to manifest_fixer.py to distinguish
between apps, where the implicit value was set by aapt2 to
current, or libraries where the implicit value was 1.
Fixes cases where the manifest does not specify targetSdkVersion
and was inheriting the minSdkVersion value until manifest merger
started merging a lower targetSdkVersion value from a library.

Bug: 111347801
Test: manifest_fixer_test.py
Change-Id: I8fcf0c5f452707565ba1808f6fe552ffed055c47
2018-07-26 11:09:24 -07:00
Dan Willemsen
b82471ad6d Add a unified status reporting UI
This adds a new status package that merges the running of "actions"
(ninja calls them edges) of multiple tools into one view of the current
state, and gives that to a number of different outputs.

For inputs:

Kati's output parser has been rewritten (and moved) to map onto the
StartAction/FinishAction API. A byproduct of this is that the build
servers should be able to extract errors from Kati better, since they
look like the errors that Ninja used to write.

Ninja is no longer directly connected to the terminal, but its output is
read via the protobuf frontend API, so it's just another tool whose
output becomes merged together.

multiproduct_kati loses its custom status routines, and uses the common
one instead.

For outputs:

The primary output is the ui/terminal.Status type, which along with
ui/terminal.Writer now controls everything about the terminal output.
Today, this doesn't really change any behaviors, but having all terminal
output going through here allows a more complicated (multi-line / full
window) status display in the future.

The tracer acts as an output of the status package, tracing all the
action start / finish events. This replaces reading the .ninja_log file,
so it now properly handles multiple output files from a single action.

A new rotated log file (out/error.log, or out/dist/logs/error.log) just
contains a description of all of the errors that happened during the
current build.

Another new compressed and rotated log file (out/verbose.log.gz, or
out/dist/logs/verbose.log.gz) contains the full verbose (showcommands)
log of every execution run by the build. Since this is now written on
every build, the showcommands argument is now ignored -- if you want to
get the commands run, look at the log file after the build.

Test: m
Test: <built-in tests>
Test: NINJA_ARGS="-t list" m
Test: check the build.trace.gz
Test: check the new log files
Change-Id: If1d8994890d43ef68f65aa10ddd8e6e06dc7013a
2018-07-12 14:15:31 -07:00
Peter Kalauskas
39b0deb0d7 Fix error in build when OUT_DIR_COMMON_BASE is used
Without this change, gen-kotlin-build-file.sh will generate
kotlinc-build.xml file with path that look like:

/path/to/aosp-top//path/to/aosp-out/soong/.intermediates/...

Also fixed a couple lint errors.

Test: Set OUT_DIR_COMMON_BASE and was able to build
Bug: 111309264
Change-Id: I86173571667deca79ee0d9a7324715c9a0e4cd97
2018-07-10 12:42:22 -07:00
Jiyong Park
c08f46fdfc add --uses-library option to manifest_fixer.py
`--uses-library foo` adds <uses-library android:name="foo"
android:required="true"/> element to the manifest.

When there is already a uses-library element with the same
name, then the hand-written element is respected.

Test: m -j
Test: build/soong/scripts/manifest_fixer_test.py

Change-Id: Ia5e989d3c3c3fba7cc9015a6d16dac70464282a8
2018-06-20 12:03:09 +09:00
Colin Cross
8bb10e8f8a Add a script to inject values into manifests
Add a script that can inject a <uses-sdk minSdkVersion=""> into
AndroidManifest.xml files.  This will help with merging
LOCAL_STATIC_ANDROID_LIBRARIES, because ManifestMerger treats
a missing minSdkVersion as minSdkVersion=1 and throws errors
if libraries use a larger minSdkVersion.  It will also help
with cases where an app has a manifest that specifies an old
minSdkVersion, but the build system is compiling the app in
a way that is not compatibile with old devices, for example
using a newer dex format.

Bug: 110167203
Test: m java
Test: build/soong/scripts/manifest_fixer_test.py
Change-Id: I528d71a225feb86464c530e11b223babb0ea9edf
2018-06-14 14:54:27 -07:00
Chih-Hung Hsieh
30485c920c Use llvm-{objcopy,strip} when clang lld is used.
* Pass LLVM_{OBJCOPY,STRIP} to makefile rules.
* strip.sh is used only in soong-only mode.
  It will use llvm-strip and  and llvm-objcopy
  when --use-llvm-strip is given.
  Keep flags of strip.sh in alphabetic order.
* Tested build/soong/scripts/build-ndk-prebuilts.sh
  by adding "UseClangLld": true, to soong.variables file.

Bug: 80093681
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I612267304eea434c7a33cc086b27b577d5f64094
2018-06-07 16:04:14 -07:00
Dan Willemsen
fdb20d05bc Fix mac sdk build
Use the host platform "strip", and also expose "nm" and "otool" used for
toc.

Test: `m PRODUCT-sdk-sdk` on Mac
Change-Id: I7a6d127f479d3e563385ead46bc3a4b49b99776b
2018-06-03 16:19:56 -07:00
Elliott Hughes
314fddbfc6 Flounder's been dead so long it smells.
(And confuses people when it shows up in NDK build failures in 2018.)

Bug: N/A
Test: builds
Change-Id: Ie055b17d1c4bd7c8b73f10adcc7f7b784f9e9c91
2018-05-10 13:55:30 -07:00