Commit graph

217 commits

Author SHA1 Message Date
Jooyung Han
5df3b11f78 Revert "apex_vndk uses vendor variants only"
This reverts commit 559ad01db9.

Reason for revert: broken builds

Change-Id: Ia8a09a2bdbdc8e76f2d4b9eb54e36ccc544e9397
Bug: b/148181875
2020-01-23 05:31:05 +00:00
Jooyung Han
559ad01db9 apex_vndk uses vendor variants only
VNDK APEX is supposed to contain "vendor" variants of VNDK libraries.
This is different from normal APEXes which have "apex" variants.

Bug: 146758869
Test: build / flash / boot
Change-Id: I5e035678c337334092616b58d2e0e404788a6639
Exempt-From-Owner-Approval: Got ORV, but rebased with resolving merge conflicts.
2020-01-23 04:46:53 +00:00
Treehugger Robot
21e40ce36e Merge "Reland "use symlink for bundled APEX"" 2020-01-22 01:41:14 +00:00
Jiyong Park
7cd10e3908 Reland "use symlink for bundled APEX"
This reverts commit 31c65d4fe4.

Bug: 144533348

Test: checkout master-art-host and run
ALLOW_MISSING_DEPENDENCIES=true DIST_DIR=out/dist /art/tools/dist_linux_bionic.sh -j80 com.android.art.host
the result is successful

Change-Id: Ica11eec9b64867088b16720a41c6d83905976ec5
2020-01-20 15:13:31 +09:00
Treehugger Robot
e24093a784 Merge "Dedup cc binary build components registration" 2020-01-17 11:11:50 +00:00
Paul Duffin
2ee6979443 Dedup cc binary build components registration
Bug: 146540677
Test: m nothing

Change-Id: I1c677d0ee2cead1d61f81e34e8d5a2f4a52f6cad
2020-01-16 14:10:18 +00:00
Treehugger Robot
9c121cd7f3 Merge "Include the hashtree in Q-launched modules." 2020-01-16 12:27:47 +00:00
Anton Hansson
eec79ebe03 Default apex_available to //apex_available:platform
This means everything that goes into apexes need to be
explicitly labeled to be available for apex.

Whitelist the current offenders. This list should be
trimmed down.

Bug: 147364041
Test: m
Test: multiproduct_kati -only-soong
Exempt-From-Owner-Approval: cherry-pick from internal
Change-Id: I837299c6a15d46f8a5ba544b613776b1cc27d7b8
Merged-In: I837299c6a15d46f8a5ba544b613776b1cc27d7b8
(cherry picked from commit 93488cbb10d4882845abb732f8e53714f0982031)
2020-01-16 09:14:03 +00:00
Dario Freni
e354690448 Include the hashtree in Q-launched modules.
For post-Q modules, we can avoid building the hashtree also in the
unbundled build case, since the device will regenerate the hashtree
locally. This CL simplifies the logic so that the build rules apply
regardless of the build being bundled or unbundled -- after all, bundled
build are only really valid for development purposes.

Fix: 147600151
Test: unit test;
m com.android.conscrypt and manual inspection of apexer invocation
(option no_hashtree not present)
m com.android.neuralnetworks and manual inspection of apexer invocation
(option no_hashtree present)

Change-Id: Ib4cc6149d3beac5df7e23a65a3b7ee6b0d68e395
2020-01-14 23:59:02 +00: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
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
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
8ea6bc4a05 Merge "Revert "m <apex_name>-deps-info prints the internal/external deps of the APEX"" 2020-01-09 02:20:42 +00: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
Treehugger Robot
573326a8ce Merge "m <apex_name>-deps-info prints the internal/external deps of the APEX" 2020-01-09 00:44:13 +00:00
Jiyong Park
7afd1077b8 APEX carries required properties of its dependencies
When a module is included in an APEX and the module is not directly
installed to the system partition, the 'required' property of the module
is lost. The APEX containing the module now carries the property from
its dependencies.

