Commit graph

579 commits

Author SHA1 Message Date
Treehugger Robot
845f655011 Merge "Add __ANDROID_SDK_VERSION__=<ver> macro" 2020-03-13 09:45:10 +00:00
Paul Duffin
0cb37b9ce1 Disable installation for sdk snapshot versioned prebuilts
The sdk snapshot creates two prebuilts for each member one that is
versioned and one that is not. If they are both installed then they
lead to duplicate rules in make for creating the same installed file.

This change adds an installable property to cc modules that will
prevent the installation of the file and then adds installable: false
on the versioned prebuilt for cc modules.

Bug: 142935992
Test: m nothing
Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
2020-03-11 18:31:45 +00:00
Jooyung Han
ccce2f2c23 Add __ANDROID_SDK_VERSION__=<ver> macro
sdk_version is passed for relevant variants.
If not specified or "current",
it maps to "10000" for platform variants, and
"min_sdk_version" of the apex for apex variants.

Bug: 150860940
Test: m (soong test)
      manually check build.ninja
Change-Id: I5102ab0c5086b5ad29d16ac45af55d32062167b4
2020-03-09 10:46:46 +09:00
Jooyung Han
03b5185b88 apex: choose stub according to min_sdk_version
Native modules within APEX should be linked with proper stub version
according to its min_sdk_version.

For example, when min_sdk_version is set to "29", libfoo in the apex
would be linked to libbar of version 29 from platform, even if it has
a newer version like 30.

Bug: 145796956
Test: m nothing (soong tests)
Change-Id: I4a0b2002587bc24b7deeb5d59b6eeba5e1db5b1f
2020-03-07 03:12:45 +09:00
Treehugger Robot
c6d627b268 Merge "Capture snapshot headers in parallel" 2020-03-05 00:03:00 +00:00
Inseob Kim
eda2e9c728 Capture snapshot headers in parallel
VNDK and vendor snapshot singleton work in a single thread, so globbing
in singleton results in ridiculus running time. Moving codes to
GenerateAndroidBuildActions to reduce running time.

Bug: 150406226
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: vendorSnapshotSingleton build time became 0.56s (from 10s)
Test: build.ninja building time became 1m11s (from 1m21s)
Change-Id: I4a081eef5847c62ca00280ca426f5b4e10f87b59
2020-03-04 23:39:42 +09:00
Justin Yun
0ecf0b223f Enable vndk-ext for product variants
To build vndk-ext for product variants use `vndk.extends` property
with `product_specific: true` as for the vndk-ext for vendor
variants. For example:
cc_library {
    name: "libvndk_ext_product",
    product_specific: true,
    vndk: {
        enabled: true,
        extends: "libvndk",
    },
}

It will install the vndk-ext libs for product variants in
product/lib[64]/vndk/

Test: m nothing
Bug: 147778025
Change-Id: If1ee5be93c579abad302f44f18e6316f27e70019
2020-03-04 01:22:16 +00:00
Jiyong Park
323a4c3ab3 Runtime deps to a stubs lib crosses APEX boundary
When there is a runtime depedency (via runtime_libs property) to a
library providing stable C APIs, the dependency is considered as
crossing APEX boundary. Therefore, the requested lib doesn't need to be
made available to the APEX where the requesting lib is in.

Bug: 147813447
Test: m
Change-Id: I9cf8a5877850fb85b92c851e15fac921b8b7641b
2020-03-01 17:29:06 +09:00
Peter Collingbourne
d8b80bc683 Merge "Statically link the unwinder into binaries packaged into an unbundled APEX with legacy_android10_support: true." 2020-02-18 18:12:37 +00:00
Peter Collingbourne
dc4f986b2a Statically link the unwinder into binaries packaged into an unbundled APEX with legacy_android10_support: true.
Bug: 149075752
Test: tapas com.android.conscrypt com.android.tethering arm64
Test: m out/target/product/generic_arm64/{,symbols/}apex/com.android.{tethering,conscrypt}/lib64/libc++.so
Test: Verified that unwinder was dynamically linked to tethering's
Test: libc++ and statically linked to conscrypt's.
Test: lunch flame-userdebug && m
Test: Verified that unwinder was dynamically linked to /system/lib64/libc++.so
Change-Id: I98eed7cb4316962b19b5c12e150c224c25d0e91d
2020-02-13 22:29:44 -08:00
Ivan Lozano
8107b85189 Remove execute-only support.
With kernel support being removed for execute-only memory layouts,
remove support for XOM until there's kernel support again.

This allows us to gain the code-size improvements from
"-z noseparate-code".

Bug: 147300048
Test: Compiled binaries no longer marked XOM by default.
Change-Id: Ie84bdd2ca025e8b14867008291bf9ce143b5e999
2020-02-13 13:50:34 -05:00
Treehugger Robot
f048446f92 Merge "Add vendor snapshot modules" 2020-02-13 11:01:10 +00:00
Jiyong Park
2bb26d3fad Merge "<apex_name>-deps-info correctly tracks dependencies" 2020-02-12 00:47:21 +00:00
Treehugger Robot
705cd4600d Merge "Implement vendor snapshot" 2020-02-10 23:40:50 +00:00
Jiyong Park
678c881a4f <apex_name>-deps-info correctly tracks dependencies
The APEX dependency is more correctly tracked. Previously, the
dependency was tracked while we gather modules that will be installed to
an APEX. This actually was incorrect because we skipped many dependency
types that we don't need to follow to gather the modules list, such as
the headers dependency.

