summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2020-03-10 06:23:13 +0900
committerJooyung Han <jooyung@google.com>2020-03-10 23:52:01 +0000
commit5e9013be2202effb500a0aa14d95f5fef70cc75e (patch)
tree4ccee0c2c324957d1ed765dfc2b7b706a8d18059 /java/java.go
parenta81668628e7ccda49291c4b4779b02f4772affe2 (diff)
Fix apex_available
Checking apex_available was missing some corner cases. For example, the deps of share deps of cc_library modules are missed while those from cc_library_shared are correctly tracked. This was due to.. * calling DepIsInSameApex in WalkDeps: both work fine separately, but when they are used together, it fails to work. It's due to how WalkDeps works. (We might fix this bug too risky since it is used very widely) * incorrect receiver for DepIsInSameApex in apex_deps mutator: receiver is supposed to be parent, but child was used before. Interestingly lots of deps are within the same group of module types(cc to cc, java to java), it has worked. (note that receiver's DepIsInSameApex implementation can be different). This change fixes them by.. * walkPayloadDeps is now relying on ApexVariation, which is calculated correctly by TopDown apex_deps mutator. * use correct receiver for DepIsInSameApex in apex_deps mutator, which requires for java.SdkLibrary to override the method and for java.Library/Import to use passed dep instead of receiver to check its membership of sdk. Bug: 151071238 Test: build/boot Change-Id: I0569ef4bb8e79635e4d97a89f421a8d8b7d26456
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/java/java.go b/java/java.go
index d0b5adfa9..8c779f5c4 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1796,11 +1796,16 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool {
}
func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- depTag := ctx.OtherModuleDependencyTag(dep)
// Dependencies other than the static linkage are all considered crossing APEX boundary
+ if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
+ return true
+ }
// Also, a dependency to an sdk member is also considered as such. This is required because
// sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator.
- return depTag == staticLibTag || j.IsInAnySdk()
+ if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() {
+ return true
+ }
+ return false
}
func (j *Module) Stem() string {
@@ -2504,11 +2509,16 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) {
}
func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- depTag := ctx.OtherModuleDependencyTag(dep)
// dependencies other than the static linkage are all considered crossing APEX boundary
+ if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
+ return true
+ }
// Also, a dependency to an sdk member is also considered as such. This is required because
// sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator.
- return depTag == staticLibTag || j.IsInAnySdk()
+ if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() {
+ return true
+ }
+ return false
}
// Add compile time check for interface implementation