Commit graph

241 commits

Author SHA1 Message Date
Ulyana Trafimovich
b30d91cbc5 Merge "Package dexpreopt artifacts for libcore jars in the ART apex." 2019-10-30 10:13:32 +00:00
Jooyung Han
8aee204cb2 Do not follow deps for apex_vndk
Since apex_vndk deals with its own dependencies, it should not follow
dependencies while packaging.

Bug: 139772411
Test: TARGET_VNDK_USE_CORE_VARIANT=true m com.android.vndk.current
      see if there are unexpected libs in the apex
      for example, android.hardware.audio.common@2.0.so should not be
      included in the apex since it is not listed as "must use vendor
      variant".

Change-Id: Ibada600b3099fb19630d1e327a2e09cd26b2deb0
2019-10-30 00:03:22 +00:00
Treehugger Robot
520367cbd3 Merge "Add support for including app prebuilts in APEX." 2019-10-29 23:02:38 +00:00
Dario Freni
cde2a037f6 Add support for including app prebuilts in APEX.
Bug: 138429615
Test: Created an APEX containing CtsShimPrebuilt and
CtsShimPrivPrebuilt.
Change-Id: I9d138ccfc03e4b96c9989d2681ad4e4ad5f20108
2019-10-28 16:05:32 +00:00
Dario Freni
e423582f07 Sort the file with image content.
While modifying the CTS shim apex packages, it was observed that the
output of the image content file is not necessarily sorted, which in
turn can cause failure when checking the file against a whitelist.

Bug: 138429615
Test: Succesfully built a modified version of CTS Shim v3 that was
previously failing because of the issue this CL fixes.

Change-Id: I901859ae08feb6012f34b851e125977e1c0100d9
2019-10-28 15:51:03 +00:00
Ulya Trafimovich
d5df949385 Package dexpreopt artifacts for libcore jars in the ART apex.
This patch adds dexpreopt files for the libore part of the
bootclasspath to the ART apex.

Since this is specific to the ART apex and makes not sense for other
apexes, the patch does not add a new module property, but only a
boolean flag denoting that this is an ART apex.

Dexpreopt artifacts packaged into the ART apex differ from those that
are packaged in the system image: it inludes only the libcore part of
bootclasspath jars, but not the framework part. When the boot image
extension is implementd, dexpreopt artifacts for the libcore jars will
be removed from the system image (but for now they are both in the
apex and in the system image).

Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds the third "libcore" variant.

Test: m
Test: m com.android.art deapexer \
    && find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
        | xargs deapexer | grep boot \
    Expect to find dexpreopt/$ARCH/boot-art*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh

Change-Id: I353ef90304bc5e18c3055ea379b3b223e5c38948
2019-10-28 14:03:08 +00:00
Jooyung Han
72bd2f8f15 add symlink for compatibility (vndk apex)
With VNDK APEX, the location of VNDK lib is changed.
But vndk libs of older VNDK versions still depend on old location.

For current VNDK version, those hard-coded references will be fixed.
TODO(b/142911355): [VNDK APEX] Fix hard-coded references to /system/lib/vndk

Bug: 143192278
Bug: 142912195
Test: m com.android.vndk.current and check if /system/lib/vndk
      OVERRIDE_TARGET_FLATTEN_APEX m com.android.vndk.current

Change-Id: I2ebacde7fcd1c7621e4509e08a76765e1dfeb059
2019-10-24 18:48:51 +09:00
Jooyung Han
7798857a0d Revert "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants""
This reverts commit 12f629b26d.

Bug: 142582178
Test: m (soong test added)
2019-10-19 02:28:39 +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
d091c6a67a Merge "Support privleged app in APEX" 2019-10-18 01:30:39 +00:00
Treehugger Robot
c5bba642f1 Merge "Prohibit dependencies outside of uses_sdks" 2019-10-18 00:30:18 +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
Treehugger Robot
50dce7372b Merge "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants"" 2019-10-17 11:50:47 +00:00
Jiyong Park
f7487318ac Support privleged app in APEX
privileged apps are installed to priv-app dir in APEX

Test: m
Change-Id: I8141e1c20e9486655606fa43b949783f11da09f4
2019-10-17 12:54:30 +09: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
12f629b26d Revert "Add __ANDROID_APEX_<NAME>__ for apex variants"
This reverts commit d29e551efd.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I50ac6842ab8aa572c11262ee0ec965ddbe903b0e
2019-10-16 23:51:09 +00: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
Jooyung Han
5ac191f51f Merge changes from topic "add-vndk-apex"
* changes:
  Add __ANDROID_APEX_<NAME>__ for apex variants
  Supports VNDK APEX with different versions
2019-10-15 09:21:19 +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
d29e551efd Add __ANDROID_APEX_<NAME>__ for apex variants
With __ANDROID_APEX_<NAME>__ definition, native modules may have
different behavior when it is built for a specific apex module.

Previously, the name is passed as value of definition __ANDROID_APEX__
like -D__ANDROID_APEX__=com.android.foo. But it is difficult to do
conditional compilation with it.