Bug: 146549048
Test: m
Change-Id: Ie21cc7b8420c6126c855e66c2363644de4a7ef42
2020-01-06 10:41:46 +09: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
Kiyoung Kim
2c12207919 Merge "Detach VNDK using core library list from VNDK APEX" 2019-12-31 00:55:46 +00:00
Kiyoung Kim
e1aa8ea34e Detach VNDK using core library list from VNDK APEX
Some devices require VNDK using core library list, but this is dependent
to system image rather than VNDK version. This change removes VNDK using
core variant library list file from VNDK APEX, and also remove VNDK
version from its filename.

Bug: 142599349
Test: m -j passed && aosp_cf_x86_go_phone booted
Change-Id: Ibc53b8dfc9d38e14bbaa878154034d25a6d34089
2019-12-30 14:29:52 +09:00
Treehugger Robot
e9391f8bab Merge "Create APEX variation only when needed" 2019-12-28 04:18:59 +00:00
Jiyong Park
3ff1699683 Create APEX variation only when needed
Create an APEX variation of a module only when it is either directly
included in an APEX or the dependency to the module demands that the
module should be included. For example, a non-static dependency to a
java library no longer creates an APEX variant of the library.

Bug: 146907857
Test: m (apex_test amended)
Test: cat out/soong/build.ninja | grep "Module:" | wc -l
reduced from 47132 to 45881

Change-Id: Icd79fb4b60668d852b9f018343b934b5e42a8eda
2019-12-27 14:11:47 +09:00
Jooyung Han
624058e6a5 Dedup generating xml file for java_sdk_library
Permission XML file for java_sdk_library is generated by
java_sdk_library itself now.

And, build rule is switched to android.WriteFile since "echo -e" is
not supported from build server. (-e is printed to output)

Bug: 145474221
Test: m com.android.cronet and check its permissions xml file
     also, m org.chromium.net.cronet.xml (created dynamically)
Change-Id: Iffb119151c49bc4fe6c4386fa267cca193f37dbc
2019-12-26 12:20:24 +00:00
Jooyung Han
5a80d9f352 apex: drop java_import support
java_import doesn't support dex jar which is necessary to be packaged in
an APEX. Supporting this would require non-trivial work. By the way
java_import is not used and there is a workaround.(defining java_library
and static-linking with it)

We drop the support for `java_import` in APEX.

Bug: 139175488
Test: m (soong tests amended)
Change-Id: I924386571079090c701276d87f665ce7fbb6f074
2019-12-23 06:46:39 +00:00
Dario Freni
6f3937cb29 Add support for java_test_helper_app.
Bug: 142712057
Bug: 138429615
Test: apex_test passes, tried building an apex with a test app.
Change-Id: Ib75bd48042d8b1fe102038bef08cd1be708e996d
2019-12-21 08:50:12 +00:00
Jaewoong Jung
dcee89cad6 Merge "Make apex.overrides overridable by override_apex." 2019-12-20 18:20:50 +00:00
Paul Duffin
6c26dc7392 Dedup cc library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I6685338550f587212e70f3eba8d4342b66f566e2
2019-12-20 15:22:52 +00:00
Treehugger Robot
120d73fe4f Merge "Support java_sdk_library as java_libs of apex" 2019-12-20 05:16:31 +00:00
Jaewoong Jung
7abcf8ead8 Make apex.overrides overridable by override_apex.
Test: apex_test.go
Change-Id: Id47e5e5bec45ec1ada68f9d2d806585c5141a2f9
2019-12-19 17:32:06 -08:00
Jooyung Han
58f26aba4e Support java_sdk_library as java_libs of apex
When a java_sdk_library module is added, both impl jar and permission
xml files are packaged together.

For example, when a java_sdk_library "foo" is listed, following two
entries will be in an APEX package.

/javalibs/foo.jar
/etc/permissions/foo.xml

Bug: 145474221
Test: m com.android.cronet
      deapexer list com.android.cronet.apex

Change-Id: If5883c02255e9309f20810b1532d3fbe73bf4e95
2019-12-20 08:50:34 +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
Paul Duffin
59986b23cc Dedup cc prebuilts module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I7e9440a075ef9c683729ed83e0033ab529fe4ac0
2019-12-19 19:19:40 +00:00
Paul Duffin
d686791c16 Improve cc tests by adding sanitizer mutators
This fixes an issue that arises when deduping cc build component
registration code.

