Commit graph

2654 commits

Author SHA1 Message Date
Ulya Trafimovich
e5b2b49a73 Update variable name in error messages.
Variable PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS was renamed to
PRODUCT_APEX_SYSTEM_SERVER_JARS in https://r.android.com/1779472.

Bug: 191127295
Test: m nothing
Change-Id: I0c8ae839cab443c824760b40d30b4374982010f9
2021-10-04 15:43:39 +01:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Salmax Chang
12d6b80da2 Merge changes from topic "bb_201948713" am: 8bb9c6a1d9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1844137

Change-Id: Ia042b5b24141be4ebfa17ab15adf34c3af632635
2021-10-04 08:13:19 +00:00
Salmax Chang
8194d61ae0 Revert "Separate hidden API flags needed in sdk snapshots for S and T"
This reverts commit ba68c93630.

Reason for revert: suspect to cause build break in b/201948713

Change-Id: Ide3693ac1f8e24bd2f7c12857361885cb6b787ef
2021-10-04 05:28:58 +00:00
Paul Duffin
afe55d6598 Merge "Separate hidden API flags needed in sdk snapshots for S and T" am: 6b383e9ef2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835222

Change-Id: I092500dc977cc482a6c662ae9fcd4e71fea32810
2021-10-02 11:34:00 +00:00
Paul Duffin
ba68c93630 Separate hidden API flags needed in sdk snapshots for S and T
Previously, the behavior of the stub_flags and all_flags properties
was different between S and T. In S they contained paths for the
complete set of stub flags and all the encoded flags. However, in T
they contained filtered sets of flags which if used in S would prevent
build checks from detecting possible inconsistencies. Also, a new
signature_patterns property was added in T that is not supported in S.

This change creates separate properties/files for T and reverts the
behavior of the properties/files that were added in S back to how they
behaved in S. The new properties are called filtered_stub_flags and
filtered_flags.

The S and T properties are tagged with the appropriate
supported_build_releases tag to ensure that they are only output when
specifically targeted.

Bug: 197842263
Test: m nothing
Change-Id: Iec8b9c539796c507245b69c0aed980fde6d8694f
2021-10-01 17:28:13 +01:00
Jiakai Zhang
d20f37f014 Merge changes I7876b077,Ib2e7d5e6,I7d2d2e02,Ibf5322f8 am: dcc42b6f7e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835088

Change-Id: Ifefcf876e203406967f44c035495dbba49c4362f
2021-09-30 15:24:48 +00:00
Jiakai Zhang
dcc42b6f7e Merge changes I7876b077,Ib2e7d5e6,I7d2d2e02,Ibf5322f8
* changes:
  Generate prebuilt_systemserverclasspath_fragment.
  Add a new SDK member type java_systemserver_libs.
  Add exported_systemserverclasspath_fragments to prebuilt_apex rule.
  Add prebuilt_systemserverclasspath_fragment rule.
2021-09-30 15:13:45 +00:00
Treehugger Robot
84de371ad9 Merge "Call InstallFile even when !installable" am: a07b559571
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1836921

Change-Id: I9c18959a7733877c1b3adddd8251bd0539205913
2021-09-30 10:15:12 +00:00
Jiakai Zhang
774dd305f4 Add exported_systemserverclasspath_fragments to prebuilt_apex rule.
This is for exporting the contents of systemserverclasspath_fragment for
dexpreopting.

Bug: 194150908
Test: manual - 1. Patch aosp/1818020 and aosp/1834534
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Change-Id: I7d2d2e02869d8a523f7c0efbbff81706672a95c5
2021-09-30 10:06:21 +00:00
Jiakai Zhang
c9864278da Add prebuilt_systemserverclasspath_fragment rule.
This is the prebuilt side of systemserverclasspath_fragment, currently
for used for dexpreopting.

The change to automactially generate
prebuilt_systemserverclasspath_fragment rules will be in a separate CL.

Bug: 194150908
Test: m nothing
Change-Id: Ibf5322f80f78ac3ca037489f4a279456fe38a23f
2021-09-30 10:05:58 +00:00
Jiyong Park
17ff2838fc Call InstallFile even when !installable
Not calling InstallFile when !installable prevents the module not only
from being installed to the partition, but also from being packaged for
a packaging_base. InstallFile already has a routine for not generating
the install rule when the module is not installable. So, the check for
can be safely omitted at the call site.

Bug: 199674764
Test: m com.android.virt. the virt apex has
com.android.runtime.64only.apex in system/apex

Change-Id: I0249f5916496ed136dbf1978e04e2971852de244
2021-09-28 00:02:54 +00:00
Martin Stjernholm
40fc93fb3c Merge changes I957f3df8,I68986dcc am: cf6bf37d04
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829372

Change-Id: Ifcf471f2746c1037b83c2a11b8f5120b86fd6cb2
2021-09-24 09:44:00 +00:00
Martin Stjernholm
4482560cc7 Consolidate the code to resolve a deapexer module dependency.
It will get more logic in upcoming CLs.

Add a property to DeapexerInfo for the APEX name, for use in error
messages.

Test: m nothing
Bug: 192006406
Change-Id: I957f3df8b34543a38cde38768dac93e78132d672
2021-09-23 17:19:55 +01:00
Martin Stjernholm
8be1e6db16 Propagate the dex jar path as an OptionalPath which is either valid or
invalid with a message.

This will allow propagating any error from the deapexer module for
prebuilt APEXes to the location where the dex jars get used. It's only
at those points that we can raise errors about not being able to
extract files from the deapexer modules if they are invalid, and this
way we avoid encoding knowledge there about why they may be invalid.

To keep the refactoring limited it intentionally does not change any of
the existing logic for when dexJarFiles are set or not (non-nil vs nil
prior to this change), although there may be opportunity to use this
for more conditions when dex jars aren't available.

The refactoring is also not extended to
dexpreopt.ClassLoaderContextMap.

Test: m nothing
Bug: 192006406
Change-Id: I68986dccd9a9b3fee4d24caa1947ea17a36caedc
2021-09-23 17:19:55 +01:00
Treehugger Robot
45dd37c6e3 Merge "Add test to TestJavaStableSdkVersion for legacy core platform" am: 3769a27c5e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655611

Change-Id: I752f24a2e6b9763019866402a8af6adb3e96ee2a
2021-09-20 14:20:18 +00:00
Treehugger Robot
3769a27c5e Merge "Add test to TestJavaStableSdkVersion for legacy core platform" 2021-09-20 14:04:35 +00:00
Jiakai Zhang
23a5cba0af Merge changes I9c94a54a,Idc0c73a7 am: 2c6ede11cc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824513

Change-Id: I1f3ce39cd3b3988e676791a59f0c70e2bc80015d
2021-09-17 11:33:22 +00:00
Jiakai Zhang
dc2c1c2625 Merge "Revert^2 "Preopt APEX system server jars."" am: c9f9d56ed4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1828115

