diff options
author | Scott Lobdell <slobdell@google.com> | 2021-07-07 17:54:01 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2021-07-07 17:54:01 +0000 |
commit | 99f82c6f4a8511ded6de5e2b5e00565fad7f65de (patch) | |
tree | a1ecabe68c443bf3d596fe06417e98cc54dc7470 /java/java.go | |
parent | c57cdd121a8d5a0883a689f6d9fbe6fc440e2202 (diff) | |
parent | 5abcf9267173b9e80dd14fca037b0f01cc2dbd3b (diff) |
Merge SP1A.210624.001
Change-Id: I8507f8b65c47a5b425464bbbc8d932a6ca359fd3
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go index 2bbb5b102..71c1b3324 100644 --- a/java/java.go +++ b/java/java.go @@ -643,7 +643,7 @@ func LibraryFactory() android.Module { module.addHostAndDeviceProperties() - module.initModuleAndImport(&module.ModuleBase) + module.initModuleAndImport(module) android.InitApexModule(module) android.InitSdkAwareModule(module) @@ -1309,7 +1309,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Get the path of the dex implementation jar from the `deapexer` module. di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo) - if dexOutputPath := di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar"); dexOutputPath != nil { + if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(j.BaseModuleName())); dexOutputPath != nil { j.dexJarFile = dexOutputPath // Initialize the hiddenapi structure. @@ -1426,6 +1426,29 @@ func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext, return nil } +// requiredFilesFromPrebuiltApexForImport returns information about the files that a java_import or +// java_sdk_library_import with the specified base module name requires to be exported from a +// prebuilt_apex/apex_set. +func requiredFilesFromPrebuiltApexForImport(name string) []string { + // Add the dex implementation jar to the set of exported files. + return []string{ + apexRootRelativePathToJavaLib(name), + } +} + +// apexRootRelativePathToJavaLib returns the path, relative to the root of the apex's contents, for +// the java library with the specified name. +func apexRootRelativePathToJavaLib(name string) string { + return filepath.Join("javalib", name+".jar") +} + +var _ android.RequiredFilesFromPrebuiltApex = (*Import)(nil) + +func (j *Import) RequiredFilesFromPrebuiltApex(_ android.BaseModuleContext) []string { + name := j.BaseModuleName() + return requiredFilesFromPrebuiltApexForImport(name) +} + // Add compile time check for interface implementation var _ android.IDEInfo = (*Import)(nil) var _ android.IDECustomizedModuleName = (*Import)(nil) @@ -1473,7 +1496,7 @@ func ImportFactory() android.Module { &module.dexer.dexProperties, ) - module.initModuleAndImport(&module.ModuleBase) + module.initModuleAndImport(module) module.dexProperties.Optimize.EnabledByDefault = false |