Commit graph

798 commits

Author SHA1 Message Date
Treehugger Robot
a65a304368 Merge "runtime_resource_overlay can be included in APEXes" am: c869812b04 am: 765dbb0b83
Change-Id: Ia5f4e186891206912ae5cac5a7b29896a57ce1c6
2020-04-28 17:51:21 +00:00
Treehugger Robot
c869812b04 Merge "runtime_resource_overlay can be included in APEXes" 2020-04-28 17:13:26 +00:00
Jiyong Park
23ba7cc000 Merge "Add test_for property" into rvc-dev 2020-04-28 14:27:07 +00:00
Jiyong Park
69aeba9982 runtime_resource_overlay can be included in APEXes
runtime_resource_overlay is put to an APEX via 'apps' property. It is
placed under ./overlay directory in it.

Bug: 154822536
Test: m
Change-Id: I8edf4a26c26368c52fb7b327b2ecc829f21ea148
2020-04-28 22:55:54 +09:00
Jiyong Park
f0d01b7c98 Add test_for property
This change adds 'test_for' property to cc_test_* types. The property is
used to mark a module as a test for one or more APEXes, in which case
the module has accecss to the private part of the listed APEXes. For
example, the module is linked with the actrual shared library in the
APEX instead of the stub of the shared library.

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

Bug: 129539670
Bug: 153046163
Test: m
Merged-In: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
(cherry picked from commit 62304bbeec)
Change-Id: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
2020-04-28 21:35:40 +09:00
Jiyong Park
5088a2cbd5 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

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

Bug: 150999716
Test: m
Merged-In: I11a4e877ee27f7c55e2f00371c6fa58daedb1a9f
(cherry picked from commit 601d31c234)
Change-Id: I11a4e877ee27f7c55e2f00371c6fa58daedb1a9f
2020-04-28 21:08:58 +09:00
Dario Freni
ccd4f112b1 Merge "Allow building unsigned APEXs payload for testing." into rvc-dev am: 73b6c98e10
Change-Id: Ie46b70b3125b430f4586fb67ec0868acc7066dfc
2020-04-28 07:33:35 +00:00
Dario Freni
73b6c98e10 Merge "Allow building unsigned APEXs payload for testing." into rvc-dev 2020-04-28 07:13:07 +00:00
Jooyung Han
7e00c13d0e Merge "apex: file_contexts for override_apex flattened" into rvc-dev am: d5c7ad63ec
Change-Id: I75cd5ce07f79f1ea4cee8791ed8cf3c9ddd22c0d
2020-04-28 03:19:19 +00:00
Jooyung Han
d5c7ad63ec Merge "apex: file_contexts for override_apex flattened" into rvc-dev 2020-04-28 03:03:26 +00:00
Jiyong Park
28cb10ea68 Merge "mark platform un-availability" into rvc-dev 2020-04-28 02:29:55 +00:00
Jiyong Park
6a9ddc37a9 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

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

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Merged-In: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
(cherry picked from commit 89e850ab84)
Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-28 09:27:24 +09:00
TreeHugger Robot
ba505df1c4 Merge "Remove libopus from apex_available whitelist" into rvc-dev 2020-04-27 23:54:39 +00:00
Colin Cross
01fd7ccbc7 Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
Merged-In: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
(cherry picked from commit 82e192c3ae)
2020-04-27 14:45:05 -07:00
Colin Cross
1c93c299fb Require apps built against the SDK to use JNI built against the NDK
Apps that expect to run on older platforms should use JNI libraries
that will also run on older platforms.  Require that apps that set
sdk_version have jni_libs modules that also set sdk_version, or
set jni_uses_platform_apis: true to bypass the check.

Fixes: 149591057
Test: app_test.go
Change-Id: I76b9b45fb5773bc4dfc10520108f4f3578723909
Merged-In: I76b9b45fb5773bc4dfc10520108f4f3578723909
2020-04-27 14:45:05 -07:00
Dario Freni
ca9133907f Allow building unsigned APEXs payload for testing.
Bug: 148447155
Test: built a testing apex with unsigned payload.
Merged-In: I95aa3f11ff1adc1421fcd7ed5a356ee531a0a818
Change-Id: I95aa3f11ff1adc1421fcd7ed5a356ee531a0a818
(cherry picked from commit 98410fd9d6)
2020-04-27 21:02:18 +01:00
Dario Freni
98410fd9d6 Allow building unsigned APEXs payload for testing.
Bug: 148447155
Test: built a testing apex with unsigned payload.
Change-Id: I95aa3f11ff1adc1421fcd7ed5a356ee531a0a818
2020-04-27 20:52:09 +01:00
Artur Satayev
8cf899afcc Ensure APEX's Java deps use stable SDKs.
Test: m
Bug: 153333044
Change-Id: Ib1acf3073e96fe23c92d292ec0b1a91e2cd408db
2020-04-27 19:16:40 +01:00
Jooyung Han
6bfc04369b apex: file_contexts for override_apex flattened
Make-var APEX_FILE_CONTEXTS_INFOS should contain entries for
override_apex modules. Otherwise flattened override_apex modules can't
be correctly labeled.