Change-Id: I2a991341934af96455f136cbe44ef824f5e3e7f5
2021-09-17 11:33:13 +00:00
Jiakai Zhang
2c6ede11cc Merge changes I9c94a54a,Idc0c73a7
* changes:
  Preopt system server jars with updatable bootclasspath.
  Preopt APEX system server jars from prebuilts.
2021-09-17 11:20:10 +00:00
Jiakai Zhang
c9f9d56ed4 Merge "Revert^2 "Preopt APEX system server jars."" 2021-09-17 11:19:51 +00:00
Martin Stjernholm
44cbc71c78 Merge "Remove fallback code path for missing BCP fragments that is no longer necessary." am: 33ce5d6c0e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821658

Change-Id: I145f398e8b22cca8e9e91a62d83cbb2014032261
2021-09-16 14:48:57 +00:00
Martin Stjernholm
33ce5d6c0e Merge "Remove fallback code path for missing BCP fragments that is no longer necessary." 2021-09-16 14:38:01 +00:00
Paul Duffin
1ea7c9fa52 Add test to TestJavaStableSdkVersion for legacy core platform
Adds a test case to TestJavaStableSdkVersion for the case where a
module uses sdk_version: "core_platform" but is in the list of modules
that can use the legacy version.

This required storing the lookup map in the Config to allow it to be
customized for the test.

Bug: 180399951
Test: m nothing
Change-Id: I404705c3fd8a559649c6ab2624856cf78f49f85c
2021-09-16 11:12:43 +01:00
Jiakai Zhang
519c5c82e5 Revert^2 "Preopt APEX system server jars."
This reverts commit 92346c4832.

Reason for revert: Fixed build error.

The build error is fixed by ag/15841934. This CL remains unchanged. This
CL will be submitted AFTER ag/15841934 is submitted.

Bug: 200024131
Test: 1. Patch this CL and ag/15841934 into internal master.
  2. sudo vendor/google/build/build_test.bash

Change-Id: I5f2b8357846fc7dda56e25ebe6ffb095e8047ec8
2021-09-16 06:25:26 +00:00
Treehugger Robot
6e5aabb91b Merge "Share cFlags, tidyFlags, etc. in a module" am: b1a12462a9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824024

Change-Id: Iaf6050178f9d172a5a17103504e8f081277df9cf
2021-09-16 02:35:38 +00:00
Martin Stjernholm
b1e61cb8bc Remove fallback code path for missing BCP fragments that is no longer
necessary.

#codehealth

Test: m nothing
Bug: 179354495
Change-Id: Iaddf163e69b52cef82d522311e81bef9bdb4aa8d
2021-09-16 00:55:53 +01:00
Chih-Hung Hsieh
b8082295b6 Share cFlags, tidyFlags, etc. in a module
* In builder.go, share common flags in a module.
  * This replaces the sharing of cflags/cppflags/asflags in cc.go.
  * A unit test in apex_test.go now fails and is commented out.
    It is a failing test hidden by old optimization in cc.go.
* In module.go, expand the reference variable $someflags<n>,
  or ${someflags<n>} to keep many existing unit tests work as is.
* The build.ninja size was reduced from 8.1GB to 6.2GB,
  for aosp_arm64-eng WITH_TIDY=1 USE_RBE=true,
  and from 7.5GB to 5.6GB when USE_RBE is 0.
  Content of build.ninja is also more readable and searchable.
  Read/write build.ninja times are also reduced,
  depending on disk I/O speed.

Test: make WITH_TIDY=1
Change-Id: I17f96adf4844136d52e5d40f57a19d9e290162b7
2021-09-15 16:05:41 -07:00
Adrian Roos
755a09490f Merge "Revert "Preopt APEX system server jars."" am: 79839d94c1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1827535

Change-Id: I2281010a93a89b69b859272627c7eac0d7e6d3ed
2021-09-15 14:53:58 +00:00
Adrian Roos
92346c4832 Revert "Preopt APEX system server jars."
This reverts commit ca9bc98e0c.

Reason for revert: breaks build
Bug: 200024131

Change-Id: Ide07b4c4d267370ae31107b1598b2f878c701282
2021-09-15 14:11:07 +00:00
Jiakai Zhang
83d0d8ac1c Preopt APEX system server jars. am: ca9bc98e0c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821984

Change-Id: If42b905c0636b10881b372efafd3e2f9bc84923c
2021-09-15 10:48:53 +00:00
Jiakai Zhang
ca9bc98e0c Preopt APEX system server jars.
The path to the artifacts will in the form of
/system/framework/oat/<arch>/<encoded-jar-path>@classes.{odex,vdex,art},
where <encoded-jar-path> is the path to the jar file with "/" replaced
by "@". For example,
/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex

There will be a follow-up CL to update ART runtime to recognize
artifacts in that path.

Test: m com.android.art
Bug: 194150908
Change-Id: Ic89fd63c4b1cd565684cead83fc91dae3bc97a4c
2021-09-15 09:01:07 +00:00
Jiakai Zhang
204356f3b5 Preopt APEX system server jars from prebuilts.
Similar to the previous CL, but for jars from prebuilts.

Test: manual - 1. Patch aosp/1818020 and aosp/1810840.
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Bug: 194150908
Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
2021-09-15 09:01:07 +00:00
Treehugger Robot
780f559584 Merge "Add system/sepolicy/apex to bp2build allowlist" am: 709f02707d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826628

Change-Id: If90417ce5553bac5acaf448987a661b757665d5f
2021-09-15 08:24:02 +00:00
Liz Kammer
37997c404b Add system/sepolicy/apex to bp2build allowlist
Technically, tzdata apex depends on
//system/sepolicy/apex:com.android.tzdata-file_contexts. Builds suceeded
regardless due to bp2build generating a filegroup for all files in a
directory.

This also requires an update to the check in apex/builder.go to address
the fact that outputs (including filegroups) from Bazel in mixed builds
will be in a Bazel out subdirectory. This change also corrects a
potential bug that would not support all subdirectories under
system/sepolicy as golang's path.Match does not treat ** as recursive.

Test: go test apex tests
Test: build/bazel/ci/mixed_droid.sh
Change-Id: I1076d60cf271e4cdd1ea990156ab0a39fcfa6535
2021-09-14 18:00:22 -04:00
Mohammad Islam
17544fe23a Merge "Relax restriction on suffix of apex_set filename to include .capex" am: 385cde82d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821656

Change-Id: I91189bd060d0c365892234daab5a59b70a8018c7
2021-09-09 09:08:51 +00:00
Samiul Islam
7c02e26cba Relax restriction on suffix of apex_set filename to include .capex
Compressed APEX files generated by the build system have the .capex
extension. This CL allows us using those .capex files with their actual
suffix.

