Commit graph

99 commits

Author SHA1 Message Date
Colin Cross
730e3f6139 Set prebuiltCommon.installedFile for apex_set modules
apex_set modules failed to set prebuiltCommon.installedFile, which
caused LOCAL_SOONG_INSTALLED_MODULE to be empty and base_rules.mk
to create a duplicate install rule.  Set it to the path to the
apex file installed by Soong.

Bug: 204136549
Bug: 209867137
Test: m SOONG_CONFIG_art_module_source_build=false
Change-Id: Ia7fec09598823343242ebd44f1732e6bba21d027
2021-12-09 05:24:15 +00:00
Martin Stjernholm
ae44fd8032 Don't pass ":=" in variable name to AndroidMkEntries.SetString.
Fixes typos in https://r.android.com/1897972.

Test: m SOONG_CONFIG_art_module_source_build=false nothing
Bug: 204136549
Change-Id: I768c21bc99bfb4978fcf7f4f3631eef866e76764
2021-11-23 23:17:33 +00:00
Colin Cross
6340ea50d4 Move apex module installation into Soong
Move apex module installation rules into Soong by overriding
InstallBypassMake.

Soong installs don't support post install commands, so move the
symlinks into separate rules and add dependencies on them.

This relands If65d283abc86f18ad266da0bf16fe95971a0bf9c with fixes
to install files into $OUT/apex and I606286e971b55d9d1fc4dcd0fbd476962de5fa79
with a fix for reversed logic.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie65c53ebc7911efacdb8e11ba49059448f03c658
2021-11-19 13:37:36 -08:00
Colin Cross
ccba23db44 Revert "Move apex module installation into Soong"
This reverts commit e3d156a622.

Reason for revert: b/206119621

Bug: 204136549
Change-Id: I380223b86660c27bea8f5dcc2d61f32df2704c02
Fixes: 206119621
2021-11-12 19:01:29 +00:00
Colin Cross
e3d156a622 Move apex module installation into Soong
Move apex module installation rules into Soong by overriding
InstallBypassMake.

Soong installs don't support post install commands, so move the
symlinks into separate rules and add dependencies on them.

Bug: 204136549
Test: m checkbuild
Change-Id: If65d283abc86f18ad266da0bf16fe95971a0bf9c
2021-11-11 17:44:42 -08:00
Paul Duffin
13dd220448 Merge "Stop prebuilt_apex/apex_set exporting invalid jars to Make" 2021-10-13 14:53:17 +00:00
Paul Duffin
2579631bd1 Stop prebuilt_apex/apex_set exporting invalid jars to Make
A prebuilt_apex/apex_set module can make a dex implementation jar
available for use by Make targets but it does not have access to a real
classes implementation jar; the jar in the corresponding sdk is just an
empty file. Exporting that invalid file to Make means that the phony
target created for the module depends on an invalid classes jar which
causes the build to fail.

This change removes the logic that make classes and header jars
available to Make so that building the phony target no longer fails.

Bug: 202521005
Test: m TARGET_PRODUCT=armv8 TARGET_PRODUCT_VARIANT=eng TARGET_BUILD_UNBUNDLED=true SOONG_ALLOW_MISSING_DEPENDENCIES=true core-icu4j
      - above was performed in master-art.
Change-Id: If667b36b988e2d331acd85f60f3369778838d034
2021-10-11 17:53:54 +01:00
Jiakai Zhang
d20f37f014 Merge changes I7876b077,Ib2e7d5e6,I7d2d2e02,Ibf5322f8 am: dcc42b6f7e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835088

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

Bug: 194150908
Test: manual - 1. Patch aosp/1818020 and aosp/1834534
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Change-Id: I7d2d2e02869d8a523f7c0efbbff81706672a95c5
2021-09-30 10:06:21 +00:00
Martin Stjernholm
40fc93fb3c Merge changes I957f3df8,I68986dcc am: cf6bf37d04
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829372

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

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

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

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

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

The refactoring is also not extended to
dexpreopt.ClassLoaderContextMap.

Test: m nothing
Bug: 192006406
Change-Id: I68986dccd9a9b3fee4d24caa1947ea17a36caedc
2021-09-23 17:19:55 +01:00
Jiakai Zhang
23a5cba0af Merge changes I9c94a54a,Idc0c73a7 am: 2c6ede11cc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824513

Change-Id: I1f3ce39cd3b3988e676791a59f0c70e2bc80015d
2021-09-17 11:33:22 +00:00
Jiakai Zhang
204356f3b5 Preopt APEX system server jars from prebuilts.
Similar to the previous CL, but for jars from prebuilts.

Test: manual - 1. Patch aosp/1818020 and aosp/1810840.
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Bug: 194150908
Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
2021-09-15 09:01:07 +00:00
Mohammad Islam
17544fe23a Merge "Relax restriction on suffix of apex_set filename to include .capex" am: 385cde82d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821656

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

Bug: 197258691
Test: manual + unit test added
Change-Id: I79173ef942326b48b5e659f1873d80f12b212339
2021-09-08 18:29:47 +01:00
Kun Niu
ce1dcf6a9f Use prebuild modules even when coverage is enabled.
Bug: 194323871
Test: local build passed.
Change-Id: I94a3922453473de7d754afce4b05ac3b6ae3765d
2021-08-05 18:15:28 +00:00
Paul Duffin
46ab291f67 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

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

Bug: 179354495
Test: m nothing
Merged-In: Iead6f9d1085d169335b88ceadcce2d8cc042254d
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
(cherry picked from commit fee8cf36e3)
2021-06-30 00:08:49 +01:00
Paul Duffin
fee8cf36e3 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

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

Bug: 179354495
Test: m nothing
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
2021-06-29 18:42:55 +01:00
Martin Stjernholm
d8da28ea9c Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying
the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/,
which is also the one used for the apex variations.

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

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

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

Test: m nothing
Bug: 191269918
Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5
Merged-In: If8612639bffdf91cbcab3387b0603bf5dffef1f5
2021-06-25 21:27:14 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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