Merge "Add deapexer support for apex_set"
This commit is contained in:
@@ -4605,6 +4605,40 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("apex_set only", func(t *testing.T) {
|
||||||
|
bp := `
|
||||||
|
apex_set {
|
||||||
|
name: "myapex",
|
||||||
|
set: "myapex.apks",
|
||||||
|
exported_java_libs: ["libfoo", "libbar"],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_import {
|
||||||
|
name: "libfoo",
|
||||||
|
jars: ["libfoo.jar"],
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_sdk_library_import {
|
||||||
|
name: "libbar",
|
||||||
|
public: {
|
||||||
|
jars: ["libbar.jar"],
|
||||||
|
},
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
ctx := testDexpreoptWithApexes(t, bp, "", transform)
|
||||||
|
checkBootDexJarPath(t, ctx, "libfoo", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libfoo.jar")
|
||||||
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
||||||
|
|
||||||
|
// Make sure that the dex file from the apex_set contributes to the hiddenapi index file.
|
||||||
|
checkHiddenAPIIndexInputs(t, ctx, `
|
||||||
|
.intermediates/libbar/android_common_myapex/hiddenapi/index.csv
|
||||||
|
.intermediates/libfoo/android_common_myapex/hiddenapi/index.csv
|
||||||
|
`)
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("prebuilt with source library preferred", func(t *testing.T) {
|
t.Run("prebuilt with source library preferred", func(t *testing.T) {
|
||||||
bp := `
|
bp := `
|
||||||
prebuilt_apex {
|
prebuilt_apex {
|
||||||
|
@@ -668,7 +668,7 @@ func (a *ApexSet) Overrides() []string {
|
|||||||
// prebuilt_apex imports an `.apex` file into the build graph as if it was built with apex.
|
// prebuilt_apex imports an `.apex` file into the build graph as if it was built with apex.
|
||||||
func apexSetFactory() android.Module {
|
func apexSetFactory() android.Module {
|
||||||
module := &ApexSet{}
|
module := &ApexSet{}
|
||||||
module.AddProperties(&module.properties, &module.selectedApexProperties)
|
module.AddProperties(&module.properties, &module.selectedApexProperties, &module.deapexerProperties)
|
||||||
|
|
||||||
android.InitSingleSourcePrebuiltModule(module, &module.selectedApexProperties, "Selected_apex")
|
android.InitSingleSourcePrebuiltModule(module, &module.selectedApexProperties, "Selected_apex")
|
||||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||||
@@ -680,6 +680,9 @@ func apexSetFactory() android.Module {
|
|||||||
createApexExtractorModule(ctx, apexExtractorModuleName, &module.properties.ApexExtractorProperties)
|
createApexExtractorModule(ctx, apexExtractorModuleName, &module.properties.ApexExtractorProperties)
|
||||||
|
|
||||||
apexFileSource := ":" + apexExtractorModuleName
|
apexFileSource := ":" + apexExtractorModuleName
|
||||||
|
if len(module.deapexerProperties.Exported_java_libs) != 0 {
|
||||||
|
createDeapexerModule(ctx, deapexerModuleName(baseModuleName), apexFileSource, &module.deapexerProperties)
|
||||||
|
}
|
||||||
|
|
||||||
// After passing the arch specific src properties to the creating the apex selector module
|
// After passing the arch specific src properties to the creating the apex selector module
|
||||||
module.selectedApexProperties.Selected_apex = proptools.StringPtr(apexFileSource)
|
module.selectedApexProperties.Selected_apex = proptools.StringPtr(apexFileSource)
|
||||||
@@ -705,6 +708,16 @@ func apexExtractorModuleName(baseModuleName string) string {
|
|||||||
return baseModuleName + ".apex.extractor"
|
return baseModuleName + ".apex.extractor"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *ApexSet) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
a.deapexerDeps(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ ApexInfoMutator = (*ApexSet)(nil)
|
||||||
|
|
||||||
|
func (a *ApexSet) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||||
|
a.apexInfoMutator(mctx)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
a.installFilename = a.InstallFilename()
|
a.installFilename = a.InstallFilename()
|
||||||
if !strings.HasSuffix(a.installFilename, imageApexSuffix) {
|
if !strings.HasSuffix(a.installFilename, imageApexSuffix) {
|
||||||
|
Reference in New Issue
Block a user