Commit graph

2609 commits

Author SHA1 Message Date
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
Paul Duffin
b51db2ed8e 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.
Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
2021-06-24 22:04:09 +01:00
Paul Duffin
48b6741510 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
Change-Id: I5630075825c674b2e4f38bd459c7b061c01fc362
2021-06-24 22:04:05 +01:00
Paul Duffin
31fad800a7 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.
Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
2021-06-24 21:56:27 +01:00
Jiyong Park
1bc8412d37 Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").

Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f)
2021-06-24 19:50:32 +09:00
Jiyong Park
105dc321ce Rust module in APEX uses stub libraries across APEX boundaries
This change fixes a bug that rust module in APEX has access to private
symbols of a native library even when the native library is outside of
the APEX.

To fix this, the stub selection logic in the cc package is exctacted as
a function ChooseStubOrImpl and is used also in the rust package.

Bug: 190767845
Test: m
Merged-In: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
Change-Id: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
(cherry picked from commit 3b5f88e091)
2021-06-24 19:50:06 +09:00
Jiyong Park
9477c26f6c Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").

Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f)
2021-06-24 11:28:33 +09:00
Jiyong Park
7d55b61783 Rust module in APEX uses stub libraries across APEX boundaries
This change fixes a bug that rust module in APEX has access to private
symbols of a native library even when the native library is outside of
the APEX.

To fix this, the stub selection logic in the cc package is exctacted as
a function ChooseStubOrImpl and is used also in the rust package.

Bug: 190767845
Test: m
Merged-In: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
Change-Id: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
(cherry picked from commit 3b5f88e091)
2021-06-24 11:27:41 +09:00
satayev
09a45d755f Merge "VNDK APEX: skips VNDK-Ext" am: 17c4507dec am: 125bba00cf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744554

Change-Id: Ic32f9b3df65b747e5126a50d65b472f4fe3df9df
2021-06-23 20:24:59 +00:00
satayev
17c4507dec Merge "VNDK APEX: skips VNDK-Ext" 2021-06-23 19:52:56 +00:00
Jooyung Han
73a471ea9b Merge "fix: comparison between min_sdk_version" am: 91913e3e07 am: bdafb79af7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1743953

Change-Id: Id481769c8852103cb3690911e44d103b0f9cbe6a
2021-06-23 17:34:59 +00:00
Jooyung Han
91913e3e07 Merge "fix: comparison between min_sdk_version" 2021-06-23 17:02:02 +00:00
Jooyung Han
7d6e79bc63 VNDK APEX: skips VNDK-Ext
In legacy VNDK mode (DeviceVndkVesion=""), the check was missing. We
don't want VNDK-Ext in VNDK APEX in any case.

Bug: 191770320
Test: m nothing
Change-Id: I08f36a4c1696bf82d25d629841e172d2716a366d
2021-06-24 01:56:03 +09:00
satayev
c92cff4f0d Merge "Append platform classpath proto configs with missing apex jars." am: a580b5ef0f am: f8f2d7b4e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739054

Change-Id: I825921148500db99b1f8a0fb3f6acadba2d023ac
2021-06-23 10:27:01 +00:00
satayev
a580b5ef0f Merge "Append platform classpath proto configs with missing apex jars." 2021-06-23 09:51:39 +00:00
Jooyung Han
4c4da0688c fix: comparison between min_sdk_version
Added test demonstrates the error case. The bug was that java modules'
ShouldSupportSdkVersion() converts min_sdk_version into effective
version before comparison, which discards "preview" version into
"future" version. That caused a weird case like rejecting with error
"should support "S"" even when it is set to "S".

Bug: n/a
Test: m nothing
Change-Id: Ieb53f0097b2969a8535778b1286dbfa0d4895ad4
2021-06-23 10:45:28 +09:00
satayev
b30905019f Append platform classpath proto configs with missing apex jars.
Any apex classpath fragment that doesn't generate its own classpaths
proto, must still propagate it's boot jars for the platform classpath
fragment to include for complete CLASSPATH variables on device.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: I93687f69006741fcd66eb6e04891a4b4bbcc3b47
2021-06-22 20:03:54 +01:00
Paul Duffin
2a999332ef Fix monolithic hidden API processing with prebuilts
Prebuilt modules do not provide classesJars containing annotations.
Previously, the monolithic hidden API processing just used classesJars
from all the modules that provided them so when building against
prebuilts would have fewer classesJars than when building against
sources and so would produce different hidden API flags.

This change will generate the monolithic files from both classesJars
and files previously generated from hidden API processing. A fragment
that has performed hidden API processing will contribute its generated
files whereas standalone libraries and fragments which have not
performed hidden API processing will contribute classesJars.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      m SOONG_CONFIG_art_module_source_build=false out/soong/hiddenapi/hiddenapi-flags.csv
      - verify that the files are identical whether built from
        source or prebuilts.
Merged-In: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
Change-Id: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
(cherry picked from commit d061d40eb6)
2021-06-22 19:16:27 +01:00
Paul Duffin
4c2f78bff4 Make CheckHiddenAPIRuleInputs more reusable
Adds a message parameter and allows leading spaces in the expected file
string to allow them to be nicely indented.

Bug: 177892522
Test: m nothing
Merged-In: I33df26610738c48879fa0b8250dc377dd04bb07d
Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
(cherry picked from commit 51d7da2c4e)
2021-06-22 19:16:27 +01:00
Paul Duffin
3ae9e2cef5 Use classpath elements in platform_bootclasspath
Use classpath elements in newMonolithicHiddenAPIInfo. That means the
method can collate information from both fragments and libraries rather
than just fragments. So, this change moves the collation of the
classesJars into the method.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv
      - make sure that this change does not affect the contents.
Merged-In: I7c2a229fab60d02bd211438735a8d7303ed83386
Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386
(cherry picked from commit 89f570ac44)
2021-06-22 19:16:27 +01:00
Paul Duffin
5f9e7bcea4 Merge "Fix monolithic hidden API processing with prebuilts" am: a1a2baf8a7 am: 3adbb7cb05
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738977

Change-Id: I46c8714db2a0f357c573e34b9b4d26c946fa0878
2021-06-22 12:27:10 +00:00
Paul Duffin
a1a2baf8a7 Merge "Fix monolithic hidden API processing with prebuilts" 2021-06-22 11:44:11 +00:00
Paul Duffin
60406b25f7 Merge "Make CheckHiddenAPIRuleInputs more reusable" am: 07cdd37ae5 am: f250ea10e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738976

Change-Id: Ie1bb89d1b2aaf55ce0ee4ad9891cd891bc464096
2021-06-21 20:17:21 +00:00
Paul Duffin
5fc974aec9 Merge "Use classpath elements in platform_bootclasspath" am: 9d31361873 am: 5805a4f34a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738975

Change-Id: Ia072fc05e1f63b409ba8e837bd809af505b4f4e6
2021-06-21 20:16:57 +00:00
Paul Duffin
07cdd37ae5 Merge "Make CheckHiddenAPIRuleInputs more reusable" 2021-06-21 16:16:12 +00:00
Paul Duffin
9d31361873 Merge "Use classpath elements in platform_bootclasspath" 2021-06-21 16:16:00 +00:00
Paul Duffin
034196d9fe Simplify deapexer support
Uses the apex relative path to the file as the identifier that is used
to obtain the path to the corresponding file extracted from the apex.
That is instead of a special constructed string id.

Bug: 177892522
Test: m nothing
Merged-In: I5dc77c8fb272bac289b8891d1eac801e541af1f5
Change-Id: I5dc77c8fb272bac289b8891d1eac801e541af1f5
(cherry picked from commit b4bbf2ca10)
2021-06-21 10:54:22 +01:00
Paul Duffin
7db57e0a77 Remove javalib special case in createDeapexerModuleIfNeeded
Removes the special case in createDeapexerModuleIfNeeded for handling
java libraries and just get the Import and SdkLibraryImport module
types to implement RequiredFilesFromPrebuiltApex instead.

Bug: 177892522
Test: m nothing
Merged-In: I5cc341b5b4168b8eb196f72273a00d498de6856f
Change-Id: I5cc341b5b4168b8eb196f72273a00d498de6856f
(cherry picked from commit fef5500a76)
2021-06-21 10:54:22 +01:00
Treehugger Robot
f2d15a6921 Merge "AIDEGen: Collect dependencies info from APEX module." am: 348f20be0e am: 3ccb991a31
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1729192

Change-Id: Ie79c4757cd3e190c1bd9a03a8ee6302306fc9952
2021-06-21 07:50:24 +00:00
Treehugger Robot
348f20be0e Merge "AIDEGen: Collect dependencies info from APEX module." 2021-06-21 07:17:28 +00:00
Paul Duffin
c2d7c036e1 Merge "Simplify deapexer support" am: 0d7f2d30b5 am: fd198583f0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740316

Change-Id: Ic9fffd50e5550cbdaa4731270b1f66b5bde2fde8
2021-06-20 18:43:17 +00:00
Paul Duffin
8ee224c159 Merge "Remove javalib special case in createDeapexerModuleIfNeeded" am: 6b592bdcdc am: 5349528f57
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740315

Change-Id: Idef64da43b738b9f51c2e2ec1b563281eab4a60f
2021-06-20 18:43:11 +00:00
Paul Duffin
d061d40eb6 Fix monolithic hidden API processing with prebuilts
Prebuilt modules do not provide classesJars containing annotations.
Previously, the monolithic hidden API processing just used classesJars
from all the modules that provided them so when building against
prebuilts would have fewer classesJars than when building against
sources and so would produce different hidden API flags.

This change will generate the monolithic files from both classesJars
and files previously generated from hidden API processing. A fragment
that has performed hidden API processing will contribute its generated
files whereas standalone libraries and fragments which have not
performed hidden API processing will contribute classesJars.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      m SOONG_CONFIG_art_module_source_build=false out/soong/hiddenapi/hiddenapi-flags.csv
      - verify that the files are identical whether built from
        source or prebuilts.
Change-Id: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
2021-06-20 19:09:09 +01:00
Paul Duffin
51d7da2c4e Make CheckHiddenAPIRuleInputs more reusable
Adds a message parameter and allows leading spaces in the expected file
string to allow them to be nicely indented.

Bug: 177892522
Test: m nothing
Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
2021-06-20 19:09:09 +01:00
Paul Duffin
89f570ac44 Use classpath elements in platform_bootclasspath
Use classpath elements in newMonolithicHiddenAPIInfo. That means the
method can collate information from both fragments and libraries rather
than just fragments. So, this change moves the collation of the
classesJars into the method.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv
      - make sure that this change does not affect the contents.
Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386
2021-06-20 19:09:09 +01:00
Paul Duffin
0d7f2d30b5 Merge "Simplify deapexer support" 2021-06-20 18:08:41 +00:00
Paul Duffin
6b592bdcdc Merge "Remove javalib special case in createDeapexerModuleIfNeeded" 2021-06-20 18:08:29 +00:00
Paul Duffin
062838fcca Merge "Add ClasspathElement support" into sc-dev 2021-06-20 18:06:03 +00:00
Paul Duffin
1970d6c5ce Merge "Extract createEntriesForApexFile" into sc-dev 2021-06-20 18:05:55 +00:00
Nikita Ioffe
5476c95e50 Merge "Set default value of generate_hashtree property to true" into sc-dev 2021-06-19 00:12:16 +00:00
Paul Duffin
f23512fa58 Add ClasspathElement support
The configuration of the bootclasspath, e.g. PRODUCT_BOOT_JARS,
includes libraries that are standalone and libraries that are part of
an APEX. All libraries that are part of an APEX must also be part of a
bootclasspath_fragment. Currently, the libraries and fragments are
handled separately but that is limiting as it does not make it easy to
process all the libraries while treating those from fragments
differently to standalone libraries. That is needed for hidden API
processing as it needs to use classesJars from standalone libraries
but pre-generated flag files from fragments.

This change adds support for ClasspathElements which is represents the
classpath as a whole while differentiating between standalone libraries
and fragments.

Bug: 177892522
Test: m nothing
Merged-In: I7a4adc67164a46079eb8ec0a17fc755044b4949d
Change-Id: I7a4adc67164a46079eb8ec0a17fc755044b4949d
(cherry picked from commit e245b61aa2)
2021-06-18 21:02:10 +01:00
Paul Duffin
9dc8c54fc4 Extract createEntriesForApexFile
While this seems like a simple refactoring it does actually fix an
issue. Previously, when the ExtraEntries func was being defined inline
within the for ... loop it used the loop variable "fi". Unfortunately,
that meant that the func created on each iteration ended up using the
value for "fi" that was set on the last iteration.