Now, the dependency is tracked directly when a module is mutated for an
APEX. In other words, if a module is mutated for an apex X, then the
module will appear in the X-deps-into.txt file.

This change also changes the format of the txt file. It now clearly
shows why a module is included in the APEX by showing the list of
modules that depend on the module.

Bug: 146323213
Test: m
Change-Id: I0a70cf9cce56e36565f9d55683fdaace8748a081
2020-02-07 18:53:12 +09:00
Jiyong Park
1fd192302c Merge changes from topic "apex_available"
* changes:
  shared_lib dependency from a static lib crosses the APEX boundary
  apex_available tracks static dependencies
2020-02-06 22:56:08 +00:00
Inseob Kim
eec88e1de8 Add vendor snapshot modules
This implements four modules (static/shared/header libraries, and
binaries) for vendor snapshot. These modules will override source
modules if BOARD_VNDK_VERSION != current.

Bug: 65377115
Test: 1) VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: 2) install snapshot under source tree
Test: 3) set BOARD_VNDK_VERSION and boot cuttlefish
Change-Id: I24ddb4c3aa6abeab60bbfd31bcbd8753e2592dc5
2020-02-07 02:59:24 +09:00
Inseob Kim
8471cdaced Implement vendor snapshot
Vendor snapshot can be captured with "m dist vendor-snapshot". With
vendor snapshot and vndk snapshot, older version of /vendor and newer
version of /system will be able to be built together by setting
BOARD_VNDK_VERSION to past vendor's version.

Only vendor modules under AOSP are to be captured. In detail, modules
under following directories are ignored:
- device/
- vendor/
- hardware/, except for interfaces/, libhardware/, libhardware_legacy/,
  and ril/

Test modules (cc_test, etc.) and sanitized modules are also ignored.

Bug: 65377115
Test: m dist vendor-snapshot
Change-Id: If7a2f6de7f36deee936930c0ccf7c47c4a0cebf6
2020-02-07 02:58:29 +09:00
Jiyong Park
d7536ba58d shared_lib dependency from a static lib crosses the APEX boundary
cc_library_static {
    name: "libfoo",
    shared_libs: ["libbar"],
}

cc_library {
   name: "libbar",
}

If libfoo is part of an APEX, then libbar is no longer considered as a
member of the APEX, because it isn't actually linked to libfoo.

To distinguish such a shared lib dependency from a static library from a
shared lib dependency from a shared library, a new dep type
SharedFromStaticDepTag is introduced. It is treated exactly the same as
SharedDepTag, except when we determine whether a dependency is crossing
the APEX boundary or not.

This allows us to check the apex_available property more correctly.
Previously, modules were incorrectly considered as being used for an
APEX due to the shared lib dependency from a static lib.

As a good side effect, this also reduces the number of APEX variants.
Specifically, on aosp_arm64, the number of the generated modules were
reduced from 44745 to 44180.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 147671264
Test: m

Merged-In: I899ccb9eae1574effef77ca1bc3a0df145983861
(cherry picked from commit 931b676a69)
Change-Id: I899ccb9eae1574effef77ca1bc3a0df145983861
2020-02-06 14:45:43 +09:00
Jiyong Park
0f80c1848a apex_available tracks static dependencies
This change fixes a bug that apex_available is not enforced for static
dependencies. For example, a module with 'apex_available:
["//apex_available:platform"]' was able to be statically linked to any
APEX. This was happening because the check was done on the modules that
are actually installed to an APEX. Static dependencies of the modules
were not counted as they are not installed to the APEX as files.

Fixing this bug by doing the check by traversing the tree in the method
checkApexAvailability.

This change includes a few number of related changes:

1) DepIsInSameApex implementation for cc.Module was changed as well.
Previuosly, it returned false only when the dependency is actually a
stub variant of a lib. Now, it returns false when the dependency has one
or more stub variants. To understand why, we need to recall that when
there is a dependency to a lib having stubs, we actually create two
dependencies: to the non-stub variant and to the stub variant during the
DepsMutator phase. And later in the build action generation phase, we
choose one of them depending on the context. Also recall that an APEX
variant is created only when DepIsInSameApex returns true. Given these,
with the previous implementatin of DepIsInSameApex, we did create apex
variants of the non-stub variant of the dependency, while not creating
the apex variant for the stub variant. This is not right; we needlessly
created the apex variant. The extra apex variant has caused no harm so
far, but since the apex_available check became more correct, it actually
breaks the build. To fix the issue, we stop creating the APEX variant
both for non-stub and stub variants.

2) platform variant is created regardless of the apex_available value.
This is required for the case when a library X that provides stub is in
an APEX A and is configured to be available only for A. In that case,
libs in other APEX can't use the stub library since the stub library is
mutated only for apex A. By creating the platform variant for the stub
library, it can be used from outside as the default dependency variation
is set to the platform variant when creating the APEX variations.

3) The ApexAvailableWhitelist is added with the dependencies that were
revealed with this change.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 147671264
Test: m