Bug: 154031888
Test: lunch gsi_gms_arm64-userdebug
      m file_contexts.bin
      check ../file_contexts.bin_intermediates/file_contexts.concat.tmp
      if it contains entries for override_apex
Change-Id: I60fc3da1def0f5fe14cfeef32a4c2a07a65b056e
2020-04-27 22:18:19 +09:00
Treehugger Robot
8ffac4e19d Merge "mark platform un-availability" am: 01db260858 am: 547c6087df
Change-Id: Ida786db81d3bd1db40cfc28b6f3a013425781345
2020-04-27 13:03:05 +00:00
Treehugger Robot
01db260858 Merge "mark platform un-availability" 2020-04-27 12:37:45 +00:00
Jooyung Han
ced674e0e2 enforce updatable apexes to set min_sdk_version
updatable APEXes should set min_sdk_version as well.

Bug: 152655956
Test: m
Merged-In: I8192086eb89fa958dd8ff1b731e43e24bf217ce2
Change-Id: I8192086eb89fa958dd8ff1b731e43e24bf217ce2
(cherry picked from commit 548640b55f)
2020-04-27 19:44:06 +09:00
Treehugger Robot
35d20b1a4f Merge "enforce updatable apexes to set min_sdk_version" am: 4783297585 am: 09ae364a54
Change-Id: I2b2ce7dfb1dfc9cf498a7ed26a158a61548016c0
2020-04-27 10:20:32 +00:00
Jooyung Han
8c3b035045 Remove libopus from apex_available whitelist
libopus sets its own apex_available property.

Bug: 150999716
Test: m
Merged-In: I4cff3ebb7e017a1fb629b18b72238acf3df0d26e
Change-Id: I4cff3ebb7e017a1fb629b18b72238acf3df0d26e
(cherry picked from commit 47db5adb06)
2020-04-27 18:27:59 +09:00
Jooyung Han
cd5b550fdf Merge "Revert "Apex: add NeverAllowRule for updatable"" into rvc-dev am: b6e5e512de
Change-Id: I17009a86082db0c606228df8ae7840d33186b8fa
2020-04-27 07:44:43 +00:00
Jooyung Han
548640b55f enforce updatable apexes to set min_sdk_version
updatable APEXes should set min_sdk_version as well.

Bug: 152655956
Test: m
Change-Id: I8192086eb89fa958dd8ff1b731e43e24bf217ce2
2020-04-27 16:33:37 +09:00
Jooyung Han
b6e5e512de Merge "Revert "Apex: add NeverAllowRule for updatable"" into rvc-dev 2020-04-27 07:30:27 +00:00
Jooyung Han
cf75798d8f Revert "Apex: add NeverAllowRule for updatable"
This reverts commit e17caa63a6.

Reason for revert: rewrite this in ag/11250335 without neverallow

Bug: 152655956
Change-Id: I24436720056ac1b9878e37c2ee45c5806714f3e9
2020-04-27 07:30:10 +00:00
Jiyong Park
a7ca0120ad Merge "Add test_for property" am: 70b5c21270 am: b739f8d870
Change-Id: If02ebcfee4195fbac05dd0b902958236c5a6346d
2020-04-27 00:50:02 +00:00
Jiyong Park
70b5c21270 Merge "Add test_for property" 2020-04-27 00:13:50 +00:00
Marco Nelissen
1def8a267b Merge "com.android.media apex uses sonivox without jet" into rvc-dev am: 172e6fc12a
Change-Id: Ib641d951b8e2f70c95c8a2341289f73a2d348036
2020-04-25 15:05:24 +00:00
Marco Nelissen
172e6fc12a Merge "com.android.media apex uses sonivox without jet" into rvc-dev 2020-04-25 14:49:51 +00:00
Treehugger Robot
dcbc580195 Merge "Set apex_available property" am: 8c79615594 am: 75d9dae1e8
Change-Id: I79473f28becd80fd9bcf38db41762b2710c02cfb
2020-04-25 08:08:08 +00:00
Treehugger Robot
8c79615594 Merge "Set apex_available property" 2020-04-25 07:38:33 +00:00
Jiyong Park
62304bbeec Add test_for property
This change adds 'test_for' property to cc_test_* types. The property is
used to mark a module as a test for one or more APEXes, in which case
the module has accecss to the private part of the listed APEXes. For
example, the module is linked with the actrual shared library in the
APEX instead of the stub of the shared library.