The sanitize_runtime_deps and sanitize_runtime post deps mutators were
not previously added when running cc tests. That meant the tests were
not actually testing the same behavior as at runtime.

Adding the mutators breaks the TestFuzzTarget test as the mutator adds
libclang_rt.ubsan_standalone-aarch64-android as a dependency of libc++
and the former is not available.

This fixes the test by adding the missing dependency as a cc prebuilt
shared library.

Test: m checkbuild
Bug: 146540677
Change-Id: Ie13c7e6fcefef7d9cb1cc5364be3dc563ce40de5
2019-12-19 19:19:40 +00:00
Paul Duffin
0c4979bbdf Dedup prebuilt mutator registration
Test: m checkbuild
Bug: 146540677
Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
2019-12-19 19:19:40 +00:00
Paul Duffin
43dc1cc2bc Dedup system modules and sdk library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
2019-12-19 19:19:40 +00:00
Paul Duffin
77980a8bb9 Dedup registration for cc default test config
The cc.GatherRequiredDepsForTest() method returns some default module
definitions that are required when using cc module types like
cc_library. Previously, the registration of the module types and
mutators needed to process those default definitions was duplicated
in the test config initialization.

This change removes that duplicated code and replaces it with calls
to cc.RegisterRequiredBuildComponentsForTest(ctx) which registers all
the required build components.

Test: m checkbuild
Bug: 146540677
Change-Id: I80b6913c5691ff164ce9d308b9e1da24940f2d42
2019-12-19 19:19:40 +00:00
Paul Duffin
f9b1da0fcb Dedup registration code for module types and singletons
The registration of module types and singletons is duplicated between
init() functions that register them for use in the build runtime and
test context creation code that registers them for testing.

This is a proof of concept for a mechanism that will allow the code
to be shared. It defines a RegistrationContext interface that is
implemented by both the TestContext and the new initRegistrationContext
type. An instance of the the latter is available through the
InitRegistrationContext variable.

The intent is that the registration of the module types and singleton
types will be extracted from the init() function into a separate
function that takes a RegistrationContext parameter. That method is
called from init() passing in the InitRegistrationContext and from a
test passing in the TestContext. Something like this:

  func init() {
    RegisterBuildComponents(android.InitRegistrationContext)
  }

  func RegisterBuildComponents(ctx android.RegistrationContext) {
    ctx.RegisterModuleType(....)
    ....
  }

A test would do something like this:

  ctx := android.NewTestContext()
  RegisterBuildComponents(ctx)

Test: m nothing
Change-Id: I97173cabb6d6cf7ce98fdb5f73418438b1997b35
2019-12-19 10:09:53 +00:00
Colin Cross
98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Treehugger Robot
572aeed6a4 Merge "Move imageMutator before archMutator" 2019-12-18 02:34:36 +00:00
Jooyung Han
70415ceb9e Merge changes Icbdf4979,I1a6f135d
* changes:
  Fix apex to override certificate
  Fix apex to follow deps of modules with stubs.
2019-12-18 01:04:53 +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
Jooyung Han
f121a657c9 Fix apex to override certificate
The rules for apex certificate:
1. <unspecified>: use <default app cerficicate>
2. name: use <default app cerficiate dir>/<name>(.x509.pem|.pk8)
3. :module: use specified by <module>

Certificates can be overridden by PRODUCT_CERTIFICATE_OVERRIDES.

Currently, 1) and 2) aren't overridden by PRODUCT_CERTIFICATE_OVERRIDES,
which should be.

Bug: n/a
Test: m (apex_test.go amended)
Change-Id: Icbdf4979613ef10127ecc02f3debd6a798460532
2019-12-17 15:20:50 +09:00
Jooyung Han
671f1ce75e Fix apex to follow deps of modules with stubs.
In case that an apex module depends on a module with stubs directly
*and* indirectly, the build system should follow the deps graph further.