Merged-In: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
(cherry picked from commit fa89944c79)
Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
2020-02-06 14:45:08 +09:00
Nicolas Geoffray
0b78766fbc Support missing a shared library variant.
When SOONG_ALLOW_MISSING_DEPENDENCIES is set, it should be OK to miss
shared library variants.

Test: master-art manifest, use bionic stubs
Bug: 142935992
Change-Id: Ie0054acfef7c4406594a87378a7029380a9fda50
2020-02-04 18:27:55 +00:00
Yifan Hong
1b3348d50a Add ramdisk image.
It is similar to recovery image.
Test: m nothing -j

Change-Id: I11389777c6bfb0c0d73bbb4c70091c1e70f44077
2020-01-22 16:54:18 -08:00
Hsin-Yi Chen
d2451683d9 Do not create ABI dumps for NDK stub libraries
Some NDK stub libraries are tagged with "LLNDK" in lsdump_paths.txt
because they are not in NDK, and their base module names are in LLNDK.
This commit excludes those NDK stub libraries from lsdump path list.

Test: make findlsdumps
Bug: 147409497
Change-Id: I7a72758ba40d5f5bda8c436dd0b22e5efda03a32
2020-01-17 14:07:32 +08:00
Jiyong Park
83dc74b770 Reland^2 "m <apex_name>-deps-info prints the internal/external deps of the APEX"
This reverts commit 7cb4d378e7.

Test: m
Test: ALLOW_MISSING_DEPENDENCIES=true DIST_DIR=out/dist ./art/tools/dist_linux_bionic.sh -j80 com.android.art.host
(in the master-art-host branch)

Change-Id: I9beca73aafdf42f03bfa19cf1634b2641dac417b
2020-01-14 18:40:56 +09:00
Jiyong Park
a7503367cf Merge "Revert "Reland "m <apex_name>-deps-info prints the internal/external deps of the APEX"""" 2020-01-14 08:58:17 +00:00
Jiyong Park
7cb4d378e7 Revert "Reland "m <apex_name>-deps-info prints the internal/external deps of the APEX"""
This reverts commit 956305c61c.

Reason for revert: broke master-art-host branch
Exempt-From-Owner-Approval: reverting a bad change