Exempt-From-Owner-Approval: already +2'ed by owner

Bug: 129539670
Bug: 153046163
Test: m
Change-Id: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
2020-04-25 06:25:42 +00:00
Jooyung Han
28a49820e4 Merge "Apex: support codenames for min_sdk_version" 2020-04-25 04:41:44 +00:00
Jooyung Han
65cd0f0caa apex: respect filename property for apk-in-apex
android_app_import supports filename: property, which overrides .apk
filename.

Now, apex packaging rule respects it too.
(Previously, apex packaging ignored it)

Bug: 152163837
Test: m  (soong tests amended)
Merged-In: I72e2f1c923f4d01c42a87bf2232a025adca4c918
Change-Id: I72e2f1c923f4d01c42a87bf2232a025adca4c918
(cherry picked from commit 39ee119de2)
2020-04-25 02:25:39 +09:00
Jooyung Han
40b286ceea apex: Don't run apex mutators if disabled
apex_deps/apex/apex_flattened mutators don't have to run if module is
disabled.

For some branches which have no valid targets, apex modules are disabled
by the os mutator. e.g. aosp-build-tools

Some enforcement checks which run during those mutators may fail because
build-environment doesn't provide full context information.

For example, "Platform_version_all_codenames" config variable is not
set while apex.min_sdk_version uses one of those codenames.

Bug: 152655956
Test: m
Merged-In: I47e27d2d025ba4c36534708b113ce77c4cb2397b
Change-Id: I47e27d2d025ba4c36534708b113ce77c4cb2397b
(cherry picked from commit 49f6701e9a)
2020-04-25 02:22:28 +09:00
Marco Nelissen
917f1ca528 com.android.media apex uses sonivox without jet
which is now marked as apex_available in the sonivox Android.bp

Bug: 151448144
Test: build
Change-Id: Ie1e83e964aa544dced42db6a6a38303e27306faf
2020-04-24 10:21:54 -07:00
Treehugger Robot
571bb52259 Merge "android_app_import is now ApexModule" am: 65c1d14cfa am: 2b4f7797d9
Change-Id: If2ed96cdf6c15bbfdc0619a478303a0836b55e0f
2020-04-24 12:41:32 +00:00
Jiyong Park
89e850ab84 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-24 21:40:13 +09:00
Treehugger Robot
65c1d14cfa Merge "android_app_import is now ApexModule" 2020-04-24 12:12:23 +00:00
Ulyana Trafimovich
b59f9f2d52 Merge "Add "updatable" property to ApexModule interface." am: dc9510537a am: 0f4722751b
Change-Id: I475093d9bf96a94a54f4c64ad409f63a28b2ee95
2020-04-24 09:05:01 +00:00
Ulyana Trafimovich
dc9510537a Merge "Add "updatable" property to ApexModule interface." 2020-04-24 08:25:34 +00:00
Treehugger Robot
fd6b26abc1 Merge "Remove libopus from apex_available whitelist" am: f4dc25b476 am: a1c10cf43c
Change-Id: I15695035a45c934faec13384fef7bb8ad08d17ca
2020-04-24 01:07:26 +00:00
Ulya Trafimovich
7c140d828a Add "updatable" property to ApexModule interface.
For a given variant of a module that implements ApexModule interface,
the "updatable" property tests if this variant comes from an updatable
apex. For platform variants it is always false.

Test: lunch aosp_walleye-userdebug && m nothing
Bug: 138994281
Change-Id: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
2020-04-23 11:58:53 +01:00
Jiyong Park
592a6a41de android_app_import is now ApexModule
Like other prebuilts (java_import, etc.), android_app_import has now
became ApexModule. It means it supports APEX-specific properties like
apex_available, min_sdk_version, etc.

Bug: 154488897
Test: m
Change-Id: I86f02771496ffc68c98a50ddfc786788fa1e05fb
2020-04-23 19:02:04 +09:00
Jooyung Han
47db5adb06 Remove libopus from apex_available whitelist
libopus sets its own apex_available property.

