Split Java libraries per apex

Just like native libs, a java library that is included in an APEX is
mutated for the APEX. This allows us to infer the context (e.g.
sdk_version, etc.) for building a java library in an APEX.

Bug: 138182343
Test: apex_test added
Change-Id: I9292ea097b98e74a8a794f164bd2bed3921d6337
This commit is contained in:
Jiyong Park
2019-07-18 17:00:45 +09:00
parent 1ecfa940d1
commit aa53324ac8
4 changed files with 63 additions and 3 deletions

View File

@@ -152,6 +152,14 @@ func stubFlagsRule(ctx android.SingletonContext) {
// Collect dex jar paths for modules that had hiddenapi encode called on them.
if h, ok := module.(hiddenAPIIntf); ok {
if jar := h.bootDexJar(); jar != nil {
// For a java lib included in an APEX, only take the one built for
// the platform variant, and skip the variants for APEXes.
// Otherwise, the hiddenapi tool will complain about duplicated classes
if a, ok := module.(android.ApexModule); ok {
if android.InAnyApex(module.Name()) && !a.IsForPlatform() {
return
}
}
bootDexJars = append(bootDexJars, jar)
}
}