Bug: 197258691
Test: manual + unit test added
Change-Id: I79173ef942326b48b5e659f1873d80f12b212339
2021-09-08 18:29:47 +01:00
Treehugger Robot
b8d4e69927 Merge "Allows prebuilts in override_apex." am: e267bc8f74
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1811097

Change-Id: I732915686e54509c30f6855ea29d562bc83cf680
2021-09-03 16:13:56 +00:00
Treehugger Robot
e267bc8f74 Merge "Allows prebuilts in override_apex." 2021-09-03 16:01:31 +00:00
Daniel Norman
5a3ce13c6a Allows prebuilts in override_apex.
Bug: 197787336
Test: Create an override_apex that uses a different `prebuilts` than its
      base. Observe built contents.
Test: apex_test.go
Change-Id: I7666ed6cfe3f2fa5dd81e5f8c1961477dabbbd3c
2021-09-02 09:28:52 -07:00
Spandan Das
ab47a767d8 Merge "Skip dexbootjar check using AllowMissingDependencies flag" am: b7e5985fd5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1803934

Change-Id: I55ae4c5858330385876eb42e0fa16773ca748150
2021-08-31 16:12:21 +00:00
Spandan Das
b7e5985fd5 Merge "Skip dexbootjar check using AllowMissingDependencies flag" 2021-08-31 16:06:10 +00:00
Lukács T. Berki
8526bc95ef Merge "Rename BuildDir and NinjaBuildDir." am: 5602d33025
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1810356

Change-Id: I6af3316fb122af7a05b71de7f9cd371746bb5f21
2021-08-27 13:54:13 +00:00
Lukacs T. Berki
9f6c24a887 Rename BuildDir and NinjaBuildDir.
These are just out/ and out/soong/ and the old names were quite
confusing.

Test: Presubmits.
Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8
Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7
Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
2021-08-27 10:08:49 +02:00
Treehugger Robot
a88fc3e79e Merge "Make bpfs properties overridable" am: 60dc5c0db2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1810456

Change-Id: Ib8196d660983d724e4ecde5c08a9ab2da979df99
2021-08-27 05:07:16 +00:00
Treehugger Robot
60dc5c0db2 Merge "Make bpfs properties overridable" 2021-08-27 04:57:10 +00:00
markchien
7c803b8746 Make bpfs properties overridable
To support different variable bpfs file between mainline module and
non-updatable module(e.g. Android GO). Make bpfs properties overridable.

Test: m
Bug: 190523685
Change-Id: I4c63e35f74230de94b21f3ceb2beb90f0f9ddb11
2021-08-27 03:03:45 +00:00
Spandan Das
10ea4bf9d4 Skip dexbootjar check using AllowMissingDependencies flag
Soong checks that every module part of a bootclass_fragment provides a
dex boot jar file, even if the module is not a dependency of vendor.img

Using AllowMissingDepdencies() to skip this check allows vendors to be
more aggressive in removing projects from their source tree

Test: In build/soong, run go test ./...
Test: m nothing
Bug: 196306898
Bug: 192616764
Change-Id: I78b062afdc19a6a3251aa8552230f3fcf334b6fb
2021-08-27 02:54:07 +00:00
Colin Cross
8dae8cbcc1 Merge "Support musl builds in Make" am: b37a92ccc8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1797129

Change-Id: I771db86c62207bde3e4ba60569e4d3ebbfe32358
2021-08-26 01:27:24 +00:00
Colin Cross
b37a92ccc8 Merge "Support musl builds in Make" 2021-08-26 01:14:47 +00:00
Jiyong Park
b4adefa58e Merge changes I15328e0b,I731227c2 am: 19312d4224
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1808218

Change-Id: I58224f0fc056f174567241a13d9eb54dbaef5d12
2021-08-25 22:48:34 +00:00
Jiyong Park
5df7bd33f7 crt objects for APEX and vendor variants have correct target API levels
Previously, crt objects for APEX and vendor variants targetted API level
16 regardless of their context. For example, even if BOARD_VNDK_VERSION
is set to 29, or an APEX has `min_sdk_version: "29"`, the target API
level was from `min_sdk_version` property of the crt object which is set
to 16.

The meaning of min_sdk_version is quite different when it comes to crt
objects. It means the lowest API level that it CAN target for. It does
NOT mean the API level it SHOULD always target.

This has caused some other problems like TLS segment underalignment for
vendor libraries because the vendor libraries were all built with TLS
layout from API level 16.

This change fixes the problem by correctly implementing the different
semantic of min_sdk_version for crt objects.

Bug: N/A
Test: m nothing

Change-Id: I15328e0b6cbabbe151dd65c7469c6355e167b78a
2021-08-25 16:26:47 +09:00
satayev
dbd6abe28d Merge "Make sure that classpath fragment contents appear in make vars." am: 28e5eda261
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740313

Change-Id: I216856a16603567c623114d3b5b42506e9dc89b2
2021-08-24 13:40:05 +00:00
satayev
28e5eda261 Merge "Make sure that classpath fragment contents appear in make vars." 2021-08-24 13:29:58 +00:00
Colin Cross
c74ea4b77b Support musl builds in Make
Rewrite linux_musl to linux when exporting to Make.

Bug: 190084016
Test: m USE_HOST_MUSL=true adb
Change-Id: I48eed5bd7380a07c5106a9b2bd96899fb58f7a7f
2021-08-18 22:02:54 +00:00
Liz Kammer
680bd2dd0a Merge "Don't create a new module for bp2build conversion." am: 380dbb9327
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1792714

Change-Id: Ie7d6d5908d06f14121691f7aa0f57c7c7303e67a
2021-08-18 19:44:01 +00:00
Liz Kammer
380dbb9327 Merge "Don't create a new module for bp2build conversion." 2021-08-18 19:28:20 +00:00
Martin Stjernholm
50c2a30ffa Merge "Remove fallback workaround for APEX variants which is now unnecessary." am: 3931b8c70d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1756730

Change-Id: If29fac31f319229cd877d38b3852698815664e54
2021-08-18 08:56:47 +00:00
Liz Kammer
2ada09a546 Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have
the overhead of additional modules. The creation of these modules
results in:
* traversal of additional modules for each subsequent mutator
* synchronization over a go channel to collect newly created modules:
https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3

We avoid both of these by storing the information directly in the
underlying module.

Also as a fringe benefit, removes some necessary boilerplate for
conversion.

For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100%
converted. See more: go/benchmarks-for-https:-r.android.com-1792714

Test: ran benchmarks/tests in bp2build
Test: build/bazel/ci/bp2build.sh
Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
2021-08-17 15:57:09 -04:00
satayev
d34eb0c4a6 Make sure that classpath fragment contents appear in make vars.
The source of truth for what jars are in BOOTCLASSPATH and
SYSTEMSERVERCLASSPATH is make; adding a classpath fragment in soong
with a new jar in the contents without having it declared in make
is wrong (excluding test apexes).