Extracting the creation of the entry into a separate method means that
each func created gets its own "fi" variable with the correct values.

Bug: 177892522
Test: m SOONG_CONFIG_art_module_source_build=false nothing
      - without this change it reported duplicate rules for apache-xml.jar
        which is the last entry in the art-bootclasspath-fragment. With
        this change it works fine.
Merged-In: Ia063b513f758e1bbe73407c0441b72453f412acf
Change-Id: Ia063b513f758e1bbe73407c0441b72453f412acf
(cherry picked from commit 155c17779c)
2021-06-18 21:02:10 +01:00
Paul Duffin
082e9c0dde Merge "Add ClasspathElement support" am: e6aefedeba am: 10a66e1dee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738974

Change-Id: Ic917f108fa2189a033373740bdaa959119c67c5c
2021-06-18 18:47:43 +00:00
Paul Duffin
9eea670062 Merge "Extract createEntriesForApexFile" am: e91f1537e2 am: f86a697730
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738978

Change-Id: Ia3114e68a4f32ea87565dd65c3ac601d80df5558
2021-06-18 18:13:54 +00:00
Paul Duffin
e6aefedeba Merge "Add ClasspathElement support" 2021-06-18 18:13:06 +00:00
Paul Duffin
e91f1537e2 Merge "Extract createEntriesForApexFile" 2021-06-18 17:11:29 +00:00
Nikita Ioffe
cd3654f9fe Set default value of generate_hashtree property to true
Test: presubmit
Test: m
Bug: 190621617
Change-Id: I546730f168632c5d5d41c686853bde93a8ba7911
Merged-In: I546730f168632c5d5d41c686853bde93a8ba7911
(cherry picked from commit e261ae64e2)
2021-06-18 15:06:06 +01:00
Nikita Ioffe
3b0b1bd798 Merge "Set default value of generate_hashtree property to true" am: f932613c3f am: 59b8d28cf6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736785

Change-Id: Ic44e048dc70adb79f94db056ad8969f656e43d1e
2021-06-18 13:43:02 +00:00
Nikita Ioffe
f932613c3f Merge "Set default value of generate_hashtree property to true" 2021-06-18 13:14:22 +00:00
Paul Duffin
b508405e08 Export boot image files from prebuilt_apex/apex_set
Previously, the prebuilt art-bootclasspath-fragment did not provide any
boot image files. That meant it was impossible to build any module that
requires access to those files from prebuilts, e.g. any module that
needs to be dexpreopt-ed.

This change enables that module to retrieve those files from the
prebuilt_apex.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Merged-In: I1d4d9545172d79282918130df6b9aa55471bffc1
Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
(cherry picked from commit 5466a3699c)
2021-06-18 12:11:17 +01:00
Paul Duffin
a0089ec78c Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred
Previously, the boot dex jars were only copied to the predefined
locations used by the build from the source art-bootclasspath-fragment
if it was preferred, otherwise no files were copied. That caused build
failures when attempting to build with ART prebuilts. This change
copies the files from prebuilts too.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Merged-In: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
Change-Id: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
(cherry picked from commit ce918b0278)
2021-06-18 12:11:17 +01:00
Paul Duffin
c75bbcecdb Combine hidden API encoding with flag generation
Previously, the rules to perform hidden API encoding were generated
separately to the rules to perform hidden API flag generation. This
change combines them within the (renamed) produceHiddenAPIOutput()
method and makes the paths to the encoded dex files an output of the
generateHiddenAPIBuildActions method alongside the paths to the
generated flag files.

As encoded dex jars are now an output of the produceHiddenAPIOutput()
method which is implemented for both prebuilts and source
bootclasspath_fragment modules that necessitated the prebuilt also
providing paths to encoded dex files. That in turn required updates to
some of the tests to provide dex files from prebuilt_apex modules.

Similarly, as the produceHiddenAPIOutput() method may not be called
for some bootclasspath_fragment modules as they do not yet provide all
the information needed to perform hidden API encoding then it is
necessary to extract the encoded dex files produced by the modules
themselves. That also required a few changes to tests that did not
previously provide dex files.

Bug: 177892522
Test: m com.android.art
      - check that this change does not change the contents of the apex
        file, i.e. is byte-for-byte identical.
Merged-In: I60996a34d06ed1c87ed244ab3509621999ad86ec
Change-Id: I60996a34d06ed1c87ed244ab3509621999ad86ec
(cherry picked from commit e521881bd4)
2021-06-18 12:11:17 +01:00
Paul Duffin
fd53e21098 Copy implementation and header jars to make when possible
Fixes test issues caused by a jar containing a classes.dex file was
copied to a place that was expected a jar containing class files.

Bug: 191360201
Test: - in master-art
      find out/ -name \*core-icu4j\* | xargs rm -fr
      art/tools/buildbot-build.sh --target --installclean
      art/tools/bootjars.sh --path --core
      - examine file output from previous script for core-icu4j,
        before this change it contained classes.dex file after this
        change it contained *.class files.
Merged-In: I05ecf652535ec097125fb76d6ca80fee6587f98d
Change-Id: I05ecf652535ec097125fb76d6ca80fee6587f98d
(cherry picked from commit 85fa344d09)
2021-06-18 12:11:17 +01:00
Paul Duffin
c30aea20a0 Make apex variants of prebuilt apex exported modules available in make
Previously, the apex variants of modules exported from prebuilt_apex
and apex_set modules were not exported to make. Neither by the modules
themselves or by the prebuilt apex module. The master-art build relied
on the platform variants of the conscrypt and core-icu4j libraries
being exported to make so that they could be used by vogar.

Unfortunately, a change to export the prebuilt_bootclasspath_fragment
modules that contain the conscrypt and core-icu4j prebuilt libraries
from the corresponding prebuilt_apex prevented the platform variants
of those libraries from being exported at all which broke the
master-art builds as it only has prebuilts of those modules. It did not
break the aosp/master build as that has source modules.

The difference between the two builds is that the apex module type
makes its contents available in make but the prebuilt_apex/apex_set
module types do not.

This change causes the prebuilt_apex/apex_set module types to behave
more like the apex module type by making its exported libraries
available in make.

Bug: 179354495
Test: m droid
      - in aosp/master
      art/tools/buildbot-build.sh --target --installclean
      - in master-art and aosp/master
Merged-In: I57537d17d4920d37d896ed491c6aaa15302cb25d
Change-Id: I57537d17d4920d37d896ed491c6aaa15302cb25d
(cherry picked from commit a35f8db127)
2021-06-18 12:10:32 +01:00
Paul Duffin
5ec165d755 Create APEX variant for prebuilt_apex/apex_set
Previously, the prebuilt_apex/apex_set did not have an apex specific
variant created which meant that they depended upon the platform
variant of the modules it depended upon. This change creates an
apex variant for them just as is done for the apex module type which
causes it to depend upon the apex specific variant of the modules it
depends upon.

Test: m droid
Bug: 179354495
Merged-In: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
Change-Id: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
(cherry picked from commit 6717d88f46)
2021-06-18 12:02:43 +01:00
Paul Duffin
e245b61aa2 Add ClasspathElement support
The configuration of the bootclasspath, e.g. PRODUCT_BOOT_JARS,
includes libraries that are standalone and libraries that are part of
an APEX. All libraries that are part of an APEX must also be part of a
bootclasspath_fragment. Currently, the libraries and fragments are
handled separately but that is limiting as it does not make it easy to
process all the libraries while treating those from fragments
differently to standalone libraries. That is needed for hidden API
processing as it needs to use classesJars from standalone libraries
but pre-generated flag files from fragments.

This change adds support for ClasspathElements which is represents the
classpath as a whole while differentiating between standalone libraries
and fragments.

Bug: 177892522
Test: m nothing
Change-Id: I7a4adc67164a46079eb8ec0a17fc755044b4949d
2021-06-18 11:46:52 +01:00
satayev
cbe33a0233 Merge "Add classpath fragment property to skip proto generation." am: f45966f35b am: 6ea9e45d9c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738336

Change-Id: I8382015b96a37117e62735a6d5a682c3645c397f
2021-06-18 10:45:32 +00:00
satayev
f45966f35b Merge "Add classpath fragment property to skip proto generation." 2021-06-18 10:17:50 +00:00
Paul Duffin
3d052d1495 Export boot image files from prebuilt_apex/apex_set am: 5466a3699c am: c4a3e6d2f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736777

Change-Id: I45874db42b8d17e0893d5e1c4b9aca6356066221
2021-06-18 07:05:13 +00:00
Paul Duffin
e59c339a43 Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred am: ce918b0278 am: 56a6834640
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736226

Change-Id: I33abc58165d9ae42f5d567f7c77de5a9fe4bb187
2021-06-18 07:05:07 +00:00
Paul Duffin
155c17779c Extract createEntriesForApexFile
While this seems like a simple refactoring it does actually fix an
issue. Previously, when the ExtraEntries func was being defined inline
within the for ... loop it used the loop variable "fi". Unfortunately,
that meant that the func created on each iteration ended up using the
value for "fi" that was set on the last iteration.

Extracting the creation of the entry into a separate method means that
each func created gets its own "fi" variable with the correct values.

Bug: 177892522
Test: m SOONG_CONFIG_art_module_source_build=false nothing
      - without this change it reported duplicate rules for apache-xml.jar
        which is the last entry in the art-bootclasspath-fragment. With
        this change it works fine.
Change-Id: Ia063b513f758e1bbe73407c0441b72453f412acf
2021-06-18 07:43:32 +01:00
Paul Duffin
5466a3699c Export boot image files from prebuilt_apex/apex_set
Previously, the prebuilt art-bootclasspath-fragment did not provide any
boot image files. That meant it was impossible to build any module that
requires access to those files from prebuilts, e.g. any module that
needs to be dexpreopt-ed.

This change enables that module to retrieve those files from the
prebuilt_apex.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
2021-06-17 23:05:43 +01:00
Paul Duffin
ce918b0278 Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred
Previously, the boot dex jars were only copied to the predefined
locations used by the build from the source art-bootclasspath-fragment
if it was preferred, otherwise no files were copied. That caused build
failures when attempting to build with ART prebuilts. This change
copies the files from prebuilts too.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Change-Id: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
2021-06-17 23:05:43 +01:00
Paul Duffin
33ddfdf42b Merge "Copy implementation and header jars to make when possible" am: 94b2e705d1 am: d11c1c8fa4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740074

Change-Id: I83a02203cbebd6dff91a06a7969615fbdfd01390
2021-06-17 21:37:45 +00:00
Paul Duffin
85fa344d09 Copy implementation and header jars to make when possible
Fixes test issues caused by a jar containing a classes.dex file was
copied to a place that was expected a jar containing class files.

Bug: 191360201
Test: - in master-art
      find out/ -name \*core-icu4j\* | xargs rm -fr
      art/tools/buildbot-build.sh --target --installclean
      art/tools/bootjars.sh --path --core
      - examine file output from previous script for core-icu4j,
        before this change it contained classes.dex file after this
        change it contained *.class files.
Change-Id: I05ecf652535ec097125fb76d6ca80fee6587f98d
2021-06-17 20:33:54 +01:00
Paul Duffin
fd609b6bb0 Merge "Combine hidden API encoding with flag generation" am: 975e757232 am: b9b5bcf0e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736225

Change-Id: I3197f3def4688fdeaeddc920cc55fc6364599b9a
2021-06-17 16:36:40 +00:00
Paul Duffin
b4bbf2ca10 Simplify deapexer support
Uses the apex relative path to the file as the identifier that is used
to obtain the path to the corresponding file extracted from the apex.
That is instead of a special constructed string id.

Bug: 177892522
Test: m nothing
Change-Id: I5dc77c8fb272bac289b8891d1eac801e541af1f5
2021-06-17 15:59:07 +01:00
Paul Duffin
fef5500a76 Remove javalib special case in createDeapexerModuleIfNeeded
Removes the special case in createDeapexerModuleIfNeeded for handling
java libraries and just get the Import and SdkLibraryImport module
types to implement RequiredFilesFromPrebuiltApex instead.

Bug: 177892522
Test: m nothing
Change-Id: I5cc341b5b4168b8eb196f72273a00d498de6856f
2021-06-17 14:56:05 +01:00
satayev
b98371cc13 Add classpath fragment property to skip proto generation.
This must always be true for updatable apexes, but is not necessary
for non-updatable apexes like com.android.i18n.