Change-Id: Id7faed4ee85328c7c65847a3543ea9e67a3d50b3
2020-01-14 08:58:02 +00:00
Treehugger Robot
17c51a4ff6 Merge "Reland "m <apex_name>-deps-info prints the internal/external deps of the APEX""" 2020-01-14 02:40:42 +00:00
Jiyong Park
956305c61c Reland "m <apex_name>-deps-info prints the internal/external deps of the APEX""
This reverts commit 4513f703f9.

Bug: 1190898
Test: m
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true NATIVE_COVERAGE=true  m dist

Change-Id: I50fdccabb43e4751694db83ee451d388657257e0
2020-01-09 18:42:27 +09:00
Jiyong Park
fe9a43002e A test cc module is installable even if it's not available for platform
This change fixes a bug that test modules (cc_test or its sub types) are
unconditionally considered as non-installable if they are configured to
not available for platform. The rationale behind the decision was that
an APEX variant of a module doesn't need to be installed to the device
because the variant will anyway be included in the APEX. However, it's
wrong for test modules. They are not included in the APEX, but should be
installed to /data/nativetest*.

One might think that we need to make the tests available for the
platform (i.e. apex_available: ["//apex_available:platform"]). This
however doesn't work if the libraries that the tests should link against
are configured to be not available for the platform, which currently is
the case for the ART tests.

Bug: 146995717
Test: m
Change-Id: I51843f5b4ea0a418c64c63784347231590cd3c35
2020-01-09 13:20:34 +09:00
Jiyong Park
4513f703f9 Revert "m <apex_name>-deps-info prints the internal/external deps of the APEX"
This reverts commit 114ff53f5e.

Reason for revert: broke cf_x86_phone-userdebug_coverage 

Change-Id: I7221fd0b0baee5407a7322240c170aef8e549e4d
2020-01-09 02:05:18 +00:00
Jiyong Park
114ff53f5e m <apex_name>-deps-info prints the internal/external deps of the APEX
We need to have a way to see the list of modules that directly or
indirectly contribute to an APEX. People find it difficult to determine
whether a module is included in which APEXes because APEX tracks
indirect dependencies as well as direct dependencies. Therefore, just
looking at Android.bp for the APEX itself doesn't give the answer.

This change adds a new make target <apex_name>-deps-info, which
generates out/soong/<apex_name>-deps-info.txt file that shows the
internal and external dependencies of the said APEX.
Here, internal means the dependencies are actually part of the
APEX, while external means the dependencies are still external to the
APEX.

Bug: 146323213
Test: m (apex_test amended)
Change-Id: I33d1ccf5d1ca335d71cd6ced0f5f66b8c3886d13
2020-01-02 09:41:30 +09:00
bralee
5a5cce695f AIDEGen: collect cc_srcs and cc related flags in module_bp_cc_deps.json
Define a field CCSrcs and other cc related flags in a type ccIdeInfo
struct and write them into out/soong/module_bp_cc_deps.json. AIDEGen
can use these data to generate CMakeLists.txt by Python for multiple
native projects in CLion IDE.

Bug: 141512319

Test: 1. export SOONG_COLLECT_JAVA_DEPS=false SOONG_COLLECT_CC_DEPS=true;m nothing
         check
	 1). File out/soong/module_bp_cc_deps.json is generated.
	 2). In "JniInvocation_test" module: "path", "srcs",
	     "global_common_flags", "local_common_flags",
	     "global_c_flags", "local_c_flags", "global_c_conly_flags",
	     "local_c_conly_flags", "global_cpp_flags",
	     "local_cpp_flags" and "system_include_flags"
	     have been created.

Change-Id: I9292cc6373157ba68f013998a7364f84a70d5593
2019-12-30 09:35:40 +08:00
Treehugger Robot
727173ecca Merge "Create product variant for product partition" 2019-12-21 00:56:45 +00:00
Paul Duffin
a0843f6a6f Differentiate between cc library and binary
The cc library and cc binary (and other cc module types) are all
instances of cc.Module. So, to differentiate between them and make
sure that only appropriate library instances can be added to
native_shared/static_libs this adds a special sdkMemberTypes field to
Module which if set specifies the SdkMemberTypes the module supports.
If it is not set then the module type cannot be used in the sdk at all.

Corrects an issue with one of the tests where a prebuilt cc
library was added to the sdk instead of a source cc library.

Adds a new test to ensure that cc_library_(shared|static)_host module
types work with the sdk as well and another test to ensure that
cc_library can be used as either.

Bug: 142918168
Test: m checkbuild
Change-Id: I359cdbdd15328ca571f276d2b6ce9a229ebb2c86
2019-12-20 15:45:17 +00:00
Justin Yun
5f7f7e8a39 Create product variant for product partition
When PRODUCT_PRODUCT_VNDK_VERSION is set to 'current', product
modules are enforced to use only VNDK libs from the system partition
as BOARD_VNDK_VERSION does to vendor partition.

Modules with 'vendor_available: true' create product variant as well
as core and vendor variants. The product variant as an image variant
is used for the modules in /product or /system/product.

It must not affect the current build behavior without
PRODUCT_PRODUCT_VNDK_VERSION set.

Bug: 134099726
Bug: 138966004
Bug: 144534640
Test: build without PRODUCT_PRODUCT_VNDK_VERSION set
Change-Id: I4d3585c110d84493e45bf76d550dc240bb26137f
2019-12-20 17:56:08 +09:00
Paul Duffin
036e7001ae Dedup cc build components registration
Effectively adds the cc_defaults module type to the set that are
registered for tests that rely on cc default deps so needed to remove
a few references of that.

Test: m checkbuild
Bug: 146540677
Change-Id: I9df3d33a0cf3f6b22d270efed8366d0183eccaec
2019-12-19 19:19:40 +00:00
Treehugger Robot
0cbb31e9e7 Merge "Create public stub for platform's sysprop_library" 2019-12-19 03:23:01 +00:00
Inseob Kim
ac1e986c55 Create public stub for platform's sysprop_library
Java modules using SystemAPI can now link against platform owned
sysprop_library with public stub. This allows modules to use platform's
public sysprops (which should be regarded as an API) without any hidden
API usages, if using dynamic linking and boot class path.

This doesn't affect any vendor or odm owned sysprop_library.

Bug: 141246285
Bug: 145167888
Test: m
Change-Id: I99824fb24a75cc8282211c2ad6c6296ae9fca393
2019-12-19 09:35:23 +09:00
Peter Collingbourne
ddd27246ee Merge "Reland "Also package recursive jni_libs deps of android_apps as well as direct deps." with bug fix." 2019-12-18 23:29:58 +00:00
Colin Cross
83bead469b Don't create native bridge variants of vendor modules
The logic in cc.Module.ImageMutatorBegin() to skip creating vendor
variants for native bridge modules stopped working when the image
mutator was moved before the arch mutator because the native
bridge variant hadn't been created yet.  Move the logic to the arch
mutator to avoid creating native bridge variants for vendor variants.

Fixes: 146486214
Test: lunch aosp_cf_x86_pasan-userdebug && m SANITIZE_TARGET=address
Change-Id: I46cff4905f929c9989d005f0ceb01388d47323c1
2019-12-18 10:45:46 -08:00
Peter Collingbourne
ad84f975d2 Reland "Also package recursive jni_libs deps of android_apps as well as direct deps." with bug fix.
This time, exclude NDK libraries instead of LLNDK libraries from the
package. This is necessary because there are libraries such as libvndksupport
which are LLNDK but are not accessible to apps.

Original commit message:
> Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
> (e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
> recursive library dependencies, including for example libc++ when depending
> on the platform libc++. This means unnecessary churn when we add a new
> dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
> jni_libs clauses to be simplified, make the build system search for the
> recursive dependencies and automatically include them.
>
> This change allows us to remove code that was previously adding NDK libc++
> as a special case, as it is now covered by the generic code.
>
> Also fix some improper quoting that was exposed as a result of this change
> causing more files to be packaged than before.
>
> [1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Test: atest CtsAppOpsTestCases
Test: atest FrameworksNetSmokeTests
Change-Id: I8311ede0b44d7e50b9f272912ead8ef07e82b074
2019-12-17 16:55:20 -08:00
Lorenzo Colitti
2973c1106f Revert "Also package recursive jni_libs deps of android_apps as well as direct deps."
This reverts commit 6f907ad3dd.

Reason for revert: Broke FrameworksNetSmokeTests

Bug: 146456945
Change-Id: Ibef7bb80c532e70cfcfb974f51a99ed25437a343
2019-12-18 00:15:07 +00:00
Colin Cross
fb0c16e95a Move imageMutator before archMutator
Run the imageMutator between osMutator and archMutator so that
different arch variants can be set for the different partitions.

Bug: 142286466
Test: m checkbuild
Change-Id: I65d05714b75aa462bf9816da60fdc2deda4de593
Merged-In: I65d05714b75aa462bf9816da60fdc2deda4de593
(cherry picked from commit 9c8f687584)
2019-12-17 14:45:11 -08:00
Peter Collingbourne
6f907ad3dd Also package recursive jni_libs deps of android_apps as well as direct deps.
Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
(e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
recursive library dependencies, including for example libc++ when depending
on the platform libc++. This means unnecessary churn when we add a new
dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
jni_libs clauses to be simplified, make the build system search for the
recursive dependencies and automatically include them.

This change allows us to remove code that was previously adding NDK libc++
as a special case, as it is now covered by the generic code.

Also fix some improper quoting that was exposed as a result of this change
causing more files to be packaged than before.

[1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Change-Id: I3d6fbcce75bc108a982eb7483992a4b202056339
2019-12-16 15:20:09 -08:00
Treehugger Robot
cf96a82fbd Merge "Expose some factories for aidl_test.go" 2019-12-13 05:51:38 +00:00
Logan Chien
e87dae6083 Merge "Run ABI checks for shared libs exported by APEX" 2019-12-10 17:36:55 +00:00
Jooyung Han
b90e491e2b Expose some factories for aidl_test.go
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
2019-12-09 18:21:48 +09:00
Inseob Kim
d110f878a7 Fix generated headers of snapshot
For VNDK snapshot and SDK snapshot, deps files have been used to capture
generated headers. But exported deps might contain intermediate phony
files instead of actual header files, which are for optimization of
ninja. To correctly capture all headers, exported generated header files
are gathered separately.

Bug: 65377115
Test: m nothing
Change-Id: Ia03fa69186490a818578190e3c0bfb0261d1fd6e
2019-12-09 12:38:34 +09:00
Colin Cross
ae6c5207cc Move ImageMutator after archMutator
Move the ImageMutator to be registered just after the archMutator
in preparation for moving it between osMutator and archMutator.
Requries updating variants in a few tests that now run the
ImageMutator.

Bug: 142286466
Test: no change to build.ninja
Test: all soong tests
Change-Id: Ia9d2a7bc0e225bedec3c9a83ea04f471a931bf47
2019-12-06 12:37:14 -08:00
Logan Chien
e274fc9892 Run ABI checks for shared libs exported by APEX
This commit enables ABI checks for shared libs exported by APEX and
explicitly enabled ABI checks.

Bug: 145608479
Test: m com.android.resolv
Change-Id: I3b58178b0258df35fcc848e84642152516f6774f
2019-12-04 15:26:37 +00:00
Jiyong Park
3814f4df2b apex_available is defaultable
Previously, it was defaultable only for cc_library. Now, it is
defaultable for all module types.

Bug: 128708192
Test: m
Change-Id: If248f593da6f4b724bf889ccd7f2e077d48069b5
2019-12-02 13:48:33 +09:00
Colin Cross
09ef474b6f Merge changes I0dcc9c7b,I9bc40642
* changes:
  Move cc.imageMutator into the android package
  Make CreateVariations return []android.Module
2019-11-25 22:30:17 +00:00
Ivan Lozano
3bc70db398 Merge "Allow cc.LinkabeInterfaces to request "" variants." 2019-11-22 00:24:23 +00:00
Ivan Lozano
2b26297dc7 Allow cc.LinkabeInterfaces to request "" variants.
cc.LinkableInterfaces should be able to request if an empty variant is
required from the LinkageMutator. We were previously assuming that if only
static or shared libraries were being built, then we didn't need the
empty variant. However this should be explicit to handle cases where the
default set of variants being created may not include both static and
shared libraries.

Bug: 144861059
Test: m -j crosvm.experimental
Change-Id: I66724bdc16ff350b06dfa4d049c82f33019979a5
2019-11-21 13:25:08 -08:00
Colin Cross
7228ecd5e3 Move cc.imageMutator into the android package
Prepare for making the image mutator available to all modules and
moving it between the os and arch mutators by moving it into the
android package and using an interface implemented by the module
types to control it.

Bug: 142286466
Test: No unexpected changes to out/soong/build.ninja
Change-Id: I0dcc9c7b5ec80edffade340c367f6ae4da34151b
2019-11-20 15:21:32 -08:00
Martin Stjernholm
203489b321 Reland "Recognize libdl_android as a Bionic library".
Necessary to create the symlinks from /system/lib{,64} to the Runtime APEX.

Test: build & boot
Bug: 135753770
Bug: 144343305
Change-Id: I221bed87a85f18c927ba44ee75b7db75316c1f49
2019-11-19 16:35:47 +00:00
Ivan Lozano
36396b26ef Merge "Allow cc modules to pull in rust includes." 2019-11-15 02:32:26 +00:00
Ivan Lozano
e0833b1f5c Allow cc modules to pull in rust includes.
Make sure LinkabeInterfaces can export include dirs to cc modules. This
fixes the Rust implementation and makes sure these are pulled in for cc
modules.

Bug: 144052093
Test: cc module depending on a rust library includes dirs correctly.
Change-Id: I6b5d5e6ab6afb507178b4f2cbdc45f01031dbfe4
2019-11-14 07:23:26 -08:00
Jooyung Han
18020eabc4 make ApexProperties defaultable
ApexPropreties are added in InitApexModule() and they are supposed to be
defaultable. To be defaultable, InitApexModule() should be called before
InitDefaultableModule().

Bug: 144332048
Test: m (soong test added)
Change-Id: I6c90ed3b66a086292a4c0ecb37c61f83769e62bd
2019-11-13 05:52:57 +00:00
Martin Stjernholm
3980ced987 Merge "Revert submission of topic 'libdl_android-in-apex'" 2019-11-08 11:51:39 +00:00
Colin Cross
1f38237c12 Merge changes from topic "reorder-cflags"
* changes:
  Reorder local and global flags
  Split local and global cflags
2019-11-08 05:07:34 +00:00
Treehugger Robot
d0a4878b49 Merge "SDK snapshot is dist'ed" 2019-11-08 00:45:50 +00:00
Colin Cross
4af21ed26f Split local and global cflags
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
2019-11-07 15:27:58 -08:00
Yuexi Ma
31f36fbbd1 Revert submission of topic 'libdl_android-in-apex'
Reason for revert: broke numerous major apps in app compat testing
Bug: 144100240

Change-Id: I4b43b92963815dfd95a221fb3f560505e9799950
2019-11-07 19:19:54 +00:00
Jiyong Park
232e785b98 SDK snapshot is dist'ed
`m module_sdk dist` produces snapshots of all SDKs in the source tree.
A snapshot is a zip file consists of Android.bp, exported headers,
exported AIDL files, stubs for native libs and jars. The zip file is
expected to be downloaded from the build server and extracted to a
directory (which probably will be
/prebuilts/module_sdks/<module_name>/current).

Bug: 138182343
Test: m (sdk_test.go updated)

Change-Id: Idbe4bc24795fe08f26fc1cf7497028f9d162053a
2019-11-07 12:24:48 +09:00
Martin Stjernholm
f4ed8df84d Recognize libdl_android as a Bionic library.
Necessary to create the symlinks from /system/lib{,64} to the Runtime APEX.

Test: build & boot
Bug: 135753770
Change-Id: I231b4ec48869843de233ebb7c2e4fc5a49e7288a
2019-11-06 00:22:37 +00:00
Inseob Kim
bc093672ed Fix vendor variants generation of vndk
Current routine to check whether BOARD_VNDK_VERSION variant is created
or not is not correct, because only non-VNDK modules are installed in
/vendor. Thus, BOARD_VNDK_VERSION variants should only be created with
non-VNDK modules.

Bug: N/A
Test: m nothing
Change-Id: I2ee7821fce407214ac6be4f4b6d62483c907971f
2019-11-01 13:28:59 +09:00
Jooyung Han
7acbfc033d Merge "Soong generates vndk-related .libraries.txt files" 2019-11-01 01:57:50 +00:00
Treehugger Robot
40dfbe3a16 Merge "native shared libs in an SDK can be snapshotted" 2019-11-01 01:23:35 +00:00
Jooyung Han
0302a84ddc Soong generates vndk-related .libraries.txt files
This is a follow-up CL of I9a24f6975bd4b226a94f61a13d43857dcdce6b88

Generated files are passed to make via MakeVars:
- SOONG_LLNDK_LIBRARIES_FILE
- SOONG_VNDKCORE_LIBRARIES_FILE
- SOONG_VNDKSP_LIBRARIES_FILE
- SOONG_VNDKPRIVATE_LIBRARIES_FILE
- SOONG_VNDKCOREVARIANT_LIBRARIES_FILE
- SOONG_VNDK_LIBRARIES_FILE

Previously filenames were "guessed" from module names. Now VndkMutator
stores filenames as well and generate those files with them.

Bug: 142963962
Bug: 141450808
Test: m && device boots && TH
Change-Id: I0c248b707188f904df60ead50059fefe90bfd17f
2019-11-01 04:35:21 +09:00
Ivan Lozano
52767be335 Add support for Rust C libraries.
Adds the ability for rust modules to be compiled as C libraries, and
allows cc modules to depend on these rust-generated modules. This also
means that soong-rust should not have any dependencies on soong-cc aside
from what's required for testing.

There's a couple small fixes included as well:

 - A bug in libNameFromFilePath that caused issues when library's had
 "lib" in their name.
 - VariantName is removed from rust library MutatedProperties since this
 was unused.

Bug: 140726209
Test: Soong tests pass.
Test: Example cc_binary can include a rust shared library as a dep.
Test: m crosvm.experimental
Change-Id: Ia7deed1345d2423001089014cc65ce7934123da4
2019-10-28 22:09:01 -07:00
Jiyong Park
73c54ee7fe native shared libs in an SDK can be snapshotted
The snapshot script can now handle native shared libs in an SDK.

Bug: 138182343
Test: create following sdk module:
sdk {
    name: "mysdk",
    native_shared_libs: ["libc", "libdl"],
}
, then execute `m mysdk` and execute the update_prebuilt-1.sh as
prompted. Following directories are generated under the directory where
mysdk is defined at:

1
├── aidl
├── Android.bp
├── arm64
│   ├── include
│   ├── include_gen
│   └── lib
│       ├── libc.so
│       └── libdl.so
├── include
│   └── bionic
│       └── libc
│           └── include
│               ├── alloca.h
│               ├── android
│               │   ├── api-level.h
<omitted>

Change-Id: Ia1dcc5564c1cd17c6ccf441d06d5995af55db9ee
2019-10-29 12:27:35 +09:00
Ivan Lozano
183a3218e2 Add a common interface for cc linkable libraries.
Adds an interface, CcLinkableInterface, for cc linkable dependencies
which come from other toolchains such as Rust.

Bug: 140726209
Test: Soong tests pass, rust modules still compile.
Change-Id: I7378a46fad94fd0b735746aaf4e265fd2c2c04d8
2019-10-28 13:45:12 -07:00
Treehugger Robot
b480debbd8 Merge "Change exportedDirs and exportedSystemDirs from []string to android.Paths" 2019-10-28 02:24:41 +00:00
Treehugger Robot
7d6b21c265 Merge "Soong generates libraries.txt files for vndk" 2019-10-26 01:52:39 +00:00
Jooyung Han
097087be53 Soong generates libraries.txt files for vndk
These files were generated by Make. This is an effort to converting make
to soong.

These files are created under a known location: $SOONG_OUT_DIR/vndk
- llndk.libraries.txt
- vndksp.libraries.txt
- vndkcore.libraries.txt
- vndkprivate.libraries.txt
- vndkcorevariant.libraries.txt
- vndk.libraries.txt: merged all of above with tags

The last one is used by 'check-vndk-list'.
(See the topic)

Others will be packaged by VNDK APEX of current VNDK.
(This is not merged yet. After landing, a follow-up CL will be
followed.)

Bug: 141019581
Bug: 141450808
Test: m check-vndk-list
Change-Id: I9a24f6975bd4b226a94f61a13d43857dcdce6b88
2019-10-25 14:08:28 +09:00
Jiyong Park
7495504db4 Change exportedDirs and exportedSystemDirs from []string to android.Paths
exportedDirs and exportedSystemDirs are now changed to android.Paths so
that we can later manipulate the paths via Rel(), etc.

Test: m

Change-Id: I6fb02ea4983bcebac351bc284f75b44885379e8f
2019-10-25 09:52:08 +09:00
Jooyung Han
31c470b5d5 Revert "Revert "Supports VNDK APEX with different versions""
This reverts commit 48dd4b5ea4.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
2019-10-19 02:28:39 +09:00
Treehugger Robot
c5bba642f1 Merge "Prohibit dependencies outside of uses_sdks" 2019-10-18 00:30:18 +00:00
Treehugger Robot
7617fc2fab Merge "Extend ALLOW_MISSING_DEPENDENCIES coverage" 2019-10-17 19:46:53 +00:00
Colin Cross
ad4a597c79 Merge "Add method to determine variations from a Target" 2019-10-17 18:52:20 +00:00
Treehugger Robot
a8f91ec00d Merge "Revert "Supports VNDK APEX with different versions"" 2019-10-17 11:50:47 +00:00
Isaac Chen
2c0a180be0 Extend ALLOW_MISSING_DEPENDENCIES coverage
Make build system respect ALLOW_MISSING_DEPENDENCIES, when building
architecture B products, and ignore targets with dependencies that
are not available for architecture B.

Bug: 142701187
Test: # Add a dummy Android.bp with a module only for arm64
      $ m -j TARGET_PRODUCT=aosp_x86 TARGET_BUILD_VARIANT=userdebug

Change-Id: I64de33674732df8c286671c806a07bcd19862b80
2019-10-17 11:02:21 +08:00
Jiyong Park
a7bc8ad0b9 Prohibit dependencies outside of uses_sdks
When an APEX is built with uses_sdks, any depedndency from the APEX to
the outside of the APEX should be from the SDKs that the APEX is built
against.

Bug: 138182343
Test: m

Change-Id: I1c2ffe8d28ccf648d928ea59652c2d0070bf10eb
2019-10-17 11:19:53 +09:00
Jooyung Han
48dd4b5ea4 Revert "Supports VNDK APEX with different versions"
This reverts commit 394951da73.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I4ce2e4a4c683c71958bc4f73e45a5ddd4a4ae32a
2019-10-16 23:50:39 +00:00
Colin Cross
0f7d2ef3ac Add method to determine variations from a Target
The arch variants are hardcoded in every module type.  Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.

Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
2019-10-16 14:52:30 -07:00
Treehugger Robot
a4cdb8dd40 Merge "add [static|shared].apex_available to cc_library" 2019-10-16 02:09:44 +00:00
Jiyong Park
a90ca00786 add [static|shared].apex_available to cc_library
apex_available property can be appended differently per the linkage
type. This will be used to restrict certain libs (e.g.
libc_malloc_debug) to an APEX while allowing them to be statically
linkable from platform for testing purpose.

Test: m (apex_test amended)
Change-Id: I6dec23129c5ac93a3ef06fea28f26f240c0ba410
2019-10-15 15:28:07 +09:00
Jooyung Han
394951da73 Supports VNDK APEX with different versions
Older VNDK libraries are provided as vndk_prebuilt_shared modules. Those
are added to corresponding VNDK APEX as dependencies.

With VNDK APEX installed, VNDK libs are unnecessary. By the way, since
there can be vendor modules which depend on VNDK libs, Make targets are
still emitted with UNINSTALLABLE=true.

Android.mk has additional modules for vndk libraries which are named
with apex name as suffices. For example, if libfoo is a vndk library,
then libfoo.vendor is its vendor variant and it would be in
/system/lib/vndk. But with vndk apex, it has additional
libfoo.com.android.vndk.current variant.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
Change-Id: I269c28a4d4c4e2f1518bd51df558438fe5316774
2019-10-15 07:33:49 +09:00
Treehugger Robot
e89b8fb919 Merge "Remove no_apex in favor or apex_available" 2019-10-08 05:33:29 +00:00
Treehugger Robot
62be1e3e33 Merge "Hide static from cc_library_shared and vice versa" 2019-10-02 21:39:37 +00:00
Jiyong Park
7916bfc3cc Remove no_apex in favor or apex_available
This change reverts following three changes to remove the no_apex
property. no_apex: true is equivalent to apex_available:
["//apex_available:platform"].

Revert "fix: "no_apex" can be put in defaults"
This reverts commit cc372c5b1d.

Revert "Add no_apex check for static library"
This reverts commit 2db7f46d0c.

Revert "Add no_apex property"
This reverts commit 4f7dd9b4db.

Bug: 139870423
Bug: 128708192
Test: m

Change-Id: Ia4b094e371e9f8adff94ae6dc3ebb8e081381d4e
2019-10-02 14:12:16 +09:00
Jooyung Han
5e493d5660 Merge "fix: "no_apex" can be put in defaults" 2019-09-26 01:07:21 +00:00
Jooyung Han
cc372c5b1d fix: "no_apex" can be put in defaults
Currently, putting no_apex in defaults module doesn't work.

To fix this,
* 'no_apex' property is added as 'defaultable'.
* apex module doesn't follow beyond 'defaults' module.

Bug: 141560644
Test: m (soong tests added)
Change-Id: I8410785f7f83d843689a33b1241d74086c6a7671
2019-09-25 15:27:47 +09:00
Colin Cross
e1bb5d092a Hide static from cc_library_shared and vice versa
The static properties don't make sense for cc_library_shared
modules, and the shared properties don't make sense for
cc_library_static modules.  Move them into separate property
structs so they can be added conditionally.

Test: m nothing
Test: DefaultsTest
Change-Id: I0b0cedf9eba07deb721fae138ffa7bedcfbfe71e
2019-09-24 15:05:57 -07:00
Ivan Lozano
f1c8433b40 Add AArch64 device Rust toolchain.
Bug: 141207434
Test: build example rust device module.
Change-Id: I0932a614942bf4a4d4b6c153fcc4fc79c7f202bd
2019-09-24 10:35:28 -07:00
Treehugger Robot
b1102ba828 Merge "Introduce module type 'sdk'" 2019-09-23 04:38:24 +00:00
Jiyong Park
d1063c1586 Introduce module type 'sdk'
This change introduces a new module type named 'sdk'. It is a logical
group of prebuilt modules that together provide a context (e.g. APIs)
in which Mainline modules (such as APEXes) are built.

A prebuilt module (e.g. java_import) can join an sdk by adding it to the
sdk module as shown below:

sdk {
    name: "mysdk#20",
    java_libs: ["myjavalib_mysdk_20"],
}

java_import {
    name: "myjavalib_mysdk_20",
    srcs: ["myjavalib-v20.jar"],
    sdk_member_name: "myjavalib",
}

sdk {
    name: "mysdk#21",
    java_libs: ["myjavalib_mysdk_21"],
}

java_import {
    name: "myjavalib_mysdk_21",
    srcs: ["myjavalib-v21.jar"],
    sdk_member_name: "myjavalib",
}

java_library {
    name: "myjavalib",
    srcs: ["**/*/*.java"],
}

An APEX can specify the SDK(s) that it wants to build with via the new
'uses_sdks' property.

apex {
    name: "myapex",
    java_libs: ["libX", "libY"],
    uses_sdks: ["mysdk#20"],
}

With this, libX, libY, and their transitive dependencies are all built
with the version 20 of myjavalib (the first java_import module) instead
of the other one (which is for version 21) and java_library having the
same name (which is for ToT).

Bug: 138182343
Test: m (sdk_test.go added)
Change-Id: I7e14c524a7d6a0d9f575fb20822080f39818c01e
2019-09-22 08:21:27 +09:00
Treehugger Robot
4e839ec3a5 Merge "Add corpus and dictionary properties to cc_fuzz." 2019-09-19 13:51:17 +00:00
Mitch Phillips
4e4ab8a141 Add corpus and dictionary properties to cc_fuzz.
Adds the corpus and dictionary properties to the cc_fuzz target.
Propagates these entries to the makefile backend via LOCAL_FUZZ_DATA, in
a similar manner to LOCAL_TEST_DATA.

Bug: 141026328
Test: m example_fuzzer, fuzz target should have adjacent corpus/dict
files.

Change-Id: If5add5a597cc479f4e084bdafbd0fc175cfd6321
2019-09-18 18:55:27 -07:00