Commit graph

6030 commits

Author SHA1 Message Date
Dan Willemsen
dde8cb9615 bpfix: Remove local_include_dirs if we remove the last entry
This still leaves a blank line in it's place, but that's a more general
problem.

Test: m blueprint_tools
Test: Run bpfix over AOSP, diff.
Change-Id: I55c1d1c183cfa49beeca07abd539348bc2524c5a
2018-05-07 13:32:09 -07:00
Colin Cross
028f42f002 Merge "Export lists of support libraries modules to Make" 2018-05-07 17:53:09 +00:00
yangbill
b3174d190e Build System: Fix rpath error if native executable under testcase folder.
error while loading shared libraries: libc++.so:
cannot open shared object file: No such file or directory

BUG: N/A
Test: make -j16 hello_world_test
      out/host/linux-x86/testcases/hello_world_test/x86_64/hello_world_test
      out/host/linux-x86/testcases/hello_world_test/x86/hello_world_test

Change-Id: I0ecb1955cd67295abe12fc19ab811fe046ac5f23
2018-05-07 07:46:16 +00:00
Jiyong Park
b674a5226a Prevent index out of range
I3487634f1ec5bb3b5b60d636b64461d391add35a is causing build breakages in
unbundled builds.

The stubs libs are disabled for unbundled builds, and thus we shouldn't
declare them as dist artifacts.

Bug: 605033
Test: make -j dist ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Change-Id: I3cd92e2cc6aeb48baf47d37780d8df2aa4756438
2018-05-06 07:56:17 +09:00
Dan Willemsen
75dec2291b Fix androidmk converting cc libraries
The java library rewrites should only happen for java modules, not cc
modules.

Test: Ran androidmk on a number of Android.mk files
Change-Id: Ife2cfb5a69d7db37216671f08317033b99fcd3a1
2018-05-05 13:06:40 -07:00
android-build-prod (mdb)
11f12db823 Merge "Stubs libs are dist artifacts" 2018-05-05 14:08:48 +00:00
Colin Cross
b2559a0224 Export lists of support libraries modules to Make
Make will use the list to sort support libraries into
LOCAL_STATIC_ANDROID_LIBRARIES and LOCAL_STATIC_JAVA_LIBRARIES
as appropriate.

Bug: 78300023
Test: m checkbuild
Change-Id: I58582b124f2b6a9b124683ddf8f5d77314f2e941
Merged-In: I58582b124f2b6a9b124683ddf8f5d77314f2e941
(cherry picked from commit ff8ab0745f)
2018-05-03 16:48:13 -07:00
Pirama Arumuga Nainar
470969df19 Merge "Update clang to r328903" 2018-05-03 14:55:21 +00:00
Colin Cross
93b4818201 Merge "Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES" 2018-05-02 21:51:10 +00:00
Colin Cross
66f78820e1 Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES
If a static android library lib1 has static_libs: ["lib2"] then the
R.class files for packages in lib2 will be merged into the jar for
lib1.  If an app has lib1 in its static_libs it will get the R.class
files from lib2 through lib1, instead of regenerating the R.java
files with numbering that matches the resource table of the app.

Pass transtive static android library dependencies on the aapt2
command line so that aapt2 will always regenerate the R.java
constants for those packages.

Also extract the packages that have R.java files after each aapt2
invocation.  This is not necessary for Soong, but is passed to
make to let it force regenerating the packages using
--extra-packages.

Bug: 78300023
Test: m checkbuild
Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee
2018-05-02 13:11:01 -07:00
Dan Willemsen
81759847b2 Add --kati_stats to cleanspec processing
So that we can see where the time is going. Also removes the obsolete
ASAN_OPTIONS, which moved to kati, but I forgot to update this instance.

