Merge "Delegate retrieval of dex boot jar for apex to the bootclasspath_fragment" am: 46e4a9e6b1
am: 8745a28532
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1686218 Change-Id: Idbad33644ef2e49fe38e3317d119dfe871404200
This commit is contained in:
25
apex/apex.go
25
apex/apex.go
@@ -1498,10 +1498,15 @@ var _ javaModule = (*java.SdkLibrary)(nil)
|
|||||||
var _ javaModule = (*java.DexImport)(nil)
|
var _ javaModule = (*java.DexImport)(nil)
|
||||||
var _ javaModule = (*java.SdkLibraryImport)(nil)
|
var _ javaModule = (*java.SdkLibraryImport)(nil)
|
||||||
|
|
||||||
|
// apexFileForJavaModule creates an apexFile for a java module's dex implementation jar.
|
||||||
func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile {
|
func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile {
|
||||||
|
return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath())
|
||||||
|
}
|
||||||
|
|
||||||
|
// apexFileForJavaModuleWithFile creates an apexFile for a java module with the supplied file.
|
||||||
|
func apexFileForJavaModuleWithFile(ctx android.BaseModuleContext, module javaModule, dexImplementationJar android.Path) apexFile {
|
||||||
dirInApex := "javalib"
|
dirInApex := "javalib"
|
||||||
fileToCopy := module.DexJarBuildPath()
|
af := newApexFile(ctx, dexImplementationJar, module.BaseModuleName(), dirInApex, javaSharedLib, module)
|
||||||
af := newApexFile(ctx, fileToCopy, module.BaseModuleName(), dirInApex, javaSharedLib, module)
|
|
||||||
af.jacocoReportClassesFile = module.JacocoReportClassesFile()
|
af.jacocoReportClassesFile = module.JacocoReportClassesFile()
|
||||||
af.lintDepSets = module.LintDepSets()
|
af.lintDepSets = module.LintDepSets()
|
||||||
af.customStem = module.Stem() + ".jar"
|
af.customStem = module.Stem() + ".jar"
|
||||||
@@ -1920,7 +1925,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
switch child.(type) {
|
switch child.(type) {
|
||||||
case *java.Library, *java.SdkLibrary:
|
case *java.Library, *java.SdkLibrary:
|
||||||
javaModule := child.(javaModule)
|
javaModule := child.(javaModule)
|
||||||
af := apexFileForBootclasspathFragmentContentModule(ctx, javaModule)
|
af := apexFileForBootclasspathFragmentContentModule(ctx, parent, javaModule)
|
||||||
if !af.ok() {
|
if !af.ok() {
|
||||||
ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q is not configured to be compiled into dex", depName)
|
ctx.PropertyErrorf("bootclasspath_fragments", "bootclasspath_fragment content %q is not configured to be compiled into dex", depName)
|
||||||
return false
|
return false
|
||||||
@@ -2097,9 +2102,17 @@ func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint.
|
|||||||
|
|
||||||
// apexFileForBootclasspathFragmentContentModule creates an apexFile for a bootclasspath_fragment
|
// apexFileForBootclasspathFragmentContentModule creates an apexFile for a bootclasspath_fragment
|
||||||
// content module, i.e. a library that is part of the bootclasspath.
|
// content module, i.e. a library that is part of the bootclasspath.
|
||||||
func apexFileForBootclasspathFragmentContentModule(ctx android.ModuleContext, javaModule javaModule) apexFile {
|
func apexFileForBootclasspathFragmentContentModule(ctx android.ModuleContext, fragmentModule blueprint.Module, javaModule javaModule) apexFile {
|
||||||
// For now it simply returns an apexFile for a normal java module.
|
bootclasspathFragmentInfo := ctx.OtherModuleProvider(fragmentModule, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo)
|
||||||
return apexFileForJavaModule(ctx, javaModule)
|
|
||||||
|
// Get the dexBootJar from the bootclasspath_fragment as that is responsible for performing the
|
||||||
|
// hidden API encpding.
|
||||||
|
dexBootJar := bootclasspathFragmentInfo.DexBootJarPathForContentModule(javaModule)
|
||||||
|
|
||||||
|
// Create an apexFile as for a normal java module but with the dex boot jar provided by the
|
||||||
|
// bootclasspath_fragment.
|
||||||
|
af := apexFileForJavaModuleWithFile(ctx, javaModule, dexBootJar)
|
||||||
|
return af
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -198,6 +198,15 @@ func (i BootclasspathFragmentApexContentInfo) AndroidBootImageFilesByArchType()
|
|||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DexBootJarPathForContentModule returns the path to the dex boot jar for specified module.
|
||||||
|
//
|
||||||
|
// The dex boot jar is one which has had hidden API encoding performed on it.
|
||||||
|
func (i BootclasspathFragmentApexContentInfo) DexBootJarPathForContentModule(module android.Module) android.Path {
|
||||||
|
j := module.(UsesLibraryDependency)
|
||||||
|
dexJar := j.DexJarBuildPath()
|
||||||
|
return dexJar
|
||||||
|
}
|
||||||
|
|
||||||
func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
|
func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
|
||||||
tag := ctx.OtherModuleDependencyTag(dep)
|
tag := ctx.OtherModuleDependencyTag(dep)
|
||||||
if IsBootclasspathFragmentContentDepTag(tag) {
|
if IsBootclasspathFragmentContentDepTag(tag) {
|
||||||
|
Reference in New Issue
Block a user