Bug: 150999716
Test: m
Change-Id: I4cff3ebb7e017a1fb629b18b72238acf3df0d26e
2020-04-23 15:54:23 +09:00
Jiyong Park
71f42846a3 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Merged-In: I11a4e877ee27f7c55e2f00371c6fa58daedb1a9f
Change-Id: I11a4e877ee27f7c55e2f00371c6fa58daedb1a9f
2020-04-22 23:12:42 +09:00
Paul Duffin
f8b9e51f33 Remove conscrypt.module.intra.core.api.stubs from apex white list
It is no longer needed because non-static java_library dependencies are
not considered to be part of the depending APEX.

Bug: 153443117
Bug: 153306490
Test: m nothing
Merged-In: I7d58d1047b2d400395a253e492b35008284778ff
Change-Id: I7d58d1047b2d400395a253e492b35008284778ff
2020-04-22 12:51:53 +01:00
Paul Duffin
3766cb7b6a Ignore PrebuiltDepTag when processing APEX contents
When a source and a prebuilt module are present in the same build a
dependency is added from the source module to the prebuilt module.
Previously, the code for generating the APEX did not recognize that
tag and in some cases (e.g. for cc_(prebuilt_)library_shared) will
fail the build.

This change:
1) Adds a test to reproduce the problem.
2) Improves the debug message by pretty printing the tag.
3) Adds a new ExcludeFromApexContents interface that can be implemented
   by a tag to declare that it should be excluded from the APEX
   contents.
4) Ignores tags that implement that interface when generating APEX
   contents.
5) Implements that interface on prebuiltDependencyTag to fix the
   test.

Bug: 153326844
Bug: 153306490
Test: m nothing
Merged-In: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
Change-Id: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
2020-04-22 12:51:52 +01:00
Paul Duffin
b20ad0a7d4 Stop requiring apex_available on java_library members of sdks
Previously, adding java_library to an sdk required that the names of
any APEXes that transitively compiled against it were added to its
apex_available property. This change removes that requirement.

Also corrects the dependency path in the TestApexAvailable_IndirectDep
error which previously passed through "shared from static" static
dependency tags even though those are explicitly NOT followed when
checking apex_available settings.

Bug: 152878661
Bug: 153306490
Test: m droid
Merged-In: I995ed38956c1bc210b09494812de012fed9f9232
Change-Id: I995ed38956c1bc210b09494812de012fed9f9232
2020-04-22 12:51:51 +01:00
Paul Duffin
f020796cad Add dependency tags to apex available errors
Having dependency tags in the dependency path that shows why a specific
module is considered part of an apex makes it easier to understand why
that is the case and detect possible issues.

Bug: 152762638
Bug: 153306490
Test: m nothing
Merged-In: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
Change-Id: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
2020-04-22 12:51:51 +01:00
Paul Duffin
03e7d0ca9c Extract DepIsInSameApex and RequiredSdks interfaces
The DepIsInSameApex() and RequiredSdks() methods were defined in a few
places to avoid having to depend on the whole ApexModule/SdkAware
interfaces directly. However, that has a couple of issues:
1) It duplicates functionality making it difficult to change, changes
   to the definitions outside the main interfaces do not cause compile
   time failures, instead they result in a runtime change in behavior
   which can be difficult to debug.
2) IDE navigation (specifically in Intellij) does not detect that the
   duplicate definitions can resolve to the definitions in the main
   interface.

This change extracts the methods into their own interfaces and reuses
those interfaces instead of duplicating the methods to fix both of
these issues.

Bug: 152878661
Bug: 153306490
Test: m nothing
Merged-In: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
Change-Id: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
2020-04-22 12:51:50 +01:00
Paul Duffin
133608f602 Allow walkPayloadDeps visitor to control walk flow
Delegate the responsibility for determining whether the
walkPayloadDeps() should visit a child dependency to its do function.
This is needed to allow the visitor in checkApexAvailability() to avoid
checking the apex_available setting after crossing the APEX boundary.

Bug: 152878661
Bug: 153306490
Test: m droid
Merged-In: If46a2f74b6eca670befc3aeae430650e85542346
Change-Id: If46a2f74b6eca670befc3aeae430650e85542346
2020-04-22 12:51:48 +01:00
Paul Duffin
868ecfde70 Improve missing apex_available message
The apex available check can traverse quite a long path (5+ steps) to
get from the apex to a module that is missing the apex from its
apex_available property. Understanding where that dependency came from
can often require examining the dependency path which can be difficult.
This change adds the path to the error to simplify that process.