Bug: 191369843
Test: m nothing
Change-Id: Ifd313776ee7ad206031244534ed3870126e4f835
2021-08-16 12:00:25 +01:00
Martin Stjernholm
0e17c1a57e Remove fallback workaround for APEX variants which is now unnecessary.
Test: m nothing
Bug: 191269918
Change-Id: I13091d5ffdd46947899db273b9cb2399dda23907
2021-08-15 22:32:37 +01:00
Paul Duffin
d483d1ac66 Merge "Filter blocked entries from modular flag files" am: 1f0cc77010 am: 78fc6dc40a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1788095

Change-Id: I377eee1d14a930d00f944522d1cc71cd43411175
2021-08-11 19:07:45 +00:00
Paul Duffin
1f0cc77010 Merge "Filter blocked entries from modular flag files" 2021-08-11 18:36:37 +00:00
satayev
4d566bea9b Merge "Fix tests to use correct fixtures for configuring (Apex)BootJars." am: 721f42d12a am: 9958b36643
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1787998

Change-Id: Id9248b6b54547e55c28bb386c867294ec20df873
2021-08-11 16:42:47 +00:00
Paul Duffin
280bae6d20 Filter blocked entries from modular flag files
Previously, the sdk snapshot would include all the entries from the
stub-flags.csv and all-flags.csv modular files generated by a single
bootclasspath_fragment. That included implementation details, i.e.
class members that are not part of a stable API or the hidden API which
meant that the sdk snapshots were implementation dependent.

This change removes the implementation details from the modular flag
files, i.e. those entries that are only marked as "blocked". When
comparing the files against the corresponding subset of the monolithic
files it assumes that any entries missing from the modular flag files
are blocked.

Bug: 194063708
Test: atest --host verify_overlaps_test signature_patterns_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - manually change files to cause difference in flags to check
        that it detects the differences.
Change-Id: I6b67b2253cf029d6830b58a06ebb0c8fcaa0dd71
2021-08-11 17:29:47 +01:00
satayev
721f42d12a Merge "Fix tests to use correct fixtures for configuring (Apex)BootJars." 2021-08-11 16:13:20 +00:00
Colin Cross
390babfeae Merge "Collect lint reports from apps in apexes" am: 7131982a76 am: 3dc9d726ed
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1792871

Change-Id: Ibc44f45a5a8a5ecb977943a2beb26e6e1e465862
2021-08-11 14:44:08 +00:00
Colin Cross
7131982a76 Merge "Collect lint reports from apps in apexes" 2021-08-11 14:15:35 +00:00
Colin Cross
8355c1524f Collect lint reports from apps in apexes
Lint reports were only being collected from jars in apexes, not
apps.

Bug: 188772607
Test: mainline_modules_arm64 build
Change-Id: Ie84819343f8b8ab3f43496bbc9b7876d0d0d8e70
2021-08-10 19:25:59 -07:00
LaMont Jones
0bbc2d0229 Merge "Improve handling of errors from zipinfo" am: b02043b84d am: 4b3afb7798
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1790956

Change-Id: Ibe3bd86d8c2163ff873794be96a25827874b5e29
2021-08-10 18:40:32 +00:00
LaMont Jones
b02043b84d Merge "Improve handling of errors from zipinfo" 2021-08-10 18:12:27 +00:00
satayev
abcd59731e Fix tests to use correct fixtures for configuring (Apex)BootJars.
This is in preparation to r.android.com/1740313 where setting correct
variables would be enforced (i.e. apex and non-apex boot jars must be in
config.ApexBootJars and config.BootJars correspondingly).

Bug: 191369843
Test: m nothing
Change-Id: Ic86680c1f7af53d229083b2cc58beb3ceccb4b6a
2021-08-10 15:35:52 +01:00
LaMont Jones
4224c6216d Improve handling of errors from zipinfo
Bug: 153900481
Test: manual
Change-Id: Ib60578ead4ccaa7ba09f628a6c9281c0cc70e6ce
2021-08-09 19:31:39 +00:00
Kun Niu
f8c99a8012 Merge "Use prebuild modules even when coverage is enabled." into sc-dev am: fe1d6c535c
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15472697

Change-Id: If8bc890561f17a5179a8d655043be1ac36d165f2
2021-08-06 19:31:24 +00:00
Kun Niu
fe1d6c535c Merge "Use prebuild modules even when coverage is enabled." into sc-dev 2021-08-06 19:12:27 +00:00
Paul Duffin
b32b624d71 Separate creation of signature patterns from overlap checking am: 67b9d61ac2 am: 0623c3e8f9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1788091

Change-Id: If9d75256940429dbf6890ca5a07d1806b81e6c53
2021-08-06 16:39:14 +00:00
Paul Duffin
67b9d61ac2 Separate creation of signature patterns from overlap checking
Previously, the signatures used to select the subset of the monolithic
flags were simply the signatures read from the modular flags file. This
change moves the creation of the signature list into a separate script
that outputs the signatures to a file and then passes the path through
Soong from the bootclasspath_fragment modules that create it to the
platform_bootclasspath module that uses it to compare the modular
flags against the monolithic flags.

Currently, the signatures are the full signatures but follow up changes
will replace them with patterns (hence the name) that avoids having to
include implementation details in the hidden API flags that are output
as part of a bootclasspath_fragment's snapshot.

This change moves the stub flags related code next to the all flags
related code as they are treated in a similar way.

Bug: 194063708
Test: atest --host verify_overlaps_test signature_patterns_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - manually change files to cause difference in flags to check
        that it detects the differences.
Change-Id: I2855bf6d05c91b8a09591664185750361c7e644f
2021-08-06 13:40:34 +01:00
Kun Niu
ce1dcf6a9f Use prebuild modules even when coverage is enabled.
Bug: 194323871
Test: local build passed.
Change-Id: I94a3922453473de7d754afce4b05ac3b6ae3765d
2021-08-05 18:15:28 +00:00
Mathew Inwood
766f3510e4 Merge "Update error message for new policy." am: bf49705608 am: 775f9e37c7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784430

Change-Id: Ib4c443c1eae2dc7f840566455b573f255575f875
2021-08-04 10:20:47 +00:00
Mathew Inwood
bf49705608 Merge "Update error message for new policy." 2021-08-04 09:59:33 +00:00
Treehugger Robot
69c6143138 Merge changes Ie2012adb,Ib0283ca6 am: 03beb0ec77 am: 47992dd860
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784476

Change-Id: I7e41072eaf3e953591232b6bb8df6a7c1b961c2a
2021-08-04 05:06:04 +00:00
Treehugger Robot
03beb0ec77 Merge changes Ie2012adb,Ib0283ca6
* changes:
  static rust binaries are also prohibited in APEXes
  Revert "Revert "Prohibit static executable in APEX""