In a follow up this will be used to figure out whether apex boot jars
should be bundled into platform_bootclasspath.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: Ib7dc5b057cb24955222fb97f3ff9da079f30ed77
2021-06-17 12:59:33 +01:00
Paul Duffin
e521881bd4 Combine hidden API encoding with flag generation
Previously, the rules to perform hidden API encoding were generated
separately to the rules to perform hidden API flag generation. This
change combines them within the (renamed) produceHiddenAPIOutput()
method and makes the paths to the encoded dex files an output of the
generateHiddenAPIBuildActions method alongside the paths to the
generated flag files.

As encoded dex jars are now an output of the produceHiddenAPIOutput()
method which is implemented for both prebuilts and source
bootclasspath_fragment modules that necessitated the prebuilt also
providing paths to encoded dex files. That in turn required updates to
some of the tests to provide dex files from prebuilt_apex modules.

Similarly, as the produceHiddenAPIOutput() method may not be called
for some bootclasspath_fragment modules as they do not yet provide all
the information needed to perform hidden API encoding then it is
necessary to extract the encoded dex files produced by the modules
themselves. That also required a few changes to tests that did not
previously provide dex files.

Bug: 177892522
Test: m com.android.art
      - check that this change does not change the contents of the apex
        file, i.e. is byte-for-byte identical.
Change-Id: I60996a34d06ed1c87ed244ab3509621999ad86ec
2021-06-17 10:20:33 +01:00
Paul Duffin
8e69cba899 Merge "Make apex variants of prebuilt apex exported modules available in make" am: 2c891873d6 am: ea621048f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738035

Change-Id: I1399ecfd269e68a6d69766cf9cd85294cb376adf
2021-06-17 07:04:35 +00:00
Paul Duffin
dc998efc9f Merge "Create APEX variant for prebuilt_apex/apex_set" am: 2960e9bdf2 am: 70fc36a6fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738034

Change-Id: I0cf928c7649040fe588ae8ff9d7db55f4f6c7610
2021-06-17 07:04:27 +00:00
Paul Duffin
a35f8db127 Make apex variants of prebuilt apex exported modules available in make
Previously, the apex variants of modules exported from prebuilt_apex
and apex_set modules were not exported to make. Neither by the modules
themselves or by the prebuilt apex module. The master-art build relied
on the platform variants of the conscrypt and core-icu4j libraries
being exported to make so that they could be used by vogar.

Unfortunately, a change to export the prebuilt_bootclasspath_fragment
modules that contain the conscrypt and core-icu4j prebuilt libraries
from the corresponding prebuilt_apex prevented the platform variants
of those libraries from being exported at all which broke the
master-art builds as it only has prebuilts of those modules. It did not
break the aosp/master build as that has source modules.

The difference between the two builds is that the apex module type
makes its contents available in make but the prebuilt_apex/apex_set
module types do not.

This change causes the prebuilt_apex/apex_set module types to behave
more like the apex module type by making its exported libraries
available in make.

Test: m droid
      - in aosp/master
      art/tools/buildbot-build.sh --target --installclean
      - in master-art and aosp/master
Change-Id: I57537d17d4920d37d896ed491c6aaa15302cb25d
2021-06-16 19:02:58 +01:00
Paul Duffin
6717d88f46 Create APEX variant for prebuilt_apex/apex_set
Previously, the prebuilt_apex/apex_set did not have an apex specific
variant created which meant that they depended upon the platform
variant of the modules it depended upon. This change creates an
apex variant for them just as is done for the apex module type which
causes it to depend upon the apex specific variant of the modules it
depends upon.

Test: m droid
Bug: 179354495
Change-Id: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
2021-06-16 18:54:19 +01:00
Nikita Ioffe
e261ae64e2 Set default value of generate_hashtree property to true
Test: presubmit
Test: m
Bug: 190621617
Change-Id: I546730f168632c5d5d41c686853bde93a8ba7911
2021-06-16 18:15:03 +01:00
Paul Duffin
a49f6b9138 Merge "Dedup apex/Prebuilt and apex/ApexSet" into sc-dev 2021-06-16 12:38:37 +00:00
Paul Duffin
ef6b69558a Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
Merged-In: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 11:56:14 +00:00
Paul Duffin
a9c8110470 Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
Merged-In: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 10:35:48 +01:00
Paul Duffin
b176d29bd2 Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 09:36:26 +01:00
Paul Duffin
3e2db5c10b Make copyBootJarsToPredefinedLocations simpler and less fragile
Previously, copyBootJarsToPredefinedLocations relied on all its
parameters having the same length and the same order. That made it
quite fragile as changes to one of the parameters without corresponding
changes to the other would cause failures. It also combined the
retrieval of the boot dex jars from the modules, handling of missing
boot dex jar files and the generation of the rules to copy the files.

This change separates the retrieval of boot dex jars and handling of
missing files from the copying of those files while at the same time
making the function less fragile by replacing the three ordered
parameters with two maps that shared common keys.

Bug: 179354495
Test: m nothing
Merged-In: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
Change-Id: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
(cherry picked from commit 5f148ca7cf)
2021-06-16 03:06:35 +01:00
Paul Duffin
0c70a7a0b0 Make TestPlatformBootclasspath_Fragments more realistic
Move the bootclasspath_fragment to be part of an apex to match how they
are expected to be used. Also adds the bar library to the boot jars
config as every module in a bootclasspath_fragment that is referenced
from a platform_bootclasspath module is expected to be in the config.

Bug: 179354495
Test: m nothing
Merged-In: I6f826dce9c006d630ee31d4171fe6fb458cc9442
Change-Id: I6f826dce9c006d630ee31d4171fe6fb458cc9442
(cherry picked from commit dc3f9566a2)
2021-06-16 03:06:34 +01:00
Paul Duffin
5991ba5119 Move TestPlatformBootclasspath_Fragments to apex package
This test checks that fragments which are referenced from a
platform_bootclasspath module contribute their hidden API flags to those
used by platform_bootclasspath module. Previously, it was unrealistic
because the bootclasspath_fragment does not belong in an APEX.

This change moves the test from the java package to the apex package to
allow it to be modified to make the bootclasspath_fragment part of an
apex.

Bug: 179354495
Test: m nothing
Merged-In: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
Change-Id: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
(cherry picked from commit ffa8375f07)
2021-06-16 03:06:34 +01:00
bralee
b0c1f0c45a AIDEGen: Collect dependencies info from APEX module.
Add apex dependencies.

Bug: 188004865
Test: 1. aidegen frameworks/base/apex/appsearch frameworks/base/apex/appsearch/testing   frameworks/base/services/tests/servicestests   frameworks/base/core/tests/coretests   cts/tests/appsearch   external/icing   vendor/google_testing/integration/tests/scenarios
      2. The dependency graph shows it is workable to provide the result to let IDE's [Project structure] to include the service-appsearch as source directory.
Change-Id: Ifd1548f0a86c1c73f8279e8ecea67756aeb1281e
2021-06-15 08:35:13 +08:00
Nikita Ioffe
5868ba016d Merge "Rename test_only_no_hashtree to generate_hashtree" 2021-06-14 20:16:21 +00:00
Paul Duffin
00da4dc303 Merge "Make copyBootJarsToPredefinedLocations simpler and less fragile" am: cc1bd8364a am: 174d9c7eec
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731414

Change-Id: I76746fa8b13b7b4632638ba211199d4d7b0d48d4
2021-06-14 08:32:56 +00:00
Paul Duffin
4fac8ad0d4 Merge "Make TestPlatformBootclasspath_Fragments more realistic" am: baa8e55dec am: e599574c92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731417

Change-Id: Ib371be888ad56a6ceb67148bd1a0f14367abc71b
2021-06-11 05:07:10 +00:00
Paul Duffin
40d0145d29 Merge "Move TestPlatformBootclasspath_Fragments to apex package" am: 2eddb50fd5 am: 0d2a3ad17d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731416

Change-Id: I3299f527aa8cc365784db1ecc15e83bc6889b3b3
2021-06-11 05:07:04 +00:00
Nikita Ioffe
0f02adec5e Merge "Rename test_only_no_hashtree to generate_hashtree" into sc-dev am: dce0713739
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/14920581

Change-Id: If41297bae4bff155224fe9c13d704c615fec3ac0
2021-06-10 16:27:25 +00:00
Nikita Ioffe
9d9960f240 Rename test_only_no_hashtree to generate_hashtree
In order not to introduce any changes in the system image default value
of generate_hashtree is currently set to false. Once all the APEXes that
shouldn't have hashtree enable (i.e. non-updatable ones) explicitly set
`generate_hashtree: false` default value will be switched to true.

Test: checked that are no diffs between ${OUT}/system/apex without this
  change and with this change.
Test: m
Bug: 190621617
Change-Id: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
Merged-In: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
(cherry picked from commit da6dc31389)
2021-06-10 16:54:53 +01:00
Paul Duffin
5f148ca7cf Make copyBootJarsToPredefinedLocations simpler and less fragile
Previously, copyBootJarsToPredefinedLocations relied on all its
parameters having the same length and the same order. That made it
quite fragile as changes to one of the parameters without corresponding
changes to the other would cause failures. It also combined the
retrieval of the boot dex jars from the modules, handling of missing
boot dex jar files and the generation of the rules to copy the files.

This change separates the retrieval of boot dex jars and handling of
missing files from the copying of those files while at the same time
making the function less fragile by replacing the three ordered
parameters with two maps that shared common keys.

Bug: 179354495
Test: m nothing
Change-Id: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
2021-06-10 14:28:10 +01:00
Paul Duffin
dc3f9566a2 Make TestPlatformBootclasspath_Fragments more realistic
Move the bootclasspath_fragment to be part of an apex to match how they
are expected to be used. Also adds the bar library to the boot jars
config as every module in a bootclasspath_fragment that is referenced
from a platform_bootclasspath module is expected to be in the config.

Bug: 179354495
Test: m nothing
Change-Id: I6f826dce9c006d630ee31d4171fe6fb458cc9442
2021-06-10 12:36:43 +01:00
Paul Duffin
ffa8375f07 Move TestPlatformBootclasspath_Fragments to apex package
This test checks that fragments which are referenced from a
platform_bootclasspath module contribute their hidden API flags to those
used by platform_bootclasspath module. Previously, it was unrealistic
because the bootclasspath_fragment does not belong in an APEX.

This change moves the test from the java package to the apex package to
allow it to be modified to make the bootclasspath_fragment part of an
apex.

Bug: 179354495
Test: m nothing
Change-Id: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
2021-06-10 12:36:43 +01:00
Nikita Ioffe
da6dc31389 Rename test_only_no_hashtree to generate_hashtree
In order not to introduce any changes in the system image default value
of generate_hashtree is currently set to false. Once all the APEXes that
shouldn't have hashtree enable (i.e. non-updatable ones) explicitly set
`generate_hashtree: false` default value will be switched to true.

Test: checked that are no diffs between ${OUT}/system/apex without this
  change and with this change.
Test: m
Bug: 190621617
Change-Id: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
2021-06-09 19:43:46 +01:00
Treehugger Robot
654b4d2337 Merge "Use fingerprint when min_sdk is current or none" am: dddb0152a5 am: 6302bc5461
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1720035

Change-Id: I5985f1e80b2e38f0f6fb031f1706c3494170f9c7
2021-06-01 10:43:33 +00:00
Colin Cross
cbb2b8172d Treat java libraries in classpath fragments as directly in apex
Coverage is applied to java libraries that are directly in an apex.
Mark java libraries that are in an apex through a bootclasspath_fragment
or a systemserverclasspath_fragment as directly in the apex by
implementing CopyDirectlyInAnyApexTag on the dependency tags used for
their contents.

Bug: 183759446
Test: TestApexJavaCoverage
Change-Id: I0116f5f415083b5194000988cb257454ef115200
Merged-In: I0116f5f415083b5194000988cb257454ef115200
(cherry picked from commit c33e5216f1)
2021-05-27 13:14:33 -07:00
Liz Kammer
4854a7d2cb Use fingerprint when min_sdk is current or none
We have versions of the same apex targetting different min_sdk_versions;
however, fingerprint is overriding the hardcoded min_sdk_version. We
should only be overriding if it is current or unset.

Test: go test apex soong tests
Change-Id: Id030a5ba7d8edebb806ce83d318132fd839a00a5
2021-05-27 14:28:27 -04:00
Martin Stjernholm
c4f4cedc47 Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx."
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719298