Test: m nothing; check out/soong.log
Change-Id: I0c4066bad20fc2dc22b389f4c973d10dca554ee3
2018-05-02 17:44:36 +00:00
android-build-prod (mdb)
d08726ac76 Merge "Pass TARGET_DEVICE_DIR from dumpvars to later kati runs" 2018-05-02 17:35:34 +00:00
Jiyong Park
9007838c93 Stubs libs are dist artifacts
stubs libs from a java_sdk_library are automatically registered as dist
artifacts for sdk and win_sdk targets.

They are installed under $(DIST_DIR)/apistubs/<apiscope>/<name>.jar
where <apiscope> can be public, system and test.

Bug: 605033
Test: m -j
Test: choosecombo 1 sdk_phone_armv7 userdebug; m -j sdk dist
the stubs libs are found under out/dist/apistubs

Change-Id: I3487634f1ec5bb3b5b60d636b64461d391add35a
2018-05-02 19:33:45 +09:00
android-build-prod (mdb)
96bbc2ff22 Merge "Save list of AndroidProducts.mk files" 2018-05-02 08:27:24 +00:00
Dan Willemsen
6ab79db2e6 Pass TARGET_DEVICE_DIR from dumpvars to later kati runs
The find commands used to locate the BoardConfig.mk can't be optimized
by Kati, so we're currently spending ~125ms three times during every
build (dumpvars, cleanspec, and the main kati run). Preserve the value
of TARGET_DEVICE_DIR from the dumpvars run so that we only need to run
the find commands once.

Bug: 78020936
Test: out/build-taimen.ninja is identical
Test: out/soong.log shows that we're not running these finds again
Change-Id: Iee56b454c3661de2b58c161169218ecaf2135398
2018-05-02 00:06:28 -07:00
Dan Willemsen
567851c9cc Save list of AndroidProducts.mk files
Bug: 78020936
Test: diff out/.module_paths/AndroidProducts.mk.list with existing find
      results
Change-Id: Ie09cc18b926b21d6d24a4cfc570686aed2893e00
2018-05-01 22:57:53 -07:00
Jiyong Park
d126f7b52f Merge "Property api_srcs added for api-only source files" 2018-05-02 03:04:40 +00:00
android-build-prod (mdb)
b1a96e5ebf Merge "CompilerDeviceProperties are added to the sdk impl library" 2018-05-02 02:22:11 +00:00
Jiyong Park
baaf9dd5ab Property api_srcs added for api-only source files
New property api_srcs is added to java_sdk_library. The property is used
to specify set of source files that will be part of the API but not part
of the runtime library. Currently, this is only for the legacy http
library (org.apache.http.legacy) where some framework classes (such as
android.net.SslError which are compiled into framework.jar) are
registered as its API for historical reason.

Bug: 77575606
Test: m -j
Change-Id: I36d153f4815f8e4c939d5eeec632a38e7943b4b0
2018-05-02 02:13:44 +09:00
Dan Willemsen
ebfe33ad80 Remove more problematic env vars
I got a report of a user exporting CDPATH in their shell and causing
strange issues in the build. We should never need this value (and it
probably shouldn't be exported from the shell either -- that was their
workaround).

NDK_ROOT causes issues with Android.mk files thinking that they're
building with the ndk (like external/googletest/googletest/Android.mk).

Bug: 78933670
Test: CDPATH=. NDK_ROOT=test m; check out/soong.log
Change-Id: Icce43d7e31ed5e5e1fb7a4e37fd4dfbf421af4b1
2018-05-01 10:07:50 -07:00
Jiyong Park
441a47d1c9 CompilerDeviceProperties are added to the sdk impl library
java_sdk_library now accepts properties in CompilerDeviceProperties,
such as dex_preopt.profile. The properties are passed to the impl
library which is the device-specific sub-component of a
java_sdk_library.

Bug: 77575606
Test: m -j
Change-Id: I7303068bb62ca860352db306a5462fa4453ee80f
2018-05-02 01:25:10 +09:00
Jiyong Park
5a2c9d7a46 Add hidden_api_packages to java_sdk_library
hidden_api_packages is used to set packages that must be hidden from the
API. org.apache.http.legacy will be using this to exclude
references to com.android.okhttp from its API signatures.