2021-08-04 04:35:20 +00:00
Mathew Inwood
768a01160a Update error message for new policy.
A new presubmit hook enforces that required information is present in
any CL that adds new dependencies to allowed_deps.txt.

Test: m
Bug: 195303213
Change-Id: I1fb932a52f64f9cbf0d12ead75ffd3d9c2a5e942
2021-08-03 14:40:46 +01:00
Jiyong Park
a9baefe81f Merge "Revert "Prohibit static executable in APEX"" am: 2fe71a5165 am: 2af22b8729
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784474

Change-Id: I125a2dfb96277064ff7daa195d4a80c315655879
2021-08-03 08:19:22 +00:00
Jiyong Park
d12979d09a static rust binaries are also prohibited in APEXes
Also fixes a bug that the test runs for host APEXes like
com.android.art.host.

Bug: 185971244
Test: m
Test: build mainline_modules target on aosp-master
Change-Id: Ie2012adbf2f4eda5454d5eaa30f128fb1e20ad37
2021-08-03 07:52:46 +00:00
Jiyong Park
192600a7d0 Revert "Revert "Prohibit static executable in APEX""
This reverts commit 2125aab504.

Reason for revert: relanding along with a forward fix

Change-Id: Ib0283ca6beefa2f3073860287d00553ad0af6317
2021-08-03 07:52:17 +00:00
Jiyong Park
2fe71a5165 Merge "Revert "Prohibit static executable in APEX"" 2021-08-03 07:50:26 +00:00
Yen-Chao Chen
2125aab504 Revert "Prohibit static executable in APEX"
This reverts commit 3a8130c797.

Reason for revert: Build failed.

Change-Id: I28c72c8c3adaeb23bff9bffe3994971aa3f2e4f4
2021-08-03 04:51:12 +00:00
Jiyong Park
42a7f17aa1 Merge "Prohibit static executable in APEX" am: d8a3513155 am: 7986f564b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1779746

Change-Id: Iefdcf93ceb0d0b9654afffe0c03be28af33a9eaf
2021-08-03 04:16:24 +00:00
Jiyong Park
d8a3513155 Merge "Prohibit static executable in APEX" 2021-08-03 03:48:01 +00:00
Huang Jianan
13cac63cc7 Add EROFS support for APEX build system
Bug: 195274797
Test: mmm system/apex/apexer/testdata
Change-Id: I21dbe8b1bfe02d267c710f3c0dd4abaa737cffe0
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-08-02 18:47:25 +08:00
Rupert Shuttleworth
e317474f43 Merge "Add support for prebuilts attribute to the bp2build APEX converter." am: 36a3ef297f am: 5d80f5a189
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1781087

Change-Id: Ib5250493dd8f92befedd654d5dda1c517f6657d1
2021-07-28 12:48:38 +00:00
Rupert Shuttleworth
9447e1ee12 Add support for prebuilts attribute to the bp2build APEX converter.
Test: Updated unit test.

Change-Id: I73dfa84d7a55c0b94393ad6257b5f16313422852
2021-07-28 06:03:17 -04:00
Rupert Shuttleworth
fce917e915 Merge "Add initial bp2build converter support for apex_key modules." am: 8e5b4c5043 am: 7ab55acf47
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778751

Change-Id: Iaad9fbbc7f1dcb2970d22adce8f6d1eba7418972
2021-07-28 08:09:37 +00:00
Rupert Shuttleworth
eb8c85abf5 Add initial bp2build converter support for apex_key modules.
Test: Added unit test.

Change-Id: I1ec2adfcef770ff91bcf35b89d9961f4d2b8a814
2021-07-28 01:45:54 -04:00
Jiyong Park
3a8130c797 Prohibit static executable in APEX
If a library is statically included in a static executable, it's
behavior is different from the case where the same library is statically
(or dynamically) linked to a non-static executable. To reduce the number
of test configs that we need to consider, it is required to prohibit
static executables in APEXes.

Bug: 185971244
Test: m
Change-Id: I0cd8fca669d55088e2329fef1f859eeb297502dd
2021-07-27 22:42:23 +09:00
Rupert Shuttleworth
d0ec532fa6 Add some more properties to the bp2build APEX converter (second try) am: 6e4950a061 am: 6de2c9b72b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778212

Change-Id: Ic13b56e93a31357887d37c21952d5a2fe8d85d87
2021-07-27 10:57:03 +00:00
Rupert Shuttleworth
6e4950a061 Add some more properties to the bp2build APEX converter (second try)
In particular:

- AndroidManifest
- file_contexts
- key
- certificate
- min_sdk_version
- updatable
- installable
- native_shared_libs
- binaries

Test: Updated unit test

Change-Id: I1c6e8c4b6b24ce487f64e5d37bd594dbb000fe6f
2021-07-27 05:02:50 -04:00
Rupert Shuttleworth
53b662e2f3 Merge "Revert "Add some more properties to the bp2build APEX converter."" am: d0e6ad1ab3 am: 8ed074029d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778407

Change-Id: I732ad6808d71b32642fb5892387a6500c31af9d3
2021-07-27 03:25:29 +00:00
Treehugger Robot
b97add46c7 Merge "Add some more properties to the bp2build APEX converter." am: 57dd3c40e8 am: 23c45bb446
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778085

Change-Id: I7274c07caeee96306b69172793a9c9699839b35b
2021-07-27 03:02:43 +00:00
Rupert Shuttleworth
d0e6ad1ab3 Merge "Revert "Add some more properties to the bp2build APEX converter."" 2021-07-27 02:56:56 +00:00
Rupert Shuttleworth
0358478150 Revert "Add some more properties to the bp2build APEX converter."
This reverts commit 69bf4c0d60.

Reason for revert: Possibly broke CI (https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master-bazel&target=bp2build-incremental&lkgb=7266256&fkbb=7237028), rolling back just in case...

Change-Id: I14ebac4f47576a73285d1f724ae4499036e8e678
2021-07-27 02:37:32 +00:00
Treehugger Robot
57dd3c40e8 Merge "Add some more properties to the bp2build APEX converter." 2021-07-27 02:17:51 +00:00
satayev
ad6cb082a4 Merge "Rename UpdatableBootJars to ApexBootJars." am: 4102c0cc47 am: adb9e9f752
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1773912

Change-Id: Iecc5f48620b2d4e5390ab9a081b2193924bd0dda
2021-07-26 18:29:56 +00:00
satayev
4102c0cc47 Merge "Rename UpdatableBootJars to ApexBootJars." 2021-07-26 17:59:36 +00:00
Rupert Shuttleworth
69bf4c0d60 Add some more properties to the bp2build APEX converter.
In particular:

- AndroidManifest
- file_contexts
- key
- certificate
- min_sdk_version
- updatable
- installable
- native_shared_libs
- binaries

Test: Updated unit test