Note that WalkDeps() visits deps in DFS and it won't visit again visited
modules.

Bug: n/a
Test: m (apex_test.go amended)
Change-Id: I1a6f135dbda6d1eb641575a3fbbc9bbee0622076
2019-12-17 15:18:54 +09:00
Treehugger Robot
1d1a920794 Merge "Support apps attribute in apex_defaults" 2019-12-17 05:44:42 +00:00
Treehugger Robot
bd0624304e Merge "Use empty string for core image variant" 2019-12-16 20:54:32 +00:00
Jooyung Han
f21c797f38 Support apps attribute in apex_defaults
Adding overridableProperties to apex_defaults as well.

Bug: 146217017
Test: m
Change-Id: I51182fec25ee589fea4006164c4dd69acc5ba67d
2019-12-16 13:36:34 +00:00
Jiyong Park
479321dc34 java libs that isn't installable is gracefully rejected
... rather than causing soong panic.

Bug: 146197571
Test: m (apex_test amended)
Change-Id: I3679a4e3041527533c1c05d54f3aa514abd6095b
2019-12-16 15:59:54 +09:00
Colin Cross
7113d20774 Use empty string for core image variant
Use the empty string for the core image variant so that modules
added to imageMutator do not change their build directory.

Bug: 142286466
Test: m checkbuild
Change-Id: Ida4534d9a4d6176236aaa480fed359ce27acfaa1
Merged-In: Ida4534d9a4d6176236aaa480fed359ce27acfaa1
(cherry picked from commit 72d685ee7f45e5393be44ae4159edf083ac918de)
2019-12-13 20:44:36 -08:00
Treehugger Robot
ac68248051 Merge "Add "legacy_android10_support" to "apex"" 2019-12-14 02:07:16 +00:00
Treehugger Robot
e676810de5 Merge "Install flattened/unflattend apexes for GSI" 2019-12-13 21:10:56 +00:00
Jooyung Han
214bf37311 Add "legacy_android10_support" to "apex"
APEXes with "legacy_android10_support" will have apex_manifest.json for
compatibility as well as apex_manifest.pb.

Bug: 143951586
Test: m (soong tests)
Change-Id: I019252aee5a9423f4b180ba1026e6e99c9961437
2019-12-13 08:47:16 +09:00
Jiyong Park
0b0e1b9804 AndroidMkEntries() returns multiple AndroidMkEntries structs
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.

Bug: 128708192
Test: m

Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
2019-12-11 17:25:27 +09:00
Treehugger Robot
e2f3b5dfe5 Merge "Move ImageMutator after archMutator" 2019-12-07 00:37:30 +00: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
Jooyung Han
3ab2c3e68c Install flattened/unflattend apexes for GSI
GSI targets are supposed to have both 'flattened' and 'unflattened'
APEXes. By adding 'flattened' APEX as REQUIRED moduled for 'unflattened'
APEX, both will be installed togetther.

This is done by a new variable PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES,
which is set only for GSI targets.

Bug: 137802149
Test: lunch aosp_arm64-userdebug && m
  resulting apex images under /system/apex
  and flattened apexes under /system/system_ext/apex

Change-Id: I336e2674e427b358542e0045b2a49dfa3d84095b
2019-12-06 09:52:19 +09:00
Jiyong Park
317645e84c Overridden APEX doesn't contribute to the file contexts
This change fixes the problem that when an apex module is overridden by
another override_apex, the <apex_name>-file_contexts are duplicated when
creating the system-level file-contexts.

Fixing this by not emitting the file_context info for the overridden
apex.

In doing so, OverridableModule interface was extended to have
GetOverriddenBy() method which can be used to test whether a module is
an overridden one or not.

Bug: 144338929
Test: m (apex_test amended)
Test: add "override_apex {name:"com.googlge.android.tzdata",
Change-Id: I5e9401c32899bb9987c90cba4185f571dc1a87f0
base:"com.android.tzdata"}" and the build is successful
2019-12-05 13:25:39 +09:00
Jiyong Park
f653b05d55 Refactor the routine for creating apexFile
This change is to make it easier to add new fields to the struct.
transitiveDep field is added to distinguish apexFiles coming from
transitive dependencies of the APEX. We will later use the info to
reduce the size of bundled APEXes by replacing the transitive deps with
symlinks to the corresponding files in the system partition outside of
the APEX.