Bug: 77575606
Test: m -j
Change-Id: Ic93c67cab96585638921dc922f175e545a68ead2
2018-05-01 22:25:41 +09:00
Anton Hansson
8959e149b7 Add some friendly error messages for java_sdk_library.
The stubs will always fail to build without at least these
three arguments. Give a clear error message when this happens
instead of failing further into the build.

Bug: 77575606
Test: make <x>.stubs for sdk_library "x" without these args
Change-Id: If3142ecc73d6428f7e3120788f8de64d56a777ad
2018-05-01 07:49:03 +01:00
android-build-prod (mdb)
b6ffb625eb Merge changes I9f68c887,Ic18f2dc5
* changes:
  Fix data race when ALLOW_MISSING_DEPENDENCIES=true
  Document glob patterns
2018-05-01 01:56:06 +00:00
android-build-prod (mdb)
1873f39223 Merge "Use and export proguard flags from static dependencies" 2018-05-01 01:07:24 +00:00
Colin Cross
d2343a331e Fix data race when ALLOW_MISSING_DEPENDENCIES=true
Missing dependencies were modifying a slice owned by a dependency,
which could cause a data race.  Return a copy instead.

Test: build with race detector enabled
Bug: 70706626
Change-Id: I9f68c887bee94348f3e11284c0833d2e04d62599
2018-04-30 16:19:31 -07:00
Colin Cross
645332d501 Document glob patterns
Bug: 71906438
Test: none
Change-Id: Ic18f2dc5d91b30ff2b5beb8047d98591ba70ee00
2018-04-30 16:19:31 -07:00
Colin Cross
89c31581a5 Use and export proguard flags from static dependencies
Export proguard flags from Android library modules, and use them
from static dependencies in Android apps when running proguard.
Also export them to Make.

Unlike Make, which concatentates all the exported flags from
dependencies, Soong dedups exported flags files.

Bug: 73724997
Test: m checkbuild
Change-Id: I8f86fecb09cbc591832ce67e8ecef551a6600349
2018-04-30 16:03:43 -07:00
Pirama Arumuga Nainar
d7feb380c1 Update clang to r328903
Bug: http://b/77532044

* b/77967848 - Disable -Wc++98-compat-extra-semi

Test: Test various targets in AOSP and internal branches.  For Googlers,
go/clang-r328903-testing

Change-Id: If08dafb9ad993fb686dfd6eeb5e2d61a9c99bd0b
2018-04-30 15:18:05 -07:00
Tri Vo
35a5143aee Expose selinux variables to Soong.
Bug: 33691272
Test: manual
Change-Id: I4a568fb25a36331afb2ca51c3d8a676c3aba09e1
2018-04-30 11:26:55 -07:00
Jiyong Park
df13054c2a java_sdk_library supports test as another API scope
For each java_sdk_library module, three (possibly different) stubs libs
are created.

*.stubs: public APIs only
*.system.stubs: public APIs + @SystemApi
*.test.stubs: public APIs + @TestApi

Depending on the sdk_version (or LOCAL_SDK_VERSION) of the calling
module, stubs lib of the corresponding api scope is linked.

Bug: 77575606
Test: m -j
Change-Id: I1437c64460914dbfc349dbc31d6f3ef090f541e3
2018-04-28 02:16:54 +09:00
Jiyong Park
5a8d1bee89 Add prebuilt_etc_xml
prebuilt_etc_xml installs an xml file to <partition>/etc[/<subdir>] and
validates the xml file against the given DTD file before installing it.

This change also includes some fixes for prebuilt_etc which is the super
module of prebuilt_etc_xml:

1) The module is changed to arch-specific module as the prebuilts are only
for devices (installed under the etc dir), but not for hosts.

2) Dependency to android.Prebuilt is removed because android.Prebuilt is
intended to be used for the case when a module can exist as prebuilts,
source or both. These prebuilt_etc_* modules are prebuilt only.