Bug: 180325915
Change-Id: I1fd96bad2326612d153fed31308914902f58d3ec
Merged-In: Icbe4e025ce1a4c8dd258ff95d326ca2f27905188
(cherry picked from commit f4c44417a3)
2021-05-27 17:23:16 +00:00
Martin Stjernholm
6912b71c08 Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx." am: 664b2cf89a am: 5eb4b21deb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719298

Change-Id: I72b64b8f26bdb135838f8cf735b2ac7da84cdba7
2021-05-27 10:14:36 +00:00
Martin Stjernholm
664b2cf89a Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx." 2021-05-27 09:24:55 +00:00
Colin Cross
532e863da0 Merge changes I0116f5f4,I950c9b54,I967f5c42 am: 4ab2dd1afe am: 7ca753793f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1718475

Change-Id: I864c97d90aa8f2ec4e43ac9d39464ca257b608e2
2021-05-27 01:38:25 +00:00
Colin Cross
4ab2dd1afe Merge changes I0116f5f4,I950c9b54,I967f5c42
* changes:
  Treat java libraries in classpath fragments as directly in apex
  Make CopyDirectlyInAnyApex match the documentation
  Remove unused cc.copyDirectlyInAnyApexDependencyTag
2021-05-27 00:56:52 +00:00
Martin Stjernholm
7e6cf31742 Merge "Move logic to disable flattening in unbundled app mode from Soong to make." am: 0770a175a1 am: 8f8a1abeb7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1714380

Change-Id: I7d8b1ddd5fd18468430a0b0be0686d6f365ab021
2021-05-26 19:15:59 +00:00
Martin Stjernholm
0770a175a1 Merge "Move logic to disable flattening in unbundled app mode from Soong to make." 2021-05-26 18:21:45 +00:00
Colin Cross
c33e5216f1 Treat java libraries in classpath fragments as directly in apex
Coverage is applied to java libraries that are directly in an apex.
Mark java libraries that are in an apex through a bootclasspath_fragment
or a systemserverclasspath_fragment as directly in the apex by
implementing CopyDirectlyInAnyApexTag on the dependency tags used for
their contents.

Bug: 183759446
Test: TestApexJavaCoverage
Change-Id: I0116f5f415083b5194000988cb257454ef115200
2021-05-26 10:07:44 -07:00
Martin Stjernholm
be10503d3a Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx.
Neither InApexVariants nor InApexModules should have them. This allows
us to get rid of InApexVariantByBaseName as well.

Test: m nothing
Test: m nothing SOONG_CONFIG_art_module_source_build=false
Bug: 180325915
Change-Id: Icbe4e025ce1a4c8dd258ff95d326ca2f27905188
2021-05-26 17:05:17 +01:00
Artur Satayev
f1adfb38fb Merge "Rename generate proto config file to match classpath type." into sc-dev 2021-05-25 19:40:05 +00:00
satayev
207d97ef20 Merge "Rename generate proto config file to match classpath type." am: 70975ac815 am: 0e595182a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1713996

Change-Id: Ia6d89b8c5fa22e9e073e16810ab44631f1646e2c
2021-05-25 14:42:54 +00:00
satayev
70975ac815 Merge "Rename generate proto config file to match classpath type." 2021-05-25 14:17:04 +00:00
Paul Duffin
0788cd6038 Only export boot image files to APEX if they are actually created
Previously, the generation of the rules to create the boot image files
was separate from the code to provide those files to the APEX which
meant that it was possible for the APEX to try and use files that had
no rules to create them.

This changes avoids that by only exporting the files once the rules
have been created.

This necessitated a few changes to tests that were relying on the
previous behavior. Including removing completely the test that used an
image_name: "boot" as that is no longer a valid configuration name as
its functionality has been replaced by platform_bootclasspath.

A follow up change will make the validation of the properties of
bootclasspath_fragment stricter to prevent "boot" being used as the
image_name.

Bug: 177892522
Bug: 188680624
Test: lunch qemu_trusty_arm64-userdebug
      m droid dist
      - verify that before this change it fails and after this change
        it works.
      m com.android.art
      - verify that this change does not change the APEX contents with
        either qemu_trusty_arm64-userdebug or aosp_arm64-userdebug
Merged-In: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
Change-Id: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
(cherry picked from commit 58e0e769c9)
2021-05-25 09:30:20 +01:00
Martin Stjernholm
cb3ff1e412 Move logic to disable flattening in unbundled app mode from Soong to
make.

Avoids TARGET_FLATTEN_APEX lying about it, so we can trust it in
scripts, e.g. in art/build/apex/runtests.sh.

Test: banchan com.android.art; art/build/apex/runtests.sh
Bug: 179900989
Change-Id: I5361957c448e61634689968424450420479f6111
2021-05-25 00:28:27 +01:00
Paul Duffin
dafcf9c54d Merge "Only export boot image files to APEX if they are actually created" am: 6778edb558 am: 923bb78212
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1716109

Change-Id: I5214f09a1510dc7e9072f04f3536bdde804fb69e
2021-05-24 22:58:30 +00:00
Paul Duffin
67c1e57551 Support hidden API processing for fragments with dependencies
Previously, a bootclasspath_fragment that depended on classes provided
by another bootclasspath_fragment did not support hidden API processing
as it would not supply information about those dependencies.

This change adds support for that as follows. Each fragment:
1. Exports the transitive sets of stub dex jars for each of the public,
   system, test and core_platform APIs (where relevant).
2. Adds dependencies onto its dependent fragments.
3. Retrieves the API stubs dex jars from its dependent fragments and
   passes them to the "hiddenapi list" tool which will use them to
   resolve dependencies but will not output them to the generated
   flags.

Once the flags are generated the existing encoding functionality
encodes the flags into the dex files of the bootclasspath_fragment's
content modules which are then packaged into the apex.

Bug: 179354495
Test: m com.android.sdkext
      - verify that this does not change the contents of the apex files
Merged-In: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
Change-Id: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
(cherry picked from commit f1b358cb57)
2021-05-24 20:26:02 +01:00
Paul Duffin
2100e6f95c Support hidden API processing for fragments with dependencies am: f1b358cb57 am: 95a64e35a0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710437

Change-Id: I61c7810343ae468d68a01724f844346919551f21
2021-05-24 17:59:24 +00:00
Paul Duffin
58e0e769c9 Only export boot image files to APEX if they are actually created
Previously, the generation of the rules to create the boot image files
was separate from the code to provide those files to the APEX which
meant that it was possible for the APEX to try and use files that had
no rules to create them.

This changes avoids that by only exporting the files once the rules
have been created.

This necessitated a few changes to tests that were relying on the
previous behavior. Including removing completely the test that used an
image_name: "boot" as that is no longer a valid configuration name as
its functionality has been replaced by platform_bootclasspath.

A follow up change will make the validation of the properties of
bootclasspath_fragment stricter to prevent "boot" being used as the
image_name.

Bug: 177892522
Bug: 188680624
Test: lunch qemu_trusty_arm64-userdebug
      m droid dist
      - verify that before this change it fails and after this change
        it works.
      m com.android.art
      - verify that this change does not change the APEX contents with
        either qemu_trusty_arm64-userdebug or aosp_arm64-userdebug
Change-Id: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
2021-05-24 16:22:43 +01:00
Paul Duffin
f1b358cb57 Support hidden API processing for fragments with dependencies
Previously, a bootclasspath_fragment that depended on classes provided
by another bootclasspath_fragment did not support hidden API processing
as it would not supply information about those dependencies.

This change adds support for that as follows. Each fragment:
1. Exports the transitive sets of stub dex jars for each of the public,
   system, test and core_platform APIs (where relevant).
2. Adds dependencies onto its dependent fragments.
3. Retrieves the API stubs dex jars from its dependent fragments and
   passes them to the "hiddenapi list" tool which will use them to
   resolve dependencies but will not output them to the generated
   flags.

Once the flags are generated the existing encoding functionality
encodes the flags into the dex files of the bootclasspath_fragment's
content modules which are then packaged into the apex.

Bug: 179354495
Test: m com.android.sdkext
      - verify that this does not change the contents of the apex files
Change-Id: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
2021-05-24 14:56:10 +01:00
satayev
53d0678b57 Rename generate proto config file to match classpath type.
There is no need to leak soong module names.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
Merged-In: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
2021-05-24 13:38:45 +01:00
satayev
227e745e56 Rename generate proto config file to match classpath type.
There is no need to leak soong module names.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
2021-05-24 12:52:01 +01:00
Paul Duffin
b40610ad00 Perform hidden API encoding in bootclasspath_fragment
Previously, the apex content info was populated with hidden API encoded
dex jars retrieved directly from the java module. This change retrieves
the unencoded dex jars from the java module, encodes them and then
stores the result in the apex content info.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Merged-In: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
Change-Id: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
(cherry picked from commit 54c98f5b4a)
2021-05-23 18:41:47 +01:00
Paul Duffin
effa46cd61 Perform hidden API encoding in bootclasspath_fragment am: 54c98f5b4a am: 9ef1a9fc36
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710512

Change-Id: I67ed11f9e5685c4427a3a8d62e3c9161ebd6a1b6
2021-05-23 15:45:13 +00:00
Paul Duffin
54c98f5b4a Perform hidden API encoding in bootclasspath_fragment
Previously, the apex content info was populated with hidden API encoded
dex jars retrieved directly from the java module. This change retrieves
the unencoded dex jars from the java module, encodes them and then
stores the result in the apex content info.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Change-Id: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
2021-05-23 11:21:38 +01:00
Martin Stjernholm
63c1912ec2 Merge "Fix indexing bug when config.Arches() returns an empty array." am: 22053dcbf2 am: 029005ee20
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1716108

Change-Id: I16798dc8a2d554c8f8562471d75227e8e807704d
2021-05-22 19:28:15 +00:00
Martin Stjernholm
df298b3bed Fix indexing bug when config.Arches() returns an empty array.
This happens when com.android.art.host is not disabled in
prebuilts/build-tools/build-prebuilts.sh.

Test: m nothing
Test: env OUT_DIR=out prebuilts/build-tools/build-prebuilts.sh
  on the aosp-build-tools branch
Bug: 188922057
Change-Id: Ib21d17bb627e4cf7faee320febe65e1bb4566d4e
2021-05-21 21:07:26 +01:00
Martin Stjernholm
f7a62e6c73 Merge changes I4e7a7ac5,I0c73361b into sc-dev
* changes:
  Record the actual APEXes that a module is part of.
  Rename InApexes -> InApexVariants
2021-05-21 19:22:15 +00:00
Paul Duffin
7555fcbab3 Store dex jar paths in bootclasspath_fragment's apex content info
Previously, the DexBootJarPathForContentModule(module) simply called
directly through to the module to retrieve the dex jar path. This
change changes it so the bootclasspath_fragment retrieves the dex
jars from the module and stores them in the info structure for this
method to retrieve directly.

This makes it easier for the bootclasspath_fragment to stop retrieving
hidden API encoded dex jars from the module and perform the encoding
itself.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Merged-In: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
Change-Id: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
(cherry picked from commit 1a8010a241)
2021-05-21 09:34:53 +01:00
Jiyong Park
59b9f14173 Record the actual APEXes that a module is part of.
Consider this case:

apex {
    name: "com.android.foo",
    native_libs: ["foo"],
}

override_apex {
    name: "com.mycompany.android.foo",
    base: "com.android.foo",
}

cc_library {
    name: "foo",
}

There are two APEXes defined: "com.android.foo" and
"com.mycompany.android.foo" which is a copy of "com.android.foo" with
some properties overridden (e.g. signing keys).

The module "foo" is mutated into two variants by the apex mutator: the
platform variant and the apex variant. The former has the variation name
"" and the later has "apex<min_api_ver>" which usually is "apex10000".

Internally, the apex variant has an alias "com.android.foo".

ApexInfo.InApexVariants() returns only "com.android.foo" when called for
the module "foo".

We can see that the information that "foo" is also part of
"com.mycompany.android.foo" is completely lost. This is causing problem
when we compare the apex membership by their "soong module name", not
the "apex name". In the example above, the two modules have different
soone module names, but have the same apex name: "com.android.foo".

To fix that, this CL introduces a new field `InApexes` to the `ApexInfo`
struct. It has the actual name of the APEXes that the module is part of.
With the example above, `InApexes` is ["com.android.foo",
"com.mycompany.android.foo"].

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

Bug: 180325915
Test: m nothing
Test: m nothing on non-AOSP targets with ag/13740887 applied.