Bug: 144533348
Test: m

Change-Id: I283859f2f2f1b5cfb3025569f168ba8569b22bb9
2019-11-30 14:49:13 +09:00
Jooyung Han
6aa363b7ae Merge "Fix: install flattened apex on system_ext" 2019-11-27 07:30:54 +00:00
Jooyung Han
91df2084ad Fix: install flattened apex on system_ext
This build rule is specific to platform APEXes.
For non-platform APEXes, MakeAsSystemExt() is not applied.

This fixes the cases of "soc_specific: true" apexes which fails to
build.

Bug: 139053989
Test: m nothing (soong tests)
Change-Id: I98d0257499647ab41cdaa62a3671d89addbdf833
Exempt-From-Owner-Approval: got +1 before rebasing
2019-11-27 07:30:37 +00: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
Colin Cross
4b49b768a2 Make TestContext.RegisterModuleType take an android.ModuleFactory
Avoid having to pass ModuleFactoryAdaptor to every call to
RegisterModuleType in a test by wrapping RegisterModuleType.

Test: all soong tests
Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-11-25 10:59:44 -08:00
Jaewoong Jung
1670ca0d8b Fix Make modules name conflict for override_apex
When an override_apex named Foo overrides an apex module named Bar, the
Make modules from Foo have Foo as their suffix. Previously the suffix
was Bar for both of the overriding and the overridden APEXes, causing
name conflicts in the Make side.

Bug: 144338929
Test: apex_test.go
Change-Id: I1396910ab294ba5f5e0585af6d37f1eab9460250
2019-11-23 16:20:50 +09:00
Jooyung Han
54aca7b3f3 Make 'file_contexts' prop as android:"path"
For platform APEXes, file_contexts should point a file under
/system/sepolicy.

Bug: 144732805
Test: m
Change-Id: Ib2d5db715bbebc80a6178d1c42e387b268cc4a0d
2019-11-21 22:05:06 +09: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
Jiyong Park
5d790c3dda Add override_apex module type
override_apex module type is used to override existing apex module with
certain properties overridden. Currently, only the 'apps' property is
overridable.

Bug: 144338929
Test: m
Change-Id: Ic050b062093cda29ce78126cc92dd6097647f7db
2019-11-19 16:49:36 +09:00
Treehugger Robot
bbdeda5bed Merge "Override apexes with LOCAL_OVERRIDES_MODULES" 2019-11-15 05:02:55 +00:00
Treehugger Robot
bc196606c3 Merge changes Ibcc1096e,I21ac2441
* changes:
  Install AndroidApp only when needed
  Reland: JNI lib is always embedded for APKs in APEX
2019-11-15 00:10:05 +00:00
Jiyong Park
b0a012cfec Override apexes with LOCAL_OVERRIDES_MODULES
APEXes are ETC type, which should be overridden via
LOCAL_OVERRIDES_MODULES. This change fixes a bug that
LOCAL_OVERRIDES_PACKAGES was used for APEXes.

Bug: 140792287
Test: m
Test: add com.google.android.tzdata to PRODUCT_PACKAGES and build.
/system/apex/com.google.android.tzdata.apex exists, but
/system/apex/com.android.tzdata.apex doesn't.

Change-Id: Id65743b36e0b706d6ffd8cae0597cc0a42a83fb7
2019-11-14 17:17:03 +09:00
Jiyong Park
52cd06fc73 Reland: JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the
lib is embedded inside the APK.

This change also fixes a bug that APKs are not mutated for APEXes.

Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: I21ac24412b30c05afc03385655c6b196130dffe3
2019-11-14 00:39:47 +09:00
Sam Saccone
e3c22f7a3f Revert submission
Reason for revert: b/144387414
Fixes: b/144387414
Change-Id: I21e15a4d149a5a8fefd0f84010600cb41b59db95
2019-11-13 15:24:11 +00: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
Jiyong Park
d237ad6d71 JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the
lib is embedded inside the APK.

This change also fixes a bug that APKs are not mutated for APEXes.

Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: Icf490d2701a7ede8bcad7e671fc72be9c8d7c01e
2019-11-11 12:40:09 +09:00
Treehugger Robot
c70d3c3cf6 Merge "APEX now correctly tracks jni_lib dependencies" 2019-11-09 13:53:08 +00:00
Jooyung Han
d0e39622c7 Merge "apex_manifest in protobuf binary format" 2019-11-08 17:33:38 +00:00
Jiyong Park
8be103b04c APEX now correctly tracks jni_lib dependencies
Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: If9dde4e2e62c2642267dbcac68bab76a032682c0
2019-11-08 15:53:48 +09:00
Jooyung Han
01a3ee287a apex_manifest in protobuf binary format
For Q compatibility, .json files are also bundled.

Three different apex_manifest files are built from input.
- apex_manifest.json: Q-readable .json file
- apex_manifest_full.json: input + dependency
- apex_manifest.pb: apex: converted from apex_manifest_full.json

apexer will handle these files.

Bug: 143654022
Test: m
Change-Id: I9697094057f0c0543282b1b46b7535cf21431176
2019-11-08 13:40:45 +09:00
Jooyung Han
39edb6c6c1 VNDK APEX contains related *.libraries.txt files
These files were highly coupled with vndk version, so having them inside
the corresponding VNDK APEX is reasonable.

These files are used by linkerconfig and libnativeloader. In the future,
they reference these files from and VNDK APEX.

Bug: 141450808
Test: m com.android.vndk.current
Change-Id: I055a979d2636ddd8844a0afff81f6ba441f7965e
2019-11-07 16:47:38 +09:00
Treehugger Robot
549f6c235f Merge "Create variants for each image type" 2019-11-01 02:13:52 +00:00
Jooyung Han
e9b33cd8f8 Merge "apex: Restrict usage of "use_vendor"" 2019-11-01 01:58:33 +00:00
Jooyung Han
dc782449b8 apex: Restrict usage of "use_vendor"
When use_vendor is used, native modules are built with
__ANDROID_VNDK__ and __ANDROID_APEX__, which may cause
compatibility issues. (e.g. libbinder)

Even though libbinder restricts its availability via
'apex_available' property and relies on yet another macro
__ANDROID_APEX_<NAME>__, we restrict usage of "use_vendor:" from
other APEX modules to avoid similar problems.

Bug: 142684427
Test: m -j
Change-Id: Ibc781de2efcd20cb6688a183b08e908a8a6e2593
2019-11-01 03:15:38 +09:00
Sundong Ahn
abb6443895 Create variants for each image type
Create variant of image, zip or flattened according to
TARGET_FLATTEN_APEX and payload type.
If payload type is zip, only zip variant is created because flattened
apex is not supported. And if payload type is image, image and flattened
variants are created.

Bug: 139053989
Test: m -j
Change-Id: Ibde18490d23ec602c4cca97cf97db90a562e014e
2019-10-31 22:14:46 +09:00
Jooyung Han
6b8459be4f apex: __ANDROID_APEX__ defined with no value
__ANDROID_APEX__ was defined with the name of apex module.
-D__ANDROID_APEX__=com.android.foo

But in this way, conditional compilation is not easy since comparing
macro's string value is not supported in C/C++.
(There's no usages of this value in source tree.)

In most cases, modules can check if __ANDROID_APEX__ is defined to see
if they are compiled for apex.
For modules which should behave differently according to which apex they
are included, they can check __ANDROID_APEX_<NAME>__.

Bug: 142582178
Test: m (soong tests run) && boot device && TH
Change-Id: I0f5e3e9463ccd96cbba333a8bdd648470c5c912d
2019-10-29 23:47:59 +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
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
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
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
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
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
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
Treehugger Robot
36aecc1f6d Merge "Rename vndk apex according to vndk version" 2019-10-07 04:44:45 +00: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
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