Now, since the name is incorporated into definition itself, it gets
easier to set #ifdef condition.

Bug: 142582178
Test: m (soong test added)
Change-Id: I3c90c789fa692a19addf2e5a7c8d4cc571cde112
2019-10-15 07:34:02 +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
Jiyong Park
f383f7cfc6 Correctly install APK-in-APEX
APK in a flattened APEX is installed as 'ETC' class module, instead of
the 'APP' class. This is to prevent Make from doing app-specific
amendments (e.g. such as adding module name after my_module_path)
to the paths and filenames which are all correctly set in the Soong
side.

Test: add `installable:true` to development/samples/Snake/Android.mk
and add 'Snake' to the `apps` property of an APEX. The build is
successful.
Test:  build the APEX on a device with TARGET_FLATTEN_APEX=true
The APK is at system/apex/<apexname>/app/Snake/Snake.apk

Bug: 142537672

Change-Id: I314bf1ab7abd4d4a4e9fa210442c004f54d8ccca
2019-10-12 01:06:39 +09:00
Treehugger Robot
9c32e3101e Merge "Fix flattened apex install dir" 2019-10-10 08:41:53 +00:00
Jooyung Han
7a78a92f79 Fix flattened apex install dir
This fixes the bug: flattened apex is installed under
/system/apex/<soong module name> not /system/apex/<apex name>.

Flattened apexes can be seen as pre-activated under /system/apex, which
is bind-mount to /apex. Therefore, install dir for flattend apex should
be the same with the activation point(or mountpoint) of non-flattened apex.

When apex_name: is set, it should be used as its name instead of name:.

This change also emits makevar APEX_FILE_CONTEXTS_INFOS which is list of
pairs(<apex_name>:<file_contexts>) and is used by sepolicy to modify
file_contexts files for flattened apexes properly.

Bug: 123314817
Bug: 142300241
Test: add a test apex module(foo) with apex_name(foobar)
Test: OVERRIDE_TARGET_FLATTEN_APEX=true m foo
Test: see if the apex is installed correctly(/system/apex/foobar)
Test: see if the file_contexts for foo is correctly modified
Change-Id: I97a07de5cc772cd1d91e95ae059d282038028916
2019-10-10 12:54:56 +09:00
Jiyong Park
583a226c0e Don't check apex_available for host
The check doesn't make sense for host.

Test: ALLOW_MISSING_DEPENDENCIES=true DIST_DIR=out/dist
./art/tools/dist_linux_bionic.sh -j110 com.android.art.host
is successful

Change-Id: Icdb4bb557a83b3c8044e6c73721dab47c56888a1
2019-10-08 20:55:38 +09:00
Treehugger Robot
e89b8fb919 Merge "Remove no_apex in favor or apex_available" 2019-10-08 05:33:29 +00:00
Treehugger Robot
c6136c9d65 Merge "Remove old-style support for translated second architectures" 2019-10-07 20:48:07 +00:00
Colin Cross
8b0dc4be07 Merge "Add symlinks to sh_binary in soong" 2019-10-07 17:47:45 +00:00
Treehugger Robot
36aecc1f6d Merge "Rename vndk apex according to vndk version" 2019-10-07 04:44:45 +00:00
Rashed Abdel-Tawab
6a34131da4
Add symlinks to sh_binary in soong
This allows us to change `logpersist.start` to `sh_binary` and unblocks
breakpad symbol uploading

Test: convert logpersist.start to sh_binary and verify symlinks are correct
Change-Id: I1b86c512df73a336205ca35216445a08e43bb879
2019-10-04 20:51:44 -07:00
Colin Cross
ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Colin Cross
70dda7e3da Separate InstallPath from OutputPath
Create a new type InstallPath that is similar to OutputPath to
differentiate intermediates output paths from installed output
paths.

RelPathString is a poorly defined, undocumented function that is
primarily used to get an install path relative to out/soong to
generate an equivalent install path for Make relative to $(OUT_DIR).
Move it to InstallPath for now, and fix the one remaining user on
OutputPath.

Add a method to create an NDK install path so that ndk_sysroot.go
doesn't have to do it manually with PathForOutput.

Bug: 141877526
Test: m checkbuild
Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-10-03 10:07:53 -07: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
Jiyong Park
127b40b316 Add apex_available to control the availablity of a module to APEXes
apex_available property controls the availability of a module to APEXes.
For example, `apex_available: ["myapex", "otherapex"]` makes the module
available only to the two APEXes: myapex and otherapex, and nothing
else, even to the platform.

If the module is intended to be available to any APEX, then a pseudo
name "//apex_available:anyapex" can be used.

If the module is intended to be available to the platform, then another
pseudo name "//apex_available:platform" is used.

For now, if unspecified, this property defaults to ["//apex_available:platform",
"//apex_available:anyapex"], which means the module is available to everybody.
This will be reduced to ["//apex_available:platform"], when marking for
apex_available for existing modules are finished.