Change-Id: I9ea13f021d63ec0f75006b3b0b23ec8178c7e9da
2021-07-26 07:32:36 -04:00
Paul Duffin
dbcc29647a Build updatable-bcp-packages.txt from prebuilts in sdk snapshot
Previously, the java_import and java_sdk_library_import modules did not
make their permitted_packages available to the rule that generates the
updatable-bcp-packages.txt file. This change corrects that.

Bug: 193095050
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Merged-In: If0706e4551a331b48d383123088e63924dded48b
Change-Id: If0706e4551a331b48d383123088e63924dded48b
(cherry picked from commit 630b11e9d4)
2021-07-23 09:42:28 +01:00
satayev
d604b210c4 Rename UpdatableBootJars to ApexBootJars.
Note that ART apex boot jars and core-icu4j are exceptions here as they
are not part of ApexBootJars. ART apex boot jars are defined in their
own variable, while core-icu4j is treated as a regular non-updatable
boot jar.

Bug: 191127295
Test: atest CtsClasspathsTestCases
Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
2021-07-22 17:35:42 +01:00
Treehugger Robot
627ecdc0e7 Merge "apex: pass --align-file-size to signapk" am: c30a4c3f3c am: 9f354c8694
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1762581

Change-Id: I256bd030afdf7bd44b7397cdf55ca44b14239dd1
2021-07-21 00:51:09 +00:00
Treehugger Robot
c30a4c3f3c Merge "apex: pass --align-file-size to signapk" 2021-07-21 00:23:08 +00:00
Treehugger Robot
4760903116 Merge "Require prebuilt_bootclasspath_fragment to provide hidden API files" am: 41461f3660 am: 70d39ce053
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1772628

Change-Id: I276e323889e5a70ddf56b7ca71add649858c32a1
2021-07-20 20:38:22 +00:00
Treehugger Robot
854571f683 Merge changes I343712d7,Ic076ea85 am: 9c01fc686d am: 93ece5b8e2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1772627

Change-Id: Id0587dc7c2a4e1019f3699aa3b3b7e5015e5e2e5
2021-07-20 20:38:13 +00:00
Paul Duffin
54e4197da1 Require prebuilt_bootclasspath_fragment to provide hidden API files
Previously, the prebuilt_bootclasspath_fragment was not required to
provide hidden API files as not all usages of that module provided
them. That should no longer be the case so this change makes the
prebuilt_bootclasspath_fragment stricter and so now always require
them.

Bug: 194063708
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - check that this does not change the contents.
Change-Id: I3f19a1b4246f09a927c0f6b0f41b8678150d6cc2
2021-07-20 19:18:13 +01:00
Paul Duffin
40a3f65430 Improve hidden API checking in TestBootDexJarsFromSourcesAndPrebuilts
Previously, the test only checked how the intermediate index file was
created from class jars. This change also checks how the monolithic
index file was created from the intermediate index file and the index
files generated from each bootclasspath_fragment.

At the moment the checks reveal that the monolithic index file is
created solely from the intermediate index file. However, a follow up
change to Soong will alter the behavior of the test.

Bug: 194063708
Test: m nothing
Change-Id: I343712d7d17ab0a07f5b32226321fc6815847e1f
2021-07-20 19:17:56 +01:00
Jingwen Chen
5c2e25258a Merge "Fix apex bp2build." am: 8bdc1bb3d7 am: d3f17aed08
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1769290

Change-Id: I7c2eb2c283537bbde02db9701e869d9aa46674fc
2021-07-19 05:36:19 +00:00
Jingwen Chen
f59a8e117e Fix apex bp2build.
apexBundle was missing InitBazelModule for it to have bazel_module properties.

Test: soong unit test
Fixes: 193866723
Change-Id: I5fb38c8b2e8edaecef44162491d399c0223d3fb1
2021-07-16 09:32:49 +00:00
Paul Duffin
cc7fc33e20 Merge "Build updatable-bcp-packages.txt from prebuilts in sdk snapshot" am: d2a23518b4 am: 3caa3a02ee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768127

Change-Id: I0f1bd5d1a6d53d12f9af41b46af3453af24c0591
2021-07-15 15:23:27 +00:00
Paul Duffin
630b11e9d4 Build updatable-bcp-packages.txt from prebuilts in sdk snapshot
Previously, the java_import and java_sdk_library_import modules did not
make their permitted_packages available to the rule that generates the
updatable-bcp-packages.txt file. This change corrects that.

Bug: 193763688
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Change-Id: If0706e4551a331b48d383123088e63924dded48b
2021-07-15 14:16:44 +01:00
Treehugger Robot
4c72f68962 Merge "SdkLibraryImport's DexJarInstallPath uses installPath from source module" am: 257608f993 am: 64614bbcff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1758354

Change-Id: Ibd345e6d76706c54d5cfb0799d80f5d107332f78
2021-07-14 01:21:18 +00:00
Jeongik Cha
d5fe8782e0 SdkLibraryImport's DexJarInstallPath uses installPath from source module
Even though actual installed module path is the same as source module,
it uses impl's one.

Bug: 188179858
Bug: 193082464
Test: compare dexpreopt_config.zip files from
  1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
  2. m dexpreopt_config_zip
  (note that m clean should run between steps)
Test: build aosp_cf_x86_64_phone,  launch_cvd, and then
  adb wait-for-device \
      && adb root \
      && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C 1
      and then check if there is no message.

Change-Id: I34ffd9a2d214a6614c2befc35b2beec003cfcd25
2021-07-13 13:54:03 +00:00
Jooyung Han
5d00f50f75 apex: pass --align-file-size to signapk
APEX files are sized as 4K-aligned so that they can be passed to Guest
OS via block apexes.

Bug: 192991318
Test: check size of built APEX files
Change-Id: I32d988f3cdf2717dbebd87b2ced01840e07a3a9b
2021-07-12 11:35:48 +09:00
Rupert Shuttleworth
268466707b Add partial bp2build support for APEX targets (second try). am: a9d76dd423 am: 37b29c925c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1755109

Change-Id: Id29697a17140dccf5ca9764a95f6f5db51a8783a
2021-07-02 13:38:14 +00:00
Rupert Shuttleworth
a9d76dd423 Add partial bp2build support for APEX targets (second try).
Test: Added unit test
Change-Id: Icbf0475251aac5d1f13bd35a18f90b6c70f3ae29
2021-07-02 07:36:07 -04:00
Martin Stjernholm
95994067b1 Do not allow duplicate deapexer dependencies.
Without these errors, the last encountered deapexer would silently be
used, and we wouldn't know if it was taken from the prebuilt APEX that
actually get installed in the system image.

With this error check there may be only one enabled prebuilt_apex or
apex_set for each apex_name (which defaults to the module name). E.g.
if there are both prebuilt com.android.foo and com.google.android.foo,
it is necessary to disable one of them in the .bp file.