Change-Id: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
Merged-In: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
2021-05-20 17:36:22 +01:00
Jiyong Park
712e8b5b1b Rename InApexes -> InApexVariants
.. in preparation for the upcoming change. This change doesn't alter any
behavior.

InApexes is a misleading name. People expects that it has the list of
soong module names of the APEXes that a module is part of. So, for
example, `core-oj` is a part of both `com.android.art` and
`com.google.android.art`. However, in reality, that's not true. The
field has `com.android.art` only. This is because the two APEXes
(android and Google) have the same apex name which is `com.android.art`.
That apex name is used in various places like the `apex_available` and
allows us to keep using the same name regardless of whether the APEX is
overridden or not.

However, this is causing problems in some cases where the exact list of
soong module names is required. The upcoming change will add a new field
to handle the case and the new field actually will get the name
'InApexes'. So, the existing field is renamed to a less misleading name
`InApexVariants`.

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

Bug: 180325915
Test: m nothing

Change-Id: I0c73361b452eddb812acd5ebef5dcedaab382436
Merged-In: I0c73361b452eddb812acd5ebef5dcedaab382436
2021-05-20 17:36:22 +01:00
Paul Duffin
41b91fad5b Merge "Store dex jar paths in bootclasspath_fragment's apex content info" am: bf4e6ec8a7 am: 02d4f36f2c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710510

Change-Id: I751375cd9d4f4c40f776ceb858ecd83e992e4b04
2021-05-20 13:34:41 +00:00
Paul Duffin
bf4e6ec8a7 Merge "Store dex jar paths in bootclasspath_fragment's apex content info" 2021-05-20 12:46:48 +00:00
Jiyong Park
1df9944677 Merge changes I4e7a7ac5,I0c73361b am: 6fae608181 am: 058b7332db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710529

Change-Id: I45f947f67305801b2389c2dcb84b66caf997cea1
2021-05-20 10:42:10 +00:00
Jiyong Park
6fae608181 Merge changes I4e7a7ac5,I0c73361b
* changes:
  Record the actual APEXes that a module is part of.
  Rename InApexes -> InApexVariants
2021-05-20 09:59:59 +00:00
Paul Duffin
40aa4363cb Merge "Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath" 2021-05-20 06:58:34 +00:00
Paul Duffin
d90fde3758 Test dex jar paths provided to apex by bootclasspath_fragment
This change adds a test to verify the existing behavior to provide a
baseline against which following changes can be compared.

Bug: 179354495
Test: m nothing
Merged-In: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
(cherry picked from commit f2fa0b5e8e)
2021-05-20 07:56:17 +01:00
Paul Duffin
32669567f6 Merge "Test dex jar paths provided to apex by bootclasspath_fragment" am: 4483ec110d am: 5f12386d2f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710508

Change-Id: I007f4b574e820553261cb8e17455f4f267df50f6
2021-05-19 20:30:00 +00:00
Paul Duffin
1a8010a241 Store dex jar paths in bootclasspath_fragment's apex content info
Previously, the DexBootJarPathForContentModule(module) simply called
directly through to the module to retrieve the dex jar path. This
change changes it so the bootclasspath_fragment retrieves the dex
jars from the module and stores them in the info structure for this
method to retrieve directly.

This makes it easier for the bootclasspath_fragment to stop retrieving
hidden API encoded dex jars from the module and perform the encoding
itself.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Change-Id: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
2021-05-19 16:17:30 +01:00
Paul Duffin
59db6d4c5d Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath
The AlwaysUsePrebuiltSdks() causes all java_sdk_library_import modules
to be preferred over the source, i.e. as if they had prefer: true set.
That interacts badly with the work that is being done to integrate the
bootclasspath_fragment/platform_bootclasspath modules into the build.

It would work fine once that integration has been completed but in the
interim it causes problems. e.g. it does not cause a problem in AOSP
because those java_sdk_library_import modules that are affected have
already been integrated into the build properly.

Unfortunately, internally that is not the case because there are
java_sdk_library/java_sdk_library_import modules that still need to
be updated.

Before the java_sdk_library_import can be safely preferred each
java_sdk_library/java_sdk_library_import module that contributes to the
bootclasspath must:
* Be in the contents of matching bootclasspath_fragment and
  prebuilt_bootclasspath_fragment modules.
* Have an apex and one of a prebuilt_apex/apex_set that contains the
  dex implementation jar and lists the prebuilt_bootclasspath_fragment
  name in its exported_bootclasspath_fragments property.

Safely preferred in this context means that the whole build will
continue to work rather than the current situation which is that only
some of the build will work and some will fail if an attempt is
actually made to build it.

Unfortunately, many java_sdk_library_import modules are missing:
* The prebuilt_bootclasspath_fragment.
* The exported_bootclasspath_fragments property on the
  prebuilt_apex/apex_set that contains them.

Together these cause the following symptoms:
1. The java_sdk_library_import does not have a dex implementation jar.
2. The java_sdk_library_import does not have a myapex variant.

These workarounds will avoid Soong reporting build failures. However,
the build will still fail if an attempt is made to build anything
produced by the platform-bootclasspath, e.g. hidden API processing or
a system image.

Bug: 188505921
Bug: 179354495
Test: m TARGET_BUILD_APPS=Calendar
Change-Id: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
2021-05-19 14:12:45 +00:00
Paul Duffin
f2fa0b5e8e Test dex jar paths provided to apex by bootclasspath_fragment
This change adds a test to verify the existing behavior to provide a
baseline against which following changes can be compared.

Bug: 179354495
Test: m nothing
Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
2021-05-19 13:48:25 +01:00
Paul Duffin
7487a7abb6 Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath
The AlwaysUsePrebuiltSdks() causes all java_sdk_library_import modules
to be preferred over the source, i.e. as if they had prefer: true set.
That interacts badly with the work that is being done to integrate the
bootclasspath_fragment/platform_bootclasspath modules into the build.

It would work fine once that integration has been completed but in the
interim it causes problems. e.g. it does not cause a problem in AOSP
because those java_sdk_library_import modules that are affected have
already been integrated into the build properly.

Unfortunately, internally that is not the case because there are
java_sdk_library/java_sdk_library_import modules that still need to
be updated.

Before the java_sdk_library_import can be safely preferred each
java_sdk_library/java_sdk_library_import module that contributes to the
bootclasspath must:
* Be in the contents of matching bootclasspath_fragment and
  prebuilt_bootclasspath_fragment modules.
* Have an apex and one of a prebuilt_apex/apex_set that contains the
  dex implementation jar and lists the prebuilt_bootclasspath_fragment
  name in its exported_bootclasspath_fragments property.

Safely preferred in this context means that the whole build will
continue to work rather than the current situation which is that only
some of the build will work and some will fail if an attempt is
actually made to build it.

Unfortunately, many java_sdk_library_import modules are missing:
* The prebuilt_bootclasspath_fragment.
* The exported_bootclasspath_fragments property on the
  prebuilt_apex/apex_set that contains them.

Together these cause the following symptoms:
1. The java_sdk_library_import does not have a dex implementation jar.
2. The java_sdk_library_import does not have a myapex variant.

These workarounds will avoid Soong reporting build failures. However,
the build will still fail if an attempt is made to build anything
produced by the platform-bootclasspath, e.g. hidden API processing or
a system image.

Bug: 188505921
Bug: 179354495
Test: m TARGET_BUILD_APPS=Calendar
Change-Id: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
Merged-In: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
2021-05-19 11:42:20 +00:00
satayev
2f45f4eec1 Add systemserverclasspath_fragments property to apex.
- All contents of the fragment are added as java_lib dependencies.
- Generated classpaths.proto is added into etc as required.

Bug: 180105615
Test: m nothing
Merged-In: I8e8e8b019c4ca2909182f205a47deffa946de6da
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
(cherry picked from commit 333a1732b1)
2021-05-18 10:37:52 +01:00
satayev
72ede0fac5 Move classpaths.proto related info into a separate provider.
The new info struct can be easily shared with systemserverclasspath
fragments.

Bug: 180105615
Test: m nothing
Merged-In: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
Change-Id: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
(cherry picked from commit 14e49130bb)
2021-05-18 10:37:51 +01:00
Jiyong Park
78349b56a0 Record the actual APEXes that a module is part of.
Consider this case:

apex {
    name: "com.android.foo",
    native_libs: ["foo"],
}

override_apex {
    name: "com.mycompany.android.foo",
    base: "com.android.foo",
}

cc_library {
    name: "foo",
}

There are two APEXes defined: "com.android.foo" and
"com.mycompany.android.foo" which is a copy of "com.android.foo" with
some properties overridden (e.g. signing keys).

The module "foo" is mutated into two variants by the apex mutator: the
platform variant and the apex variant. The former has the variation name
"" and the later has "apex<min_api_ver>" which usually is "apex10000".

Internally, the apex variant has an alias "com.android.foo".

ApexInfo.InApexVariants() returns only "com.android.foo" when called for
the module "foo".

We can see that the information that "foo" is also part of
"com.mycompany.android.foo" is completely lost. This is causing problem
when we compare the apex membership by their "soong module name", not
the "apex name". In the example above, the two modules have different
soone module names, but have the same apex name: "com.android.foo".

To fix that, this CL introduces a new field `InApexes` to the `ApexInfo`
struct. It has the actual name of the APEXes that the module is part of.
With the example above, `InApexes` is ["com.android.foo",
"com.mycompany.android.foo"].

Bug: 180325915
Test: m nothing
Test: m nothing on non-AOSP targets with ag/13740887 applied.

Change-Id: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
2021-05-18 16:05:29 +09:00
Jiyong Park
ab50b0795a Rename InApexes -> InApexVariants
.. in preparation for the upcoming change. This change doesn't alter any
behavior.

InApexes is a misleading name. People expects that it has the list of
soong module names of the APEXes that a module is part of. So, for
example, `core-oj` is a part of both `com.android.art` and
`com.google.android.art`. However, in reality, that's not true. The
field has `com.android.art` only. This is because the two APEXes
(android and Google) have the same apex name which is `com.android.art`.
That apex name is used in various places like the `apex_available` and
allows us to keep using the same name regardless of whether the APEX is
overridden or not.

However, this is causing problems in some cases where the exact list of
soong module names is required. The upcoming change will add a new field
to handle the case and the new field actually will get the name
'InApexes'. So, the existing field is renamed to a less misleading name
`InApexVariants`.

Bug: 180325915
Test: m nothing

Change-Id: I0c73361b452eddb812acd5ebef5dcedaab382436
2021-05-18 16:05:14 +09:00
satayev
333a1732b1 Add systemserverclasspath_fragments property to apex.
- All contents of the fragment are added as java_lib dependencies.
- Generated classpaths.proto is added into etc as required.

Bug: 180105615
Test: m nothing
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
2021-05-17 21:46:08 +01:00
satayev
14e49130bb Move classpaths.proto related info into a separate provider.
The new info struct can be easily shared with systemserverclasspath
fragments.

Bug: 180105615
Test: m nothing
Change-Id: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
2021-05-17 21:46:04 +01:00
Paul Duffin
b18537443e Order apex files by destination path not source path
The destination path, i.e. the path the file will occupy in the APEX is
more stable and less likely to change than the source path, i.e. the
path of the file in the out or source directories. This makes it easier
to diff changes in the copy commands.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
      - verify that this does change the order of copy_commands for the above apexes
Merged-In: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
Change-Id: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
(cherry picked from commit 5606029007)
2021-05-17 21:19:51 +01:00
Paul Duffin
5606029007 Order apex files by destination path not source path
The destination path, i.e. the path the file will occupy in the APEX is
more stable and less likely to change than the source path, i.e. the
path of the file in the out or source directories. This makes it easier
to diff changes in the copy commands.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
      - verify that this does change the order of copy_commands for the above apexes
Change-Id: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
2021-05-16 22:28:26 +01:00
Paul Duffin
20042da220 Merge "Refactor special handling of hidden API encoding for master-art" am: fdd9743609 am: 1b5e8cdbee am: 23b34baa5c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707569

Change-Id: I5dbe8a4c4fc0f4e8a91ec9c04f32a7d71f96715e
2021-05-14 19:52:52 +00:00
Paul Duffin
7b07c01f20 Merge "Generate monolithic hidden API files direct from class jars" am: 21f62ef867 am: b28f562092 am: 8063427dc4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707573

Change-Id: I116c3a4028fd199df12ead373fbfb4d47c6fdf8e
2021-05-14 19:52:42 +00:00
Paul Duffin
b6f53c064e Refactor special handling of hidden API encoding for master-art
Instead of encoding the hidden API with an empty set of flags when the
monolithic flags are not available this simply disables encoding
altogether which should have the same behavior at runtime.