Bug: 139870423
Bug: 128708192
Test: m
Change-Id: Id4b233c3056c7858f984cbf9427cfac4118b2682
2019-10-02 14:12:16 +09:00
Jooyung Han
90eee02a9a Rename vndk apex according to vndk version
VNDK APEX should be named after the version of VNDK libs.
For example, if vndk_version is 29, then the apex name should be
com.android.vndk.v29. If vndk_version is not set or is 'current', then
the platform vndk version is implied.

This is done with setting "apex_name" with proper name.

Bug: 139774701
Test: m (soong test added)
Change-Id: I918252f12ccd351886030fe9139a020d6cf1ff32
2019-10-02 10:02:30 +09:00
Steven Moreland
06bf3bcd7c apex: libbinder whitelist -= com.android.media
All APEXes need to ship w/o libbinder since it does not offer a stable
wire protocol. Removing this since nothing adds a libbinder dep here.

Bug: 139016109
Test: build
Merged-In: Ic6a3fcb68054d8c7a5f2f64795a0e2889ce1abe8
(cherry picked from commit 1c3108d629)
Change-Id: Ic6a3fcb68054d8c7a5f2f64795a0e2889ce1abe8
2019-09-30 21:34:45 +09:00
Jooyung Han
d15aa1f123 respect "apex_name:" for "apex" module
For now, apex_name is used only for flattened apex.
Even if apex_name is set, the activation point of unflattened is
determined by 'name' in apex_manifest.json.

This change make apex_name as priority.
If apex_name is set, then use this for apex name
- update name in apex_manifest.json to apex_name
- do not check if key filename matches (use apex_name as key name)

This can be useful if soong wants to rename apex module. Simply setting
apex_name has the same effect of renaming "activation point" of apex.

But: 139774701
Test: m (soong test)
Change-Id: I8ea3645e4aa8f317997bc1443ec308ed0595b1c2
2019-09-27 01:50:46 +09:00
Jooyung Han
5e493d5660 Merge "fix: "no_apex" can be put in defaults" 2019-09-26 01:07:21 +00:00
Przemyslaw Szczepaniak
598898444f Remove libneuralnetworks from libbinder whitelist.
Test: build & flash crosshatch
Bug: 139282353
Change-Id: Iaf7904fdb306dd648430ce7e167977bd6508f146
Merged-In: Iaf7904fdb306dd648430ce7e167977bd6508f146
(cherry picked from commit 76b155448d)
2019-09-25 13:04:48 +01: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
Sundong Ahn
e8fb724689 Add isFlattenedVariant function
The return value is true if TARGET_FLATTEN_APEX is true,
TARGET_BUILD_APPS is false and the module is flatten variant.
Only the module name of flattened variant is appended with
".flattened" as suffix.

Test: m -j
Bug: 139716748
Change-Id: I966a178b43c5d08bd69d19e97e59456aa66d9d28
2019-09-23 14:40:21 +09: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
Colin Cross
3b19f5d71d Remove old-style support for translated second architectures
Translated second architectures now go in NativeBridgeArch instead
of DeviceSecondaryArch.

This reapplies I568046330abc002d4eed582cb999b62a5eaba790 with
ctx.Config().HasMulitlibConflict() added to fix the NDK build,
which has arm64, arm, x86_64, and x86 architectures enabled.

Test: m checkbuild
Test: OUT_DIR=out_ndk build/soong/scripts/build-ndk-prebuilts.sh
Test: no change to build.ninja or Android-aosp_cf_x86_phone.mk
Change-Id: Iadcafbd64bfb9579ae7c86914927c43a062b0c8e
2019-09-19 12:54:32 -07:00
Roland Levillain
411c584cba Fix documentation of field soong.apex.apexBundleProperties.Apex_name.
Remove the mention to the (APEX) manifest (`apex_manifest.json`) from
this field's documentation, as `Apex_name` is neither read from nor
written to that file.

Test: n/a
Change-Id: Ia0dfac4f35f1ea697f379bcb19dd11af8705a0a0
2019-09-19 16:54:07 +01:00
Inseob Kim
64c4395386 Add version to vendor variants
Vendor variant is now divided into several vendor.{version} variants,
depending on their intended usages:

vendor.{BOARD_VNDK_VERSION}: vendor and vendor_available modules
vendor.{PLATFORM_VNDK_VERSION}: VNDK modules in the source tree
vendor.{snapshot_ver}: VNDK snapshot modules

This also affects exported module names from Soong to Make. But to
maintain backward compatibility, ".{BOARD_VNDK_VERSION}" suffix will not
be emitted for modules having version BOARD_VNDK_VERSION, so that vendor
modules still can be referred as-is.

Bug: 65377115
Bug: 68123344
Test: clean build and boot blueline
Change-Id: Ib9016a0f1fe06b97e9423fd95142653a89a343fa
2019-09-18 10:53:30 +09:00
Treehugger Robot
1f6c94a3ac Merge "Add "apex_vndk" module type" 2019-09-17 17:14:48 +00:00