Merged-In is set from https://r.android.com/1745454, a change that has
gone into AOSP and internal master, as well as sc-dev-plus-aosp, but
specifically not sc-dev. This change cannot merge into sc-dev-plus-aosp
and others, because they may or may not have the com.google.android.art
prebuilt APEX present depending on manifest, and with this check
exactly one of com.android.art and com.google.android.art prebuilts has
to be present and enabled. It'll be cherry-picked to AOSP along with a
full fix for b/192006406, when it can be safely enabled everywhere.

Test: m nothing SOONG_CONFIG_art_module_source_build=false
Test: m nothing SOONG_CONFIG_art_module_source_build=true
Test: m nothing
  with enabled:true for the com.android.art prebuilt APEX - check that
  it fails with an "ambiguous duplicate deapexer" error
Bug: 192006406
Bug: 192542393
Change-Id: I44566fd26b12f82a8a67fe4a69e56303460756d0
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
2021-07-02 00:31:01 +01:00
Weng Su
eb8a7b740a Revert "Add partial bp2build support for APEX targets." am: 7ce730b90c am: 9bc2ee5ca0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1753900

Change-Id: Iff2f0d358658098ccfd06bdca58a20b72db16de7
2021-07-01 08:00:41 +00:00
Rupert Shuttleworth
50be2a3716 Add partial bp2build support for APEX targets. am: 22b606b5f0 am: 356b7ca109
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1733232

Change-Id: Ia301f78ab5e9ad38d0eee2a525a4eb2895ae5722
2021-07-01 06:57:23 +00:00
Weng Su
7ce730b90c Revert "Add partial bp2build support for APEX targets."
Revert submission 1733232-roboleaf-apex

Reason for revert: b/192523357 Broken build 7512065 on aosp-master on sdk_x86_64-sdk
Reverted Changes:
Ie82c263f6:Add a stub rule for building APEX bundles.
I93e2a25fa:Add partial bp2build support for APEX targets.

Change-Id: I8e836fe7f466e02f3108680f9653412299e929e0
2021-07-01 06:51:11 +00:00
Rupert Shuttleworth
22b606b5f0 Add partial bp2build support for APEX targets.
Test: Added unit test

Change-Id: I93e2a25fa43eec1ffb8fb30c346a9b523195a0fd
2021-06-30 22:20:23 -04:00
Paul Duffin
46ab291f67 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

This change simply ignores any module that does not implement
ApexModule.

Bug: 179354495
Test: m nothing
Merged-In: Iead6f9d1085d169335b88ceadcce2d8cc042254d
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
(cherry picked from commit fee8cf36e3)
2021-06-30 00:08:49 +01:00
Paul Duffin
d7be777f25 Ignore license and similar dependencies of prebuilt_apex/apex_set am: fee8cf36e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15132673

Change-Id: I88690c5637ab0e3a67415afa19fcfef0707b2b78
2021-06-29 23:06:29 +00:00
Paul Duffin
fee8cf36e3 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

This change simply ignores any module that does not implement
ApexModule.

Bug: 179354495
Test: m nothing
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
2021-06-29 18:42:55 +01:00
Paul Duffin
fb8f07bc0e Calculate widest stub dex jars per module
Previously, the stub dex jars for each HiddenAPIScope was created by
merging the stub dex jars provided by each module for that scope. Then
the widest stub dex jars were chosen. So, if module A provided public,
system and test stub dex jars and module B provided only public then
the stub dex jars for each scope would be:
* public -> A,B
* system -> A
* test -> A

So, the widest API scope for which there are stub dex jars is "test"
and so the widest stub dex jars would just come from module A and not
module B. So, when "hiddenapi list" is run for module C which depends
on modules A and B it only gets given stub dex jars for module A which
means that it cannot resolve all the types that C may use which can
lead to incorrect flags being generated.

This change does not merge the stub dex jars from each module together
and instead keeps them separate by module. The widest stub dex jars
list is constructed by asking each module in turn for their widest stub
dex jars. e.g. Given the above example we would have:

Module A:
* public
* system
* test <- widest

Module B:
* public <- widest

So, the widest stub dex jars will be A's test and B's public stub dex
jars.

Bug: 179354495
Test: m out/soong/hiddenapi-flags.csv
      - make sure that this does not change the file.
Merged-In: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
(cherry picked from commit 280a31aac3)
2021-06-28 16:05:05 +01:00
Paul Duffin
e5f1b2f131 Merge "Calculate widest stub dex jars per module" am: 634966767c am: f72c380726
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748467

Change-Id: Ie3fd02dda6a6de949a667c3512b89b3b6063a56b
2021-06-28 12:25:34 +00:00
Paul Duffin
280a31aac3 Calculate widest stub dex jars per module
Previously, the stub dex jars for each HiddenAPIScope was created by
merging the stub dex jars provided by each module for that scope. Then
the widest stub dex jars were chosen. So, if module A provided public,
system and test stub dex jars and module B provided only public then
the stub dex jars for each scope would be:
* public -> A,B
* system -> A
* test -> A

So, the widest API scope for which there are stub dex jars is "test"
and so the widest stub dex jars would just come from module A and not
module B. So, when "hiddenapi list" is run for module C which depends
on modules A and B it only gets given stub dex jars for module A which
means that it cannot resolve all the types that C may use which can
lead to incorrect flags being generated.

This change does not merge the stub dex jars from each module together
and instead keeps them separate by module. The widest stub dex jars
list is constructed by asking each module in turn for their widest stub
dex jars. e.g. Given the above example we would have:

Module A:
* public
* system
* test <- widest

Module B:
* public <- widest

So, the widest stub dex jars will be A's test and B's public stub dex
jars.

Bug: 179354495
Test: m out/soong/hiddenapi-flags.csv
      - make sure that this does not change the file.
Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
2021-06-28 10:56:43 +01:00
Martin Stjernholm
82c88ca8c6 Merge "Fix inconsistencies in the apex names used for the apex variations." into sc-dev 2021-06-27 23:08:48 +00:00
Treehugger Robot
a2792263fa Merge "Fix inconsistencies in the apex names used for the apex variations." am: f46e95899b am: 28bbdf23f7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748294

Change-Id: I930769a7d48eedace77d12cf51f1e50ebb874cbb
2021-06-25 23:33:49 +00:00
Treehugger Robot
f46e95899b Merge "Fix inconsistencies in the apex names used for the apex variations." 2021-06-25 22:50:00 +00:00
Paul Duffin
b3821fea38 Support hidden API processing for modules that use platform APIs
Previously, hidden API processing could only be done by those
bootclasspath_fragment modules that either did not depend on any other
fragments (e.g. art-bootclasspath-fragment) or only depended on APIs
provided by other fragments (e.g. i18n-bootclasspath-fragment). That
meant that modules like com.android.os.statsd-bootclasspath-fragment
that depended on APIs provided by parts of the platform which are not
yet part of another bootclasspath_fragment could not perform hidden
API processing.