This change also removes the unused flags field in hiddenAPISingleton
which was set but never read.

Bug: 179354495
Test: m nothing
Change-Id: I32d5825e5271829993dd4e5be4d4ee1b22fa7b22
2021-05-14 15:57:10 +01:00
Paul Duffin
537ea3d04c Generate monolithic hidden API files direct from class jars
Previously, the monolithic hidden API files, e.g. hiddenapi-index.csv
file, were generated in two steps. First, each module created its own
files using the information in its class jars. Then, the monolithic
files were created by merging those module specific files into a larger
file.

This change switches to generating the monolithic files directly from
the class jar files and bypassing the intermediate files.

In order to ensure that this change did not change the monolithic files
it is necessary for the hiddenapi-metadata.csv to go through a
reformatting step. Hopefully, this will be able to be removed in a
follow up change.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I5a78e747516014b7c0f402a4b4431b14be6a84b2
2021-05-14 15:57:04 +01:00
Paul Duffin
8a08117373 Merge "Move copying of dex files from dexpreopt_bootjars singleton" am: cfd24da1f4 am: 7be9378c61 am: 817187082c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1690881

Change-Id: If03ec0c3263413d2c88d91d510752d6bb3d4de80
2021-05-13 11:52:25 +00:00
Paul Duffin
cfd24da1f4 Merge "Move copying of dex files from dexpreopt_bootjars singleton" 2021-05-13 10:53:51 +00:00
Paul Duffin
b8e0b473a1 Merge "Move markPlatformAvailability mutator before apexMutator" am: c75bf688cb am: 2b7d228aac am: d7d657a5c6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705264

Change-Id: I1be6f516b354d84b7802be69044429db03fe3c20
2021-05-13 10:39:51 +00:00
Paul Duffin
c75bf688cb Merge "Move markPlatformAvailability mutator before apexMutator" 2021-05-13 09:50:56 +00:00
Paul Duffin
b964b24a51 Merge "Allow module types to force creation of a default APEX variant" am: 9896b3424b am: 05ca6f6919 am: 5c45498964
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705263

Change-Id: I4365d9d1dfbfcd8bf9aa3f6381ec9470b7ff9921
2021-05-13 09:06:26 +00:00
Paul Duffin
9896b3424b Merge "Allow module types to force creation of a default APEX variant" 2021-05-13 08:07:19 +00:00
Ivan Lozano
a072c5ae56 Merge "Refactor vendor snapshot to use LinkableInterface." am: 7ce2dee09e am: 61c475060a am: 001c11e93a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1680606

Change-Id: Ifff15886dba6bda0754d086456a1db3b7524e4ed
2021-05-12 21:13:41 +00:00
Paul Duffin
7ebebfd5f8 Move copying of dex files from dexpreopt_bootjars singleton
The art dex files are copied in the bootclasspath_fragment and the
non-updatable and updatable dex files are copied in the
platform_bootclasspath.

Bug: 177892522
Test: m nothing
Change-Id: I5d3d533d1a7a9f8e7ae20c12eb33029a898a2cd6
2021-05-12 21:51:19 +01:00
Ivan Lozano
d7586b6526 Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.

Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
2021-05-12 14:01:10 -04:00
Paul Duffin
28bf7ee2ad Move markPlatformAvailability mutator before apexMutator
This will allow the apexMutator to use the NotAvailableForPlatform()
method initialized by the markPlatformAvailability mutator to help
determine whether to create a platform variant or not.

Bug: 187910671
Test: m droid
Change-Id: I745b4428afc68e7ca4cd2f4cbe810b8df1eebdb7
2021-05-12 16:41:35 +01:00
Paul Duffin
b5769c15a3 Allow module types to force creation of a default APEX variant
Bug: 187910671
Test: m droid
Change-Id: I797d4ab60d15b526744fe6e4df1b55c8b75b0310
2021-05-12 16:16:51 +01:00
Treehugger Robot
ddcf758f8c Merge "Generate empty classpaths.proto for bootclasspath_fragment.go." am: a556647c50 am: 3e51be492f am: 613e4c502a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699193

Change-Id: Ia92df6204946e3e28341cd27a75d108b657754cc
2021-05-11 13:44:08 +00:00
Treehugger Robot
a556647c50 Merge "Generate empty classpaths.proto for bootclasspath_fragment.go." 2021-05-11 12:53:23 +00:00
satayev
3db3547d1f Generate empty classpaths.proto for bootclasspath_fragment.go.
- Adds all required details for bootclasspath_fragment to implement
  classpath_fragment.
- Keeps the actual boot jars in platform-bootclasspath to begin with.
- Makes sure to put the file in apex/etc/classpath on device. Note that
  for platform versions of classpath fragment AndroidMkEntries perform
  the installation, while for APEXes it must be plumbed via apex.go.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I6101ebdf5b8bcbe95c0b7ce21f3f67a2685aef50
2021-05-11 10:34:47 +01:00
Paul Duffin
6f187fd3d2 Merge "Generalize deapexer module to export any files" am: d8561166eb am: c012dfc534 am: e3530f6c3e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697666

Change-Id: Ib13318ebdad7133d92cc7b7f743ef291a9aa7112
2021-05-10 20:36:06 +00:00
Paul Duffin
4ea8e00c8f Merge "Simplify prebuilt_apex/apex_set common properties" am: 9f361c301d am: 977a1c20cd am: 2ee29af83b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697665

Change-Id: I4a1825d199b1423660ba0cf8b464cc4b5ad0e6f6
2021-05-10 20:35:57 +00:00
Paul Duffin
e8e6b89dd6 Merge "Derive deapexer module properties from transitive dependencies" am: eeec6bd460 am: 955ddedc44 am: 0bdaee7798
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697058

Change-Id: I866f0a2df8493077a9f81e16fcaafb0644586df9
2021-05-10 15:19:19 +00:00
Paul Duffin
909dc2222a Merge "Move creation of deapexer modules to separate mutator" am: b60def6def am: c9b695b6d7 am: 366800572f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697057

Change-Id: I2aa8dec28f1ac5b8e123d099a167c8e1562e16d6
2021-05-10 15:19:11 +00:00
Paul Duffin
3bae068ee5 Generalize deapexer module to export any files
Previously, the deapexer module had to duplicate the java library
specific logic for constructing the path to the library's dex file in
the .apex file. That is not something that the deapexer needs to be
aware of, all it needs is a list of files that should be exported.

This change moves that logic into the prebuilt_apex/apex_set modules
and generalizes the deapexer module so that it can export any files
that are requested.

The deapexer module does still need to know which java modules need
access to exported files so it can add dependencies from them onto
itself. However, it does not need to know what the type of the module
is.

Bug: 186455808
Test: m nothing
      m SOONG_CONFIG_art_module_source_build=false nothing
Change-Id: I71c6f0f761efe3b6d66d54273786e98cd545811c
2021-05-10 14:26:37 +01:00
Paul Duffin
bb0dc13afe Simplify prebuilt_apex/apex_set common properties
Moves all properties common to prebuilt_apex and apex_set module types
into prebuiltCommonProperties. Removes selectedApexProperties from
Prebuilt as that duplicated, and masked, the same property in
prebuiltCommon.

Bug: 187266082
Test: m nothing
      m SOONG_CONFIG_art_module_source_build=false nothing
      - this fails but not because of missing APEX variants
Change-Id: Ice7dfb8e18bb526fdd5b41bcd518c6971564d81b
2021-05-10 12:01:29 +01:00
Paul Duffin
57f8359fe3 Derive deapexer module properties from transitive dependencies
Previously, the deapexer module properties were simply passed through
from the prebuilt_apex/apex_set modules. This change derives the
properties from the transitive dependencies of the modules so that it
can automatically include the contents of a bootclasspath_fragment
module without having to duplicate them in the exported_java_libs
property.

Part of this change involves moving the addition of dependencies onto
the prebuilt apex's contents from DepsMutator to ComponentDepsMutator
so that they can be visited in the createDeapexerModule() function. The
ComponentDepsMutator runs before prebuilts without matching sources are
renamed to match the source name which simplifies the process of adding
dependencies directly onto the prebuilts.

The deapexerDeps method was renamed as the dependencies are added both
for use by deapexer and also to create APEX variants for access by
platform_bootclasspath so the name was confusing.

Bug: 187266082
Test: m nothing
      m SOONG_CONFIG_art_module_source_build=false nothing
      - this fails but not because of missing APEX variants
Change-Id: Icb4f883e7d2b63739e5ff0dc6edb8a906d80189b
2021-05-10 11:51:20 +01:00
Paul Duffin
5dda3e387e Move creation of deapexer modules to separate mutator
Previously, deapexer modules were created by the LoadHook which meant
that the deapexer module could not use any information derived from the
dependencies of the prebuilt_apex/apex_set modules. This change moves
the creation into a separate mutator that runs after
ComponentDepsMutator and before DepsMutator. That means that a follow
up change can use information from dependencies added by the former
mutator in order to create the deapexer module and the deapexer module
can itself add dependencies onto other modules.

This change also dedups the logic to determine whether a deapexer
module is needed by pushing it down into the createDeapexerModule
method which was renamed to createDeapexerModuleIfNeeded to reflect its
conditional nature.

Bug: 187266082
Test: m nothing
      m SOONG_CONFIG_art_module_source_build=false nothing
Change-Id: I65316473ff1e4b2827ff48ab5a870a8ce5c0475a
2021-05-10 11:41:40 +01:00
Paul Duffin
f93ca54858 Merge "Transitively add APEX variants for contents of prebuilt_apex/apex_set" am: c76155cd71 am: c8e88cf3f7 am: 85e40bba2c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697056

Change-Id: Ieed47b213f67248c1bc13957036c1037c356789b
2021-05-07 09:15:50 +00:00
Paul Duffin
b17d044628 Transitively add APEX variants for contents of prebuilt_apex/apex_set
This is part of the work needed to allow the exported_java_libs
property to be replaced by exported_bootclasspath_fragments.

Bug: 187266082
Test: m nothing
      m SOONG_CONFIG_art_module_source_build=false nothing
Change-Id: I2c1d70a390200b93163f9799719290c9d55a041c
2021-05-06 23:43:43 +01:00
Colin Cross
8bc6482ab6 Merge "Ignore cc.Module.HideFromMake when producing flattened apex Android.mk entries" am: a5b1ea248f am: 46c461b968 am: b56c6b9379
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1691266

Change-Id: I3f6adf9f706f94fa6b4959819e8c17c0ee4e60eb
2021-04-30 15:14:26 +00:00
Colin Cross
a5b1ea248f Merge "Ignore cc.Module.HideFromMake when producing flattened apex Android.mk entries" 2021-04-30 14:43:03 +00:00
Treehugger Robot
cb249eb7d0 Merge "Move configuration checks from getBootImageJar" am: 3f9af76391 am: e4a004eaa3 am: a1fe410f89
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1688391

Change-Id: I3dc9ceef57776a0198911365d2235b471f412513
2021-04-30 13:57:30 +00:00
Paul Duffin
f23bc472b0 Move configuration checks from getBootImageJar
The getBootImageJar function will be removed once the boot image
creation has been moved to the platform_bootclasspath and
bootclasspath_fragment module types. However, the consistency checks
that it performs are still useful so this change moves them out
first.

The ART boot image related checks are now performed in the
bootclasspath_fragment module type. A previous change accidentally
disabled the checks when the contents property was not empty which has
been fixed. Also, the error messages have been tweaked to make it clear
that the art-bootclasspath-fragment is now the source of truth as to
its contents not the configuration.

The framework boot image related checks are now performed in the
platform_bootclasspath module type.

Initially, this change included an extra check to make sure that
UpdatableBootJars comes from updatable APEXes but that broke because
framework-wifi and framework-tethering are not currently marked as
updatable in AOSP.

Bug: 177892522
Test: m nothing
Change-Id: I80fb600fa2c7cec4566b3461c6a33c4c6f0743f4
2021-04-30 12:06:28 +01:00
Colin Cross
76f0ba81d3 Ignore cc.Module.HideFromMake when producing flattened apex Android.mk entries
The modules in a flattened apex have suffixes that ensure they don't
conflict with the platform versions, so they can ignore HideFromMake.
This ensures that Make can install symbols for all libraries in
apexes.