Bug: 153306490
Test: m nothing
Bug: 152762638
Merged-In: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
Change-Id: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
2020-04-22 12:51:47 +01:00
Paul Duffin
de7464cddc Split TestApexAvailable into separate tests
Having multiple tests within one method makes debugging specific
failures more difficult so this change split the TestApexAvailable
test into multiple separate tests.

Bug: 153306490
Test: m nothing
Bug: 152762638
Merged-In: I2b2408ef515fd79c078686ef29a6ee8fb0407e7e
Change-Id: I2b2408ef515fd79c078686ef29a6ee8fb0407e7e
2020-04-22 12:51:46 +01:00
Paul Duffin
404db3f4e8 Copy white listed apex available settings into snapshot
Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
2020-04-22 12:51:37 +01:00
Paul Duffin
37a9aa24cc Remove special handling of test_ apexes
Test apexes no longer check to see whether their contents are available
so the special handling is no longer necessary.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iecae7dcbb87908d19c672f74d3c1ed8810d4485b
Change-Id: Iecae7dcbb87908d19c672f74d3c1ed8810d4485b
2020-04-22 12:51:36 +01:00
Paul Duffin
c23d9f652b Remove special handling of com.android.art.debug/release
The whitelistedApexAvailable used to map references to
com.android.art.debug/release to com.android.art before looking it up
in the white list. This change removed that mapping and simply added
both to the white list.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ibad76fb73988688eb303e056197986ee9a6119ae
Change-Id: Ibad76fb73988688eb303e056197986ee9a6119ae
2020-04-22 12:51:35 +01:00
Jiyong Park
d5e0ea25d1 Don't run apex_available check for coverage builds
Coverage build adds extra dependencies for the runtime libs. Marking
them and their transitive dependenciese with apex_available doesn't make
any value; it instead adds noise.

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

Bug: 150999716
Test: m
Merged-In: I08e51cec1de6ded624ef9d4c41c1e5b2e611ff38
(cherry picked from commit 58d1090032)
Change-Id: I08e51cec1de6ded624ef9d4c41c1e5b2e611ff38
2020-04-20 16:26:18 +09:00
Jiyong Park
d182e5512f Remove some apex_available whitelist for the adbd APEX
The marked library(ies) were available to the adbd APEX via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

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

Bug: 150999716
Test: m
Merged-In: I6afbe905dda11056559521b937803dcd85b32fe5
(cherry picked from commit 3a0db5ef4e)
Change-Id: I6afbe905dda11056559521b937803dcd85b32fe5
2020-04-20 16:24:20 +09:00
Jiyong Park
24eec07f47 Make ndk_prebuilt_* be available to any apex
The NDK prebuilts are implicitly used when building with sdk_version set.
Make the module types be available to any apex so that we don't need to
manually add apex_available property to the module definitions manually.

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

Bug: 150999716
Test: m

Merged-In: I0870afa4c74b4a06ab1273dff84615778561ecc9
(cherry picked from commit e01e228270)
Change-Id: I0870afa4c74b4a06ab1273dff84615778561ecc9
2020-04-20 16:23:46 +09:00
Jiyong Park
2416c2903e Remove some apex_available whitelist
The marked library(ies) were available to the APEXes via the hand-written
whitelist in build/soong/apex/apex.go. Trying to remove the whitelist
by adding apex_available property to the Android.bp of the libraries.

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

Bug: 150999716
Test: m
Merged-In: I91d1b1076733a949ca2a959ba640ce34d0233492
(cherry picked from commit 541142ce6b)
Change-Id: I91d1b1076733a949ca2a959ba640ce34d0233492
2020-04-20 16:22:56 +09:00
Jooyung Han
0b2255f411 Merge "apex: respect filename property for apk-in-apex" am: 79a24f2ca8 am: 4c70b2800f
Change-Id: I8077fdf16054e2c1f958af4a2ce4452767b5fa8f
2020-04-18 03:22:38 +00:00
Jooyung Han
79a24f2ca8 Merge "apex: respect filename property for apk-in-apex" 2020-04-18 02:23:07 +00:00
Jooyung Han
cab7283b6b apex: Don't run apex mutators if disabled am: 49f6701e9a am: c080abef85
Change-Id: I897cba2391532ba33b2be9552f1f5eea1198bc3a
2020-04-17 13:47:47 +00:00
Jooyung Han
49f6701e9a apex: Don't run apex mutators if disabled
apex_deps/apex/apex_flattened mutators don't have to run if module is
disabled.