This change adds support for a bootclasspath_fragment to specify the
additional stubs needed to perform hidden API processing. It adds a new
additional_stubs property that can be used to specify the additional
stub libraries.

Most bootclasspath_fragments that need to use the property will need
access to the APIs provided by the android-non-updatable.* libraries.
Rather than have each fragment explicitly specify the correct module
for each scope it treats "android-non-updatable" as if it was a
java_sdk_library that can provide different jars for each scope.
Soong will handle mapping that to the correct android-non-updatable.*
module.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv \
        out/soong/hiddenapi/hiddenapi-index.csv \
        out/soong/hiddenapi/hiddenapi-stub-flags.txt \
        out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that this change does not change the contents.
      m TARGET_BUILD_APPS=Calendar nothing
Merged-In: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
(cherry picked from commit 5cca7c44e5)
2021-06-25 21:59:28 +01:00
Martin Stjernholm
d8da28ea9c Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying
the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/,
which is also the one used for the apex variations.

Introduce a callback to retrieve that name consistently for all APEX
modules (apex, override_apex, prebuilt_apex, and apex_set), and update
some apex mutator code paths to use it.

For APEX source modules (apex and override_apex), it's necessary to add
a new field in apexBundle, since the name property gets overridden for
the override variant that override_apex creates.

Cherry-picked from https://r.android.com/1748294.

Test: m nothing
Bug: 191269918
Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5
Merged-In: If8612639bffdf91cbcab3387b0603bf5dffef1f5
2021-06-25 21:27:14 +01:00
Paul Duffin
12ef8d8bac Merge "Support hidden API processing for modules that use platform APIs" am: 99926a2a77 am: 9d67121fff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744417

Change-Id: I0929917000886efd04d021dd4370c66f09cca00c
2021-06-25 18:56:19 +00:00
Paul Duffin
99926a2a77 Merge "Support hidden API processing for modules that use platform APIs" 2021-06-25 18:25:39 +00:00
Jiyong Park
56a39ad6d9 Merge changes from topic "stub_from_rust"
* changes:
  Add platform_apis property to APEX module type
  Rust module in APEX uses stub libraries across APEX boundaries
2021-06-25 17:52:43 +00:00
Paul Duffin
2cb06b70fe Add ModuleLibHiddenAPIScope for hidden API processing
Although the hidden API runtime does not support a module-lib API flag
the hidden API processing does need to used them as they are needed by
the "hiddenapi list" tool for any bootclasspath_fragment module whose
contents builds against an sdk_version of "module_current". Without it
the "hiddenapi list" tool could fail to resolve references to classes
provided by other modules which would break the build.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Merged-In: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
(cherry picked from commit b51db2ed8e)
2021-06-25 16:44:30 +01:00
Paul Duffin
4faf5c17e2 Add test for modular hiddenapi list rule
Adds a test to establish a baseline for a follow up change that adds
module_lib support to hidden API processing.

Bug: 179354495
Test: m nothing
Merged-In: I5630075825c674b2e4f38bd459c7b061c01fc362
Change-Id: I5630075825c674b2e4f38bd459c7b061c01fc362
(cherry picked from commit 48b6741510)
2021-06-25 16:44:30 +01:00
Paul Duffin
05bbff90bd Add HiddenAPIScope to replace use of SdkKind
Previously, the hidden API processing used SdkKind to identify the API
scopes, e.g. public, system, etc. that are of interest for hidden API
processing. Unfortunately, there is a mismatch between the SdkKind and
what hidden API processing needs. e.g. SdkKind includes values that are
not used by hidden API processing and hidden API processing needs
additional API scope specific information not provided by SdkKind. The
apiScope struct used in sdk_library.go is also not a suitable
representation for similar reasons.

This change adds the HiddenAPIScope (following a similar approach as
apiScope) that rectifies that and uses it as a replacement for SdkKind
in most parts of the hidden API processing. The SdkKind is still used
for retrieving information from java_sdk_library[_import] modules.

Follow up changes will extend the HiddenAPIScope with more information.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Merged-In: I97968f58535121652852b8d25217aa288afd2bfd
Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
(cherry picked from commit 31fad800a7)
2021-06-25 16:44:30 +01:00
Martin Stjernholm
bfffae7bec Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying
the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/,
which is also the one used for the apex variations.

Introduce a callback to retrieve that name consistently for all APEX
modules (apex, override_apex, prebuilt_apex, and apex_set), and update
some apex mutator code paths to use it.

For APEX source modules (apex and override_apex), it's necessary to add
a new field in apexBundle, since the name property gets overridden for
the override variant that override_apex creates.

Test: m nothing
Bug: 191269918
Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5
2021-06-25 16:41:05 +01:00
Paul Duffin
5cca7c44e5 Support hidden API processing for modules that use platform APIs
Previously, hidden API processing could only be done by those
bootclasspath_fragment modules that either did not depend on any other
fragments (e.g. art-bootclasspath-fragment) or only depended on APIs
provided by other fragments (e.g. i18n-bootclasspath-fragment). That
meant that modules like com.android.os.statsd-bootclasspath-fragment
that depended on APIs provided by parts of the platform which are not
yet part of another bootclasspath_fragment could not perform hidden
API processing.

This change adds support for a bootclasspath_fragment to specify the
additional stubs needed to perform hidden API processing. It adds a new
additional_stubs property that can be used to specify the additional
stub libraries.

Most bootclasspath_fragments that need to use the property will need
access to the APIs provided by the android-non-updatable.* libraries.
Rather than have each fragment explicitly specify the correct module
for each scope it treats "android-non-updatable" as if it was a
java_sdk_library that can provide different jars for each scope.
Soong will handle mapping that to the correct android-non-updatable.*
module.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv \
        out/soong/hiddenapi/hiddenapi-index.csv \
        out/soong/hiddenapi/hiddenapi-stub-flags.txt \
        out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that this change does not change the contents.
      m TARGET_BUILD_APPS=Calendar nothing
Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
2021-06-25 16:20:19 +01:00
Paul Duffin
ca9dcd2d38 Merge "Add ModuleLibHiddenAPIScope for hidden API processing" am: 136fd5554d am: 9579e5e4ac
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744416

Change-Id: Ifa3bb7fdf5abdf084de1efcd321767d1cf6ab87f
2021-06-25 11:26:55 +00:00
Paul Duffin
7c2a47b90b Merge "Add test for modular hiddenapi list rule" am: b8410ec07c am: f4610affbc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744415

Change-Id: I76aa568dcc16c08e7bee3a02b18695603f4e7953
2021-06-25 11:26:50 +00:00
Paul Duffin
ac35c397bc Merge "Add HiddenAPIScope to replace use of SdkKind" am: e09a6692de am: 7f5954a225
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744414

Change-Id: I85bc152e161fafad8d086e58f5e296e2a10f5160
2021-06-25 11:26:43 +00:00