Fixes: 180622230
Test: banchan com.android.adbd && m && ls $OUT/symbols/apex/com.android.adbd/lib
Change-Id: I76d1aba2eed6ae27d9a954bf88f40f0d00fc6a98
2021-04-29 13:54:49 -07:00
Colin Cross
8ddd62ec7a Merge "Remove obsolete llndk_library" am: 5423a9c513 am: d9be64ea31 am: 4646975e32
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1687470

Change-Id: I2c3e45786305e3b1854c9448b89f0a82177acf13
2021-04-29 03:37:41 +00:00
Steven Moreland
2c4000c7a6 apex: remove use_vendor
Should manually cut dependencies instead. Previously, this was used to
take advantage of the limited dependencies of variant libs in some APEXes.

Fixes: 175318864
Test: m nothing
Change-Id: Id559fd1bea5c8b8696cf7ab8acc711a7c3844d14
2021-04-27 02:08:49 +00:00
Colin Cross
203b421043 Remove obsolete llndk_library
Remove llndk_library in favor of cc_library with llndk.symbol_file.

Bug: 170784825
Test: m checkbuild
Test: TestLlndkLibrary
Change-Id: I43580976589a7a2a176d7442be53fa043c0c8324
2021-04-26 18:41:00 -07:00
Paul Duffin
d9668be58b Merge "Allow contents and image_name to be specified together" am: 3d14889c5b am: 1081c7d85e am: 143eb249d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1686066

Change-Id: I0a6cce08f1c1b48aa2e9a1832212bf7aa2d8fdec
2021-04-26 23:36:31 +00:00
Paul Duffin
ba6afd0dba Allow contents and image_name to be specified together
Previously, only one of the contents or image_name properties could be
specified at once which meant that there was no way to create a
prebuilt which lists its fixed contents while at the same time allowing
it to check that that the contents matched what the build configuration
required.

e.g. a prebuilt_bootclasspath_fragment that had image_name: "art",
could not list its contents and also check that those contents matched
the ART_APEX_JARS which the build configuration required.

This change allows contents and image_name to be specified together and
adds a check to make sure that the contents are consistent with the
configuration appropriate to the image_name. The check is only
performed for modules that are active so that a
prebuilt_bootclasspath_fragment which was created without coverage
enabled (the default) would not cause a build failure in a coverage
build unless it was preferred.

Bug: 177892522
Test: m nothing
Change-Id: Ie601f29f707b3f6030fa7d252afa2c4826cc9f8e
2021-04-26 21:21:58 +01:00
Paul Duffin
3f81c1c71c Merge "Delegate retrieval of dex boot jar for apex to the bootclasspath_fragment" am: 46e4a9e6b1 am: 8745a28532 am: d905f6818a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1686218

Change-Id: Ifea7de140ee9c69cd6afe85bbc1dfab24e446160
2021-04-26 17:04:45 +00:00
Paul Duffin
d2ffb9f670 Merge "Extract bootclasspathFragment related code into separate functions" am: 9768678344 am: c73637a975 am: b1c2ea3c70
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1686217

Change-Id: Ie1063fe890d284a561ea8a1c1d62156aa42105d1
2021-04-26 17:04:41 +00:00
Paul Duffin
3a351c3dbe Merge "Rename BootImageInfo to BootclasspathFragmentApexContentInfo" am: 71c84696f9 am: 8067ee44b3 am: 9e55ae0bd8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1686216

Change-Id: I2a559dbb5dc14cfcf52407e371a0e628ac693634
2021-04-26 17:04:27 +00:00
Paul Duffin
190fdef294 Delegate retrieval of dex boot jar for apex to the bootclasspath_fragment
The dex boot jar for the apex must have had hidden API flags encoded
into it. Currently, the hidden API processing is done within the java
modules themselves so the apex gets the dex boot jar from them.

However, as part of the hidden API modularization work the hidden API
encoding will be performed by the bootclasspath_fragment so this change
prepares for that by delegating the retrieval of the dex boot jars to
the bootclasspath_fragment, via BootclasspathFragmentApexContentInfo.

For the moment that simply delegates straight back to the java module
so this change does not change the build. It will however make it
easier to switch hidden API encoding to the bootclasspath_fragment in
future.

Bug: 179354495
Test: m com.android.art
      - verify that this change does not change its contents
Change-Id: I12eba333749be976bcc72661bb9d6be6cc3c56e3
2021-04-26 11:09:25 +01:00
Paul Duffin
cc33ec8838 Extract bootclasspathFragment related code into separate functions
The apexBundle.GenerateAndroidBuildActions is 400+ lines long which
makes it difficult to understand what is happening.

Bug: 177892522
Test: m com.android.art
      - verify that this change does not change its contents
Change-Id: I07cb31d246377869771bdb18fdc6291365adf399
2021-04-26 11:09:02 +01:00
Paul Duffin
e946b327f4 Rename BootImageInfo to BootclasspathFragmentApexContentInfo
Currently, it only contains ART boot image related information, i.e.
.art, .oat and .vdex files. However, follow up changes will extend that
to include other information from bootclasspath_fragment.

Bug: 177892522
Test: m nothing
Change-Id: I2b226131c0eccff0c739a18f265f90caa10a91d9
2021-04-26 10:05:27 +01:00
Paul Duffin
94993d5ce5 Rename BootImageModule to BootclasspathFragmentModule am: 7771eba88e am: 687425b0af am: 30b9c47cb7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1685589

Change-Id: I1898516696beb6049ee1467832455dc1bfdab6f2
2021-04-23 18:57:27 +00:00
Paul Duffin
7771eba88e Rename BootImageModule to BootclasspathFragmentModule
Also renames files, tests, module types in a similar fashion.

There are still some references to image and boot image. They are kept
for the following reasons:
* image_name - this is the name of an ART boot image, i.e. the
  collection of .art/.oat/.vdex files.
* BootImageInfo - again this is related to the ART boot image.
* .../art_boot_images/... paths - ditto.

Bug: 177892522
Test: m nothing
Change-Id: Ie1f4738061d131fee75de48bc26a7601481bad4d
2021-04-23 16:59:26 +01:00
Paul Duffin
49358086fd Merge "Add exported_bootclasspath_fragments to prebuilt_apex/apex_set" am: ed0b64f65b am: 07b9400abb am: 7c1dda11a6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1683869

Change-Id: I696556aa85dd3d4ca01db854cae0df92f571f999
2021-04-23 14:02:39 +00:00
Paul Duffin
023dba0a3f Add exported_bootclasspath_fragments to prebuilt_apex/apex_set
This is needed to allow a prebuilt_bootclasspath_fragment to be used
interchangeably with a bootclasspath_fragment in the
platform_bootclasspath module.

The platform_bootclasspath module depends on APEX specific variants of
bootclasspath_fragment modules. That works because the
bootclasspath_fragment modules are part of an apex and so have an APEX
specific variant which the platform_bootclasspath can specify.

Using a prebuilt_bootclasspath_fragment in place of a
bootclasspath_fragment requires that the prebuilt also has an APEX
specific variant.

Specifying exported_bootclasspath_fragments on a prebuilt_apex/apex_set
will cause it to create an APEX variant for the named module whcih will
allow it to be selected by the platform_bootclasspath module.

Bug: 186034565
Bug: 177892522
Test: m nothing
Change-Id: I7ddacc6498ec3a4a9f26c5f78b7f9a033e494d78
2021-04-23 12:12:37 +01:00
Treehugger Robot
f72ba1cb46 Merge "Support paths for vintf_fragments from Soong." am: 1552c7b178 am: 193651c2ae am: 0b77156774
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1677041

Change-Id: Ibfed6d59dba34481a0f263aadff065fa178d5f5c
2021-04-22 17:22:51 +00:00
Paul Duffin
3b34058072 Merge "bootclasspath_fragment: Add contents to snapshot" am: 6e0a62b773 am: 889010d73a am: 855362a5da
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1682090

Change-Id: Ie107e8986b9b0dc4251f8e28427399854b44ec43
2021-04-22 17:22:35 +00:00
Treehugger Robot
1552c7b178 Merge "Support paths for vintf_fragments from Soong." 2021-04-22 17:03:31 +00:00
Paul Duffin
6e0a62b773 Merge "bootclasspath_fragment: Add contents to snapshot" 2021-04-22 17:01:24 +00:00
Jaewoong Jung
78ec488af0 Merge "Make apex.key and certificate overridable." am: 6a328ff8ac am: 78939b2bc6 am: e3f8cfe47e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1682218

Change-Id: I81a07e4acd1bbc29413996d3f3b22f3050fd08f9
2021-04-22 16:18:13 +00:00
Paul Duffin
5bca2f26f2 Merge "Move monolithic stub flags generation to platform_bootclasspath" am: 57d13c6892 am: 5774eb9e14 am: ea69b4109b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1683866

Change-Id: Id0e5e6dc8596b7d47fe65c47a66da7a86c20c6cb
2021-04-22 16:17:56 +00:00
Jaewoong Jung
6a328ff8ac Merge "Make apex.key and certificate overridable." 2021-04-22 15:37:22 +00:00
Paul Duffin
57d13c6892 Merge "Move monolithic stub flags generation to platform_bootclasspath" 2021-04-22 15:06:16 +00:00
Paul Duffin
677de9427b Merge changes I67589bcc,Ibcfae390 am: 7cbdf81e95 am: 33f495f305 am: 13b9d25ed4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1683868

Change-Id: Idb4d7af1bf9914bf7bf0306d04daf74ee992fc5e
2021-04-22 15:05:03 +00:00
Paul Duffin
7cbdf81e95 Merge changes I67589bcc,Ibcfae390
* changes:
  Replace boot image with bootclasspath fragment in sdk package
  bootclasspath_fragment must only depend on source contents
2021-04-22 14:02:43 +00:00
Paul Duffin
74431d57c6 Move monolithic stub flags generation to platform_bootclasspath
As part of that this change:
* Moves code that will be common to platform_bootclasspath and
  bootclasspath_fragment from hiddenapi_singleton.go into
  hiddenapi_modular.go.
* Fixes the tests in hiddenapi_singleton_test.go but intentionally
  does not rename them or move them into a more appropriate place so
  as to make it easier to see the differences. A TODO has been added
  and these will be cleaned up in a follow up change.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I680e4dab2e6bdf4a655fa9f255c195175904667e
2021-04-22 14:23:28 +01:00
Nikita Ioffe
d2685e495d Merge "Don't compress apexes when building in unbundled mode" am: 6681ef3101 am: aa3aee5205 am: 910efe3bbe
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1679445

Change-Id: Ia506214e796b4384dcd24901bfb50d80d6333e10
2021-04-21 23:09:11 +00:00
Paul Duffin
a57835e8e5 bootclasspath_fragment: Add contents to snapshot
Bug: 177892522
Test: m nothing
Change-Id: I54fe0537b758a0e3dacd34b139ef3eb21b8841fd
2021-04-21 23:54:22 +01:00
Nikita Ioffe
6681ef3101 Merge "Don't compress apexes when building in unbundled mode" 2021-04-21 21:50:32 +00:00
Paul Duffin
6589805e2a bootclasspath_fragment must only depend on source contents
This change ensures that bootclasspath_fragment only depends on source
modules and prebuilt_bootclasspath_fragment only depends on prebuilt
modules.

It does that in two ways:
1. It adds the dependencies in ComponentDepsMutator method which is
   called before any renaming of prebuilts is done which makes it very
   easy to add a dependency directly onto either the source or prebuilt
   as required.
2. It uses a tag which prevents dependencies on a source module from
   being replaced with a dependency on a prebuilt module which ensures
   that a dependency on the source modules is not replaced with a
   dependency on a prebuilt module.

Bug: 177892522
Test: m nothing
Change-Id: Ibcfae39083afbc07fcf729ead3ed5f5d020845bf
2021-04-21 19:05:37 +01:00
Liz Kammer
7b3dc8a259 Support paths for vintf_fragments from Soong.
The property vintf_fragments accepts paths and references to other
modules; however, none of that is passed onto make, resulting in errors
if a non-local path is used.

Test: m
Bug: 184567830
Change-Id: If3b56ea8eec3b95b3a310b58bffd045cedd8ee52
2021-04-21 09:11:32 -04:00
Paul Duffin
b5cbdbb7c0 Merge "Remove unused boot_images property and rename tag" am: d353f20179 am: 0d5f158d87 am: 714ecad749
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1679776