For some branches which have no valid targets, apex modules are disabled
by the os mutator. e.g. aosp-build-tools

Some enforcement checks which run during those mutators may fail because
build-environment doesn't provide full context information.

For example, "Platform_version_all_codenames" config variable is not
set while apex.min_sdk_version uses one of those codenames.

Bug: 152655956
Test: m
Change-Id: I47e27d2d025ba4c36534708b113ce77c4cb2397b
2020-04-17 15:49:32 +09:00
Jooyung Han
055418a56a apex: remove compat symlinks to vndk apex
For R+, symlinks from /system/lib to VNDK APEX are not necessary. (Note
that, symlinks to older VNDK are still necessary because older vendor
may access old locations.)

Hence, do not make symlinks for R+ VNDK APEX.

Bug: 142911355
Test: m # check /system/lib[64]/ for symlinks
        # cf should contain 28/29 symlinks but no symlinks for R
Exempt-From-Owner-Approval: cp from internal
Merged-In: I852fad7edebed3e4edc03c374b3643da6b053fed
Change-Id: I852fad7edebed3e4edc03c374b3643da6b053fed
(cherry picked from commit 84026389e7)
2020-04-16 04:01:48 +00:00
TreeHugger Robot
89030a315a Merge "Clean com.android.neuralnetworks APEX whitelist" into rvc-dev 2020-04-14 12:21:42 +00:00
Jooyung Han
b3650211b9 apex: remove compat symlinks to vndk apex am: 84026389e7
Change-Id: I3cd02a9bce9ade0bcc5c418616bc5009205953a4
2020-04-14 09:19:36 +00:00
Jooyung Han
84026389e7 apex: remove compat symlinks to vndk apex
For R+, symlinks from /system/lib to VNDK APEX are not necessary. (Note
that, symlinks to older VNDK are still necessary because older vendor
may access old locations.)

Hence, do not make symlinks for R+ VNDK APEX.

Bug: 142911355
Test: m # check /system/lib[64]/ for symlinks
        # cf should contain 28/29 symlinks but no symlinks for R
Change-Id: I852fad7edebed3e4edc03c374b3643da6b053fed
2020-04-14 14:22:31 +09:00
Jooyung Han
73d20d086d Build VNDK APEX for VNDK-Lite
For VNDK-Lite devices, which doesn't define BOARD_VNDK_VERSION, VNDK
APEX is built with only VNDK-Sp libraries with core variants.

Bug: 141908078
Bug: 152353068
Bug: 151635128
Test: TH
Merged-In: I0d08d32473368fd158818d4c2c72fc4cfad68ce6
Change-Id: I0d08d32473368fd158818d4c2c72fc4cfad68ce6
(cherry picked from commit 65d8a6262c)

Exempt-From-Owner-Approval: cp from internal
Change-Id: I0d08d32473368fd158818d4c2c72fc4cfad68ce6
2020-04-09 23:27:25 +00:00
Ulya Trafimovich
cc21bba967 Forbid generating boot image files for jars in updatable modules.
This is to guard against the potential situation when someone adds
updatable modules to the list of boot jars by mistake.

Test: aosp_walleye-userdebug builds.

Test: Manually break the checks and observe the errors:
  - move updatable module 'conscrypt' from
    PRODUCT_UPDATABLE_BOOT_JARS to ART_APEX_JARS:
      internal error: module 'conscrypt' from updatable apex 'com.android.conscrypt' is not allowed in the ART boot image

  - add updatable module 'conscrypt' to ART_APEX_JARS
    (but do not remove it from PRODUCT_UPDATABLE_BOOT_JARS):
      error: A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but conscrypt is.

  - move updatable module 'framework-tethering' from
    PRODUCT_UPDATABLE_BOOT_JARS to PRODUCT_BOOT_JARS:
      internal error: module 'framework-tethering' from updatable apex 'com.android.tethering' is not allowed in the framework boot image

  - add non-updatable (in AOSP) module 'android.net.ipsec.ike'
    to PRODUCT_BOOT_JARS:
      internal error: failed to find a dex jar path for module 'com.android.ipsec.ike', note that some jars may be filtered out by module constraints

Bug: 147579140

Exempt-From-Owner-Approval: cherry-pick, approved in AOSP.