3) srcs property which accepts a list of source files is changed to src
that only accepts single source file, which makes more sense for
prebuilts.

Bug: 65686190
Test: m -j (xml_test.go)
Change-Id: I40484f3f6615b99f6b8d43176db0c40c5bfd838e
2018-04-28 00:13:00 +09:00
David Brazdil
aac4b84ce5 Merge "Add new Doclava flag support to soong" 2018-04-26 12:39:41 +00:00
android-build-prod (mdb)
6bcee9abff Merge "Fix incomplete LTO bug workaround." 2018-04-26 00:51:07 +00:00
android-build-prod (mdb)
eedc9484ab Merge "Don't use AppsDefaultVersionName for framework-res.apk" 2018-04-25 23:51:49 +00:00
Dan Albert
ea4b7b9ced Fix incomplete LTO bug workaround.
https://android-review.googlesource.com/c/platform/build/soong/+/641827
forgot this use of ClangTriple(), so static libraries aren't being
installed to the correct place.

Test: OUT_DIR=ndk-out DIST_DIR=ndk-dist \
    build/soong/scripts/build-ndk-prebuilts.sh && \
    ls ndk-out/soong/ndk/sysroot/usr/lib
Bug: None

Change-Id: I750ab198deff92aac06935d38d529b53030f9636
2018-04-25 16:05:30 -07:00
Colin Cross
402d5e0919 Don't use AppsDefaultVersionName for framework-res.apk
Some builds set AppsDefaultVersionName() to include the build
number ("P-123456").  aapt2 copies the version name of
framework-res into app manifests as compileSdkVersionCodename,
which confuses things if it contains the build number.  Use the
DefaultAppTargetSdk ("P") instead.

Bug: 78324052
Test: m TARGET_BUILD_WITH_APPS_VERSION_NAME=true Dialer
      aapt dump badging $OUT/system/priv-app/Dialer/Dialer.apk | grep compile
      shows compileSdkVersionCodename=P
Change-Id: If67f40aae1066d4ff3bf97da1b2de2e1e250ad9c
2018-04-25 15:09:20 -07:00
David Brazdil
aac0c3ca2e Add new Doclava flag support to soong
CL I8fe27e8c03334f9c90204db1e69447de65a06a38 adds new "-removedDexApi"
flag to Doclava. This patch adds support for that flag into Soong.
"droiddoc" targets can generate the new API file with property
"removed_dex_api_filename".

Bug: 78182899
Test: make
Change-Id: I04b8f615aa4655167b824d40c3fafa2648beec01
2018-04-25 10:12:40 +00:00
Logan Chien
43d34c38d8 Introduce runtime_libs to cc_binary and cc_library
This commit adds `runtime_libs` to cc_binary and cc_library.

Similar to the `required` property, if a module specifies the
`runtime_libs` properties and it is installed, then the modules
specified in `runtime_libs` will be installed as well.

Differnt from the `required` property, if a module is using VNDK and the
module names specified in `runtime_libs` are resolved to the modules
with both core and vendor variants, then '.vendor' will be appended to
those module names.

For example, if `libb` is vendor_available and `libd` is a vendor lib,
then LOCAL_REQUIRED_MODULES will contain `libb.vendor` (instead of
`libb`).

Bug: 72343507
Test: lunch aosp_arm64_ab-userdebug && make  # this runs the unit tests
Test: Create a vendor module with runtime_libs property to a
vendor_available shared library and check the generated Android.mk.

Change-Id: I9e245d80004dab597a5d3db5acd8a09117118db7
2018-04-25 14:47:50 +08:00
Chih-hung Hsieh
95ba30aa56 Merge "Disable LLD for Darwin host executables." 2018-04-25 06:30:54 +00:00
Chih-Hung Hsieh
e5ac609355 Disable LLD for Darwin host executables.
* See upstream status of lld for Mach-O at https://lld.llvm.org/AtomLLD.html

Bug: 73768157
Test: make checkbuild
Change-Id: I2e892193b6d75afd4358df8b2f674aa94888fb32
2018-04-24 18:07:16 -07:00
Nan Zhang
f9a34b667f Merge "Fix the undefined CommandDeps for standard Javadoc" 2018-04-24 23:00:37 +00:00
Colin Cross
9850f48dda Merge "Add pom2bp" 2018-04-24 22:28:28 +00:00
Treehugger Robot
c52e90eda3 Merge changes I083907ef,Ie8e0f97a
* changes:
  Add pom2mk -exclude
  Add pom2mk -regen
2018-04-24 21:44:13 +00:00
Colin Cross
70dd38f09e Add pom2bp
Convert pom2mk to pom2bp that writes out Android.bp files instead
of Android.mk files.  pom2mk stays for now until the last users
of it are cleaned up.

Bug: 78300023
Test: cd prebuilts/sdk/current/support && pom2bp -regen Android.mk
Change-Id: I584d63c4228bad32f9e1914b06bde807078d6a55
2018-04-24 13:37:38 -07:00
Nan Zhang
30963749fd Fix the undefined CommandDeps for standard Javadoc
When compiling against without customized doclet, Javadoc doesn't need
to depend on Doclava and Jsilver jars. Originally, we leave these two
jars empty in Args so that CommandDeps won't have these two
dependencies. But Ninja doesn't like that with errors:

ninja: error: build.ninja: empty path
because $Jsilver and $Doclava is undefined when compiling Javadoc.

Test: m -j platform_library-docs
Bug: b/70351683
Change-Id: I02fee181490f91e87a1feac74f3a69b5b4acb528
2018-04-24 13:23:04 -07:00
Treehugger Robot
2782ca4102 Merge "Add support for generating Compdb file" 2018-04-24 17:07:42 +00:00
Alex Light
ec868fc42a Add support for generating Compdb file
Some tools (i.e. you-complete-me) make use of a 'compdb' file
(compile_commands.json) that records (among other things) the
arguments needed to compile a file. These tools can use this with
libclang to provide semantic completions and perform other IDE
actions. This CL adds support for soong to generate a (simple)
compile_commands.json file.

Test: make SOONG_GEN_COMPDB=1 SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
      examine $ANDROID_BUILD_TOP/compile_commands.json

Change-Id: I751bb344b90dfcdad1dfd71c2a85bacd345f0464
2018-04-24 08:15:02 -07:00
Jiyong Park
82484c0771 Additional fixes for java_sdk_library
This change fixes several problems found while re-defining some libs
using java_sdk_library module type.

1) A phony module whose name is the same as the java_sdk_library name is
defined. It is used to support installing the runtime library via
PRODUCT_PACKAGES (even when there is no dependency from other modules).

2) A bug that package names whose depth is >= 2 is ignored in
droiddoc.srcs_lib_whitelist_pkgs is fixed. A package name foo.bar.baz is
now converted to a path foo/bar/baz following the Java convention.

3) A make variable JAVA_SDK_LIBRARIES that is the list of java_sdk_library
module names is exported to make. This can be used to distinguish SDK
libraries from ordinary libs.

4) When running doclava, some framework sources in the 'android' package
and the same packages as the SDK library are automatically added to the
sources list. This is required for the case when API class is extending
from the framework class. In that case, doclava needs to know whether
the base class is hidde nor not. Since that visibility info is encoded
as @hide string in the comment, we need source files for the classes,
not the compiled ones. Also there are rare cases where part of SDK
library is implemented in the framework (e.g. org.apache.http.legacy).
In that case, we need framework source to make API stubs, though the
sources are not required to build the runtime library.

5) The stubs libs are disabled for PDK builds as well.

Bug: 77575606
Test: m -j

Change-Id: I360cf15fe5339e46644fb16d0dabe2548aa315f9
2018-04-24 09:47:50 +09:00
Treehugger Robot
0d12ebce88 Merge "Revert "Support coverage instrumentation for Linux host"" 2018-04-24 00:12:05 +00:00