Change-Id: I781c934d5ab43da00bb956ab8b4f45c11ae71bf9
2021-04-20 23:54:04 +00:00
Jaewoong Jung
4cfdf7de26 Make apex.key and certificate overridable.
Test: apex_test.go
Fixes: 185477325
Change-Id: I8992ac5606fa92f53f07e6870a034f2d3352e618
2021-04-20 16:21:24 -07:00
Paul Duffin
94f1963b6d Remove unused boot_images property and rename tag
Bug: 177892522
Test: m nothing
Change-Id: I9ffd6dda23aefea183f87e22497c17fb8a276ece
2021-04-20 14:46:08 +01:00
Nikita Ioffe
b6ea6c2d3c Don't compress apexes when building in unbundled mode
Test: TARGET_BUILD_APPS=com.android.neuralnetworks m apps_only
Bug: 185708645
Change-Id: I3fdf96f2b8decdff1422549bca413e7660ffb706
2021-04-20 10:20:15 +01:00
Jiyong Park
cc7628c5fa Merge changes Ib07d4410,I0b306292 am: 7b4fb51919 am: 24f37728ee am: 08956ce9b5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1675766

Change-Id: If2a5d89e4e51b6a8813daf082a910f2dea91f604
2021-04-16 00:27:39 +00:00
Jiyong Park
7b4fb51919 Merge changes Ib07d4410,I0b306292
* changes:
  ApexInfo doesn't pass MinSdkVersion as string, but as ApiLevel
  Remove nativeApiLevelFromUserWithDefault
2021-04-15 23:21:55 +00:00
Nikita Ioffe
470ead778a Merge changes I83828f58,I1179235e am: 5b94c8c007 am: dfbd56b6f8 am: 778f8cd182
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1676605

Change-Id: I3adaba99d0e756b40ebc235df93d9b8dc2cb02a0
2021-04-15 13:16:31 +00:00
Nikita Ioffe
5b94c8c007 Merge changes I83828f58,I1179235e
* changes:
  Generate hashtree for compressed apexes
  Don't compress apexes produced by apex_test module
2021-04-15 11:40:43 +00:00
Paul Duffin
b99e587b53 Merge "Move hidden API index file rule to platform_bootclasspath" am: a4b0d08b83 am: 7c03047b40 am: 3d82eade0b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674031

Change-Id: Ic8c404fde66d962f167f432322b13892a2260e7a
2021-04-15 11:22:37 +00:00
Jiyong Park
4eab21d5a2 ApexInfo doesn't pass MinSdkVersion as string, but as ApiLevel
ApexInfo is not part of the properties struct. It can handle structs
having private fields.

Bug: 1663140
Test: m
Change-Id: Ib07d4410f0ce187c9de347da34b84b814b2eb537
2021-04-15 15:17:54 +09:00
Nikita Ioffe
bc03588bec Generate hashtree for compressed apexes
Bug: 184615428
Test: flashed build on device, checked compressed apex has hashtree
Change-Id: I83828f581e84504c47047e7692817da5c44a6ec1
2021-04-14 21:35:24 +01:00
Nikita Ioffe
05b999ecb2 Don't compress apexes produced by apex_test module
AFAIU, apex_test is used by modules to create a test version of their
apex for e2e testing of the update flow. Since it's a regular pattern
for test_apex to use the same apex_defaults as the "production" apex,
and due to the fact that we are only going to compress pre-installed
version of the apex, it makes sense to explicitly not compress
test apexes.

Bug: 185082717
Test: build test_com.android.media verified it's not compressed
Test: atest sdkextensions_e2e_tests
Change-Id: I1179235efe068fefc582369a4218ba967e7efbf3
2021-04-14 21:08:13 +01:00
Paul Duffin
00b2bfdea5 Move hidden API index file rule to platform_bootclasspath
This change moves the monolithic hidden API index file creation rule
from the hiddenAPIIndexSingleton into the platform_bootclasspath. It
also moves the corresponding test from java/hiddenapi_singleton_test.go
to java/platform_bootclasspath_test.go.

Bug: 179354495
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ia295d0f7ae9b51ea816f16921aa42339ed91704e
2021-04-14 18:54:29 +01:00
Jiyong Park
f398995a64 Merge "SdkSpec is fully using ApiLevel" 2021-04-14 13:27:05 +00:00
Paul Duffin
1711f4e539 Merge "prebuilt_apex created ApexInfo must not include prebuilt_ prefix" am: 35584eeb93 am: 1cc6122b55 am: 303eed8e87
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674029

Change-Id: I3b96d66b67b26a3035c43b48c6b32e237b452346
2021-04-14 10:13:42 +00:00
Paul Duffin
ce858caec5 Merge "Improve realism of boot jar tests" am: 21fb92d7f6 am: 590a50fe8f am: 401eaf7dd9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674028

Change-Id: I5b5b42c6583290af8510bfe1a45bcd11f61960d6
2021-04-13 21:12:40 +00:00
Paul Duffin
8f146b99e6 prebuilt_apex created ApexInfo must not include prebuilt_ prefix
As part of the work to modularize the hiddenAPI processing the
generation of the monolithic hidden API index file needs to be moved
to the platform_bootclasspath module type. Doing that broke the
TestBootDexJarsFromSourcesAndPrebuilts tests which checks the inputs to
the rule that creates that file. Fixing that required added a
platform_bootclasspath module to the test fixture for those tests which
highlighted an issue with the prebuilt_apex module.

Previously, when the prebuilt_apex created apex variants it would use
its own name as the apex variant name, even when that name included the
prebuilt_ prefix. That broke the platform_bootclasspath logic as it was
looking for apex variants for "myapex" but the only ones available were
"prebuilt_myapex".

This change ensures that it always uses the unprefixed name and fixes
the TestNoUpdatableJarsInBootImage to match. This also adds some
improved error reporting in platform_bootclasspath which helped debug
this problem.

Bug: 177892522
Test: m nothing
Change-Id: I3e88b5cec767f77dcc0e94b3ae38b499d07eadf0
2021-04-13 19:15:27 +01:00
Paul Duffin
60264a0b99 Improve realism of boot jar tests
Boot jars, updatable boot jars and art apex jars are part of two
separate but related configuration objects, the main Config struct
(actually the nested productVariables struct) and the dexpreopt
specific GlobalConfig. The fields in both are initialized from the same
data in the make config files but handled separately.

Previously each test that used one of the configuration objects would
generally just initialize the one it used. That would make the test
sensitive to the specific configuration object that was used. A
refactoring that change the code from using one configuration object to
the other would cause the test to fail.

Also, some tests would inadvertently create invalid configurations by
setting ArtApexJars without also setting BootJars. While the ability to
create invalid configurations is useful (and there are some tests that
exist to verify the behavior in that case) most tests should not be
using them.

This change simplifies the configuration of the tests and improves
their realism by:
1. Providing a new FixtureConfigureBootJars method that takes a set of
   boot jars and sets ArtApexJars, and BootJars in the
   dexpreopt.GlobalConfig and BootJars in the product variables too.
2. Providing a new FixtureConfigureUpdatableBootJars method that takes
   a set of boot jars and sets UpdatableBootJars in both the
   dexpreopt.GlobalConfig and productVariables.
3. Migrating existing tests to use these new methods.

Some tests still use the dexpreopt.FixtureSet...Jars() methods directly,
generally to create invalid configurations.

Bug: 177892522
Test: m nothing
Change-Id: I4d8f0b9762cfcc7ae6383bef08563d7c3fa13955
2021-04-13 14:48:34 +01:00
Jiyong Park
3db6f99780 Merge "SdkSpec is fully using ApiLevel" into sc-dev 2021-04-13 11:02:38 +00:00
Liz Kammer
417c4215ce Merge "Support paths for init_rc from Soong." am: bda284bb19 am: 63f8d3c013 am: df3cd7102d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665439

Change-Id: I30eeca6fd4234cad27fde22b8bd332620157bcff
2021-04-12 20:59:48 +00:00
Liz Kammer
bda284bb19 Merge "Support paths for init_rc from Soong." 2021-04-12 19:05:27 +00:00
Jiyong Park
dbd710c426 SdkSpec is fully using ApiLevel
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e.  not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.

As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.

In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.

Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
2021-04-12 13:46:21 +09:00
Jiyong Park
46e02a3f26 Merge "Shared lib dependencies from rlib are included in APEX" am: a417f881bd am: ced4152db6 am: e1525dc164
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1669725

Change-Id: I91fcc6ffe4f618e45f9ae1cc4f56318cce0d5415
2021-04-09 01:28:36 +00:00
Jiyong Park
a417f881bd Merge "Shared lib dependencies from rlib are included in APEX" 2021-04-08 23:31:28 +00:00
Paul Duffin
2fe363ff6a Merge "Allow platform_bootclasspath to specify contributing fragments" am: 49ab1d38de am: 75e90d6974 am: 4a385f9987
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670067

Change-Id: Ie7e07eb17dd14aaec57b9c9de02483c8869ef309
2021-04-08 21:55:58 +00:00
Paul Duffin
ea1ef0beaf Merge "Add dependencies from platform_bootclasspath to contents" am: d32118c5c4 am: 6caf7f9662 am: 42418e09a2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670066

Change-Id: I564c75f572a5ad78f66695829b50ec999423addc
2021-04-08 21:55:51 +00:00
Paul Duffin
be455a29b5 Merge "Add deapexer support for apex_set" am: d137306c16 am: ada746ce26 am: 6a98d68960
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665744

Change-Id: I17e1e7feb52eb2b162b94f4e31fa3fc777dd5bf0
2021-04-08 21:55:44 +00:00
Paul Duffin
49ab1d38de Merge "Allow platform_bootclasspath to specify contributing fragments" 2021-04-08 20:34:19 +00:00
Paul Duffin
d32118c5c4 Merge "Add dependencies from platform_bootclasspath to contents" 2021-04-08 20:34:03 +00:00
Paul Duffin
62d8c3b110 Allow platform_bootclasspath to specify contributing fragments
Adds the fragments property to the platform_bootclasspath to allow the
fragments that contribute to it to be specified.

Bug: 177892522
Test: m nothing
Change-Id: I14f83d9336f6984442c7315cc86dfdd0a0fd2d20
2021-04-08 18:53:04 +01:00
Paul Duffin
b432df9cda Add dependencies from platform_bootclasspath to contents
Adds a FinalDeps mutator to add dependencies from the
platform_bootclasspath to the configured boot jars which can be from
either the platform or any apex. It adds dependencies for every
configured boot jar, whether in ArtApexJars, BootJars or
UpdatableBootJars.

At the moment the dependencies are only used for testing purposes
but following changes will make more use of them.

Bug: 177892522
Test: m nothing
Change-Id: I981305bf45bc20539a3d36987252f490e2b885cc
2021-04-08 18:53:04 +01:00
Paul Duffin
f6a780846d Merge "Separate apex extraction from the ApexSet" am: b14f2f067c am: 4cb71138e7 am: 76e8cd50ef
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665743

Change-Id: I07d2011f415c03c94da049f5f8080cf98ad5ee3f
2021-04-08 15:33:31 +00:00
Paul Duffin
0d96c39af6 Merge "Move deapexer related functionality to prebuiltCommon" am: 1cec110476 am: bc8b938e8e am: 1c8bf42eff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665742

Change-Id: Id22f68fc3b4e27fb871915ac89670773a3a4a07d
2021-04-08 14:17:52 +00:00
Jiyong Park
94e22fd35e Shared lib dependencies from rlib are included in APEX
This change fixes a bug that shared lib dependencies of an rlib is not
installed to the APEX even when the rlib is part of the APEX.

Bug: N/A
Test: m
Change-Id: I88fe461584499839d8018d6b4292374592e7562b
2021-04-08 18:20:39 +09:00
Paul Duffin
7e5a6b7cda Merge "Separate apex selection from apex.Prebuilt" am: 440b234081 am: 95898f3e8f am: af9ad5afc3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665741

Change-Id: Ic7363e51501bb5eab4b1117b3d6c1d6a89fc1246
2021-04-08 07:45:47 +00:00
Paul Duffin
f542ca317b Merge "Stop deapexer module type from being treated as a prebuilt" am: b60c5d4e1c am: c33e4c270e am: fdcb191936
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665739

Change-Id: I5316185a637e86d26da9edb6d60be58d242fd27a
2021-04-08 07:45:41 +00:00
Paul Duffin
8d8c7e2b11 Merge "Make prebuilt_apex report an error if no apex file is found" am: 846ce57a00 am: f63bae520d am: 05cf32909e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665740

Change-Id: I15924354b468a05de3e14fec69017330647100ce
2021-04-08 07:45:36 +00:00