Change-Id: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
Merged-In: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
(cherry picked from commit b28cc3758c)
2020-04-09 14:50:21 +01:00
Treehugger Robot
2b7c2e877b Merge "Clean com.android.neuralnetworks APEX whitelist" am: 0d4b9e32d0 am: 8e49cf8502
Change-Id: If3f8b2c319aafb2a5b759b13360ec7f1d6c1a9e8
2020-04-09 12:53:19 +00:00
Treehugger Robot
0d4b9e32d0 Merge "Clean com.android.neuralnetworks APEX whitelist" 2020-04-09 12:16:37 +00:00
Jooyung Han
aed150d6ed Apex: support codenames for min_sdk_version
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.

Bug: 152655956
Test: m
Merged-In: I077ad7b2ac5d90b4c8708921e43846206f05ba70
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
(cherry picked from commit 29e91d2121)
2020-04-09 16:04:17 +09:00
Treehugger Robot
8c8763567d Merge "Remove conscrypt.module.intra.core.api.stubs from apex white list" am: b54015fa54 am: b9fd69e8af
Change-Id: I5338969f71eb6a39606d4f9627ea2c8fbc14e7d8
2020-04-09 02:31:29 +00:00
Treehugger Robot
b54015fa54 Merge "Remove conscrypt.module.intra.core.api.stubs from apex white list" 2020-04-09 02:06:41 +00:00
Colin Cross
c27185cd72 Merge "Revert^2 "Add sdk mutator for native modules"" am: ff550f3e13 am: 7af7725de1
Change-Id: I9a947c10e593f7b1647440acca4de08952e7928e
2020-04-08 18:42:10 +00:00
Colin Cross
ff550f3e13 Merge "Revert^2 "Add sdk mutator for native modules"" 2020-04-08 18:29:30 +00:00
Paul Duffin
e2cfe9ce92 Remove conscrypt.module.intra.core.api.stubs from apex white list
It is no longer needed because non-static java_library dependencies are
not considered to be part of the depending APEX.

Bug: 153443117
Test: m nothing
Change-Id: I7d58d1047b2d400395a253e492b35008284778ff
2020-04-08 19:12:58 +01:00
Jooyung Han
f8300fdce1 Apex: add NeverAllowRule for updatable am: e17caa63a6
Change-Id: Ie893bf23a57083b594cd0fc5c09adb7a38322969
2020-04-08 15:56:17 +00:00
Paul Duffin
2842d14c50 Merge "Ignore PrebuiltDepTag when processing APEX contents" am: 846e60dbc7 am: 246bbcc5e2
Change-Id: Ia5482682e8673cd0721c6029d03e222a9e0aefe1
2020-04-08 14:59:24 +00:00
Paul Duffin
3e5c8b4995 Merge "Stop requiring apex_available on java_library members of sdks" am: f76c64018e am: c8c4a962d4
Change-Id: I8655a0889bb8bb089e16107ec29a1c559cb290b0
2020-04-08 14:59:16 +00:00
Paul Duffin
846e60dbc7 Merge "Ignore PrebuiltDepTag when processing APEX contents" 2020-04-08 14:28:47 +00:00
Paul Duffin
f76c64018e Merge "Stop requiring apex_available on java_library members of sdks" 2020-04-08 14:26:39 +00:00
Ulyana Trafimovich
7c9b35f2ad Merge "Forbid generating boot image files for jars in updatable modules." am: 0d8f61640e am: 73864e0b04
Change-Id: Iab5db838aa4cd782aeac7d58923f698b7f624d7a
2020-04-08 12:43:10 +00:00
Ulyana Trafimovich
0d8f61640e Merge "Forbid generating boot image files for jars in updatable modules." 2020-04-08 12:15:47 +00:00
Paul Duffin
a726a11db1 Add dependency tags to apex available errors am: c519244cd5 am: e554326df5
Change-Id: I981156a84819badf8f24e79beffa2f51a41e06be
2020-04-08 11:40:00 +00:00
Paul Duffin
dddd5469ad Ignore PrebuiltDepTag when processing APEX contents
When a source and a prebuilt module are present in the same build a
dependency is added from the source module to the prebuilt module.
Previously, the code for generating the APEX did not recognize that
tag and in some cases (e.g. for cc_(prebuilt_)library_shared) will
fail the build.

This change:
1) Adds a test to reproduce the problem.
2) Improves the debug message by pretty printing the tag.
3) Adds a new ExcludeFromApexContents interface that can be implemented
   by a tag to declare that it should be excluded from the APEX
   contents.
4) Ignores tags that implement that interface when generating APEX
   contents.
5) Implements that interface on prebuiltDependencyTag to fix the
   test.

Bug: 153326844
Test: m nothing
Change-Id: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
2020-04-08 08:40:44 +01:00
Paul Duffin
6534770793 Stop requiring apex_available on java_library members of sdks
Previously, adding java_library to an sdk required that the names of
any APEXes that transitively compiled against it were added to its
apex_available property. This change removes that requirement.

Also corrects the dependency path in the TestApexAvailable_IndirectDep
error which previously passed through "shared from static" static
dependency tags even though those are explicitly NOT followed when
checking apex_available settings.

Bug: 152878661
Test: m droid
Change-Id: I995ed38956c1bc210b09494812de012fed9f9232
2020-04-08 08:40:44 +01:00
Paul Duffin
c519244cd5 Add dependency tags to apex available errors
Having dependency tags in the dependency path that shows why a specific
module is considered part of an apex makes it easier to understand why
that is the case and detect possible issues.

Bug: 152762638
Test: m nothing
Change-Id: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
2020-04-08 08:40:44 +01:00
Paul Duffin
7b49cfc537 Merge "Extract DepIsInSameApex and RequiredSdks interfaces" am: 2010598a51 am: 2a9b7c8791
Change-Id: I825f791ccecd83be6060654a36403756ace30d23
2020-04-08 07:26:23 +00:00
Jooyung Han
e17caa63a6 Apex: add NeverAllowRule for updatable
to enforce that apexes that set updatable: true also set min_sdk_version

Bug: 152655956
Test: m
Change-Id: I0d2e9f9b3234873de073ab82d91211faedd16498
2020-04-08 05:20:11 +00:00
Jooyung Han
72e5c957d4 Merge "Build VNDK APEX for VNDK-Lite" into rvc-dev am: 3978d03fb7
Change-Id: Idfbf9f998c7a8228a8b873274a91bca72b9f71f5
2020-04-07 17:06:56 +00:00
Colin Cross
c511bc50dc Revert^2 "Add sdk mutator for native modules"
f8e80229fe

Change-Id: Ic30ab6b844684bfc3e8ece5a1913980d5fbf8de2
2020-04-07 16:50:32 +00:00
Jooyung Han
3978d03fb7 Merge "Build VNDK APEX for VNDK-Lite" into rvc-dev 2020-04-07 16:49:39 +00:00
Ulya Trafimovich
b28cc3758c Forbid generating boot image files for jars in updatable modules.
This is to guard against the potential situation when someone adds
updatable modules to the list of boot jars by mistake.

Test: aosp_walleye-userdebug builds.

Test: Manually break the checks and observe the errors:
  - move updatable module 'conscrypt' from
    PRODUCT_UPDATABLE_BOOT_JARS to ART_APEX_JARS:
      internal error: module 'conscrypt' from updatable apex 'com.android.conscrypt' is not allowed in the ART boot image

  - add updatable module 'conscrypt' to ART_APEX_JARS
    (but do not remove it from PRODUCT_UPDATABLE_BOOT_JARS):
      error: A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but conscrypt is.

  - move updatable module 'framework-tethering' from
    PRODUCT_UPDATABLE_BOOT_JARS to PRODUCT_BOOT_JARS:
      internal error: module 'framework-tethering' from updatable apex 'com.android.tethering' is not allowed in the framework boot image

  - add non-updatable (in AOSP) module 'android.net.ipsec.ike'
    to PRODUCT_BOOT_JARS:
      internal error: failed to find a dex jar path for module 'com.android.ipsec.ike', note that some jars may be filtered out by module constraints

Bug: 147579140

Change-Id: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
2020-04-07 17:09:59 +01:00
Paul Duffin
923e8a5e9e Extract DepIsInSameApex and RequiredSdks interfaces
The DepIsInSameApex() and RequiredSdks() methods were defined in a few
places to avoid having to depend on the whole ApexModule/SdkAware
interfaces directly. However, that has a couple of issues:
1) It duplicates functionality making it difficult to change, changes
   to the definitions outside the main interfaces do not cause compile
   time failures, instead they result in a runtime change in behavior
   which can be difficult to debug.
2) IDE navigation (specifically in Intellij) does not detect that the
   duplicate definitions can resolve to the definitions in the main
   interface.

This change extracts the methods into their own interfaces and reuses
those interfaces instead of duplicating the methods to fix both of
these issues.

Bug: 152878661
Test: m nothing
Change-Id: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
2020-04-07 15:26:06 +01:00