Merge changes from topic "check-flattened-art-apex"
* changes: Add an output file type for flattened APEXes. Allow modules to be enabled/disabled depending on whether APEXes are flattened.
This commit is contained in:
@@ -115,6 +115,10 @@ type variableProperties struct {
|
|||||||
Static_libs []string
|
Static_libs []string
|
||||||
Srcs []string
|
Srcs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Flatten_apex struct {
|
||||||
|
Enabled *bool
|
||||||
|
}
|
||||||
} `android:"arch_variant"`
|
} `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
apex/apex.go
27
apex/apex.go
@@ -435,6 +435,7 @@ type apexBundle struct {
|
|||||||
|
|
||||||
bundleModuleFile android.WritablePath
|
bundleModuleFile android.WritablePath
|
||||||
outputFiles map[apexPackaging]android.WritablePath
|
outputFiles map[apexPackaging]android.WritablePath
|
||||||
|
flattenedOutput android.OutputPath
|
||||||
installDir android.OutputPath
|
installDir android.OutputPath
|
||||||
|
|
||||||
prebuiltFileToDelete string
|
prebuiltFileToDelete string
|
||||||
@@ -639,6 +640,13 @@ func (a *apexBundle) OutputFiles(tag string) (android.Paths, error) {
|
|||||||
} else {
|
} else {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
case ".flattened":
|
||||||
|
if a.flattened {
|
||||||
|
flattenedApexPath := a.flattenedOutput
|
||||||
|
return android.Paths{flattenedApexPath}, nil
|
||||||
|
} else {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||||
}
|
}
|
||||||
@@ -784,6 +792,15 @@ func getCopyManifestForPrebuiltEtc(prebuilt *android.PrebuiltEtc) (fileToCopy an
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
|
||||||
|
type flattenedApexContext struct {
|
||||||
|
android.ModuleContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *flattenedApexContext) InstallBypassMake() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
filesInfo := []apexFile{}
|
filesInfo := []apexFile{}
|
||||||
|
|
||||||
@@ -1051,6 +1068,14 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Temporarily wrap the original `ctx` into a `flattenedApexContext` to have it
|
||||||
|
// reply true to `InstallBypassMake()` (thus making the call
|
||||||
|
// `android.PathForModuleInstall` below use `android.pathForInstallInMakeDir`
|
||||||
|
// instead of `android.PathForOutput`) to return the correct path to the flattened
|
||||||
|
// APEX (as its contents is installed by Make, not Soong).
|
||||||
|
factx := flattenedApexContext{ctx}
|
||||||
|
a.flattenedOutput = android.PathForModuleInstall(&factx, "apex", factx.ModuleName())
|
||||||
|
|
||||||
if a.apexTypes.zip() {
|
if a.apexTypes.zip() {
|
||||||
a.buildUnflattenedApex(ctx, zipApex)
|
a.buildUnflattenedApex(ctx, zipApex)
|
||||||
}
|
}
|
||||||
@@ -1451,6 +1476,8 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
|
|||||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
|
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
|
||||||
|
fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): .KATI_IMPLICIT_OUTPUTS :=", a.flattenedOutput.String())
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// zip-apex is the less common type so have the name refer to the image-apex
|
// zip-apex is the less common type so have the name refer to the image-apex
|
||||||
// only and use {name}.zip if you want the zip-apex
|
// only and use {name}.zip if you want the zip-apex
|
||||||
|
Reference in New Issue
Block a user