2019-11-18 03:16:27 +01:00
|
|
|
// Copyright (C) 2019 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package apex
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-05-14 23:15:24 +02:00
|
|
|
"strconv"
|
2019-11-18 03:16:27 +01:00
|
|
|
"strings"
|
|
|
|
|
|
|
|
"android/soong/android"
|
2020-05-14 23:15:24 +02:00
|
|
|
"android/soong/java"
|
2020-07-16 14:38:56 +02:00
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
"github.com/google/blueprint"
|
2019-11-18 03:16:27 +01:00
|
|
|
|
|
|
|
"github.com/google/blueprint/proptools"
|
|
|
|
)
|
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
var (
|
|
|
|
extractMatchingApex = pctx.StaticRule(
|
|
|
|
"extractMatchingApex",
|
|
|
|
blueprint.RuleParams{
|
|
|
|
Command: `rm -rf "$out" && ` +
|
|
|
|
`${extract_apks} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
|
|
|
|
`-sdk-version=${sdk-version} -abis=${abis} -screen-densities=all -extract-single ` +
|
|
|
|
`${in}`,
|
|
|
|
CommandDeps: []string{"${extract_apks}"},
|
|
|
|
},
|
|
|
|
"abis", "allow-prereleased", "sdk-version")
|
|
|
|
)
|
|
|
|
|
2020-07-16 14:38:56 +02:00
|
|
|
type prebuilt interface {
|
|
|
|
isForceDisabled() bool
|
|
|
|
InstallFilename() string
|
|
|
|
}
|
|
|
|
|
|
|
|
type prebuiltCommon struct {
|
|
|
|
prebuilt android.Prebuilt
|
|
|
|
properties prebuiltCommonProperties
|
|
|
|
}
|
|
|
|
|
2020-07-25 00:35:40 +02:00
|
|
|
type sanitizedPrebuilt interface {
|
|
|
|
hasSanitizedSource(sanitizer string) bool
|
|
|
|
}
|
|
|
|
|
2020-07-16 14:38:56 +02:00
|
|
|
type prebuiltCommonProperties struct {
|
|
|
|
ForceDisable bool `blueprint:"mutated"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *prebuiltCommon) Prebuilt() *android.Prebuilt {
|
|
|
|
return &p.prebuilt
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *prebuiltCommon) isForceDisabled() bool {
|
|
|
|
return p.properties.ForceDisable
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *prebuiltCommon) checkForceDisable(ctx android.ModuleContext) bool {
|
|
|
|
// If the device is configured to use flattened APEX, force disable the prebuilt because
|
|
|
|
// the prebuilt is a non-flattened one.
|
|
|
|
forceDisable := ctx.Config().FlattenApex()
|
|
|
|
|
|
|
|
// Force disable the prebuilts when we are doing unbundled build. We do unbundled build
|
|
|
|
// to build the prebuilts themselves.
|
|
|
|
forceDisable = forceDisable || ctx.Config().UnbundledBuild()
|
|
|
|
|
|
|
|
// Force disable the prebuilts when coverage is enabled.
|
|
|
|
forceDisable = forceDisable || ctx.DeviceConfig().NativeCoverageEnabled()
|
|
|
|
forceDisable = forceDisable || ctx.Config().IsEnvTrue("EMMA_INSTRUMENT")
|
|
|
|
|
2020-07-25 00:35:40 +02:00
|
|
|
// b/137216042 don't use prebuilts when address sanitizer is on, unless the prebuilt has a sanitized source
|
|
|
|
sanitized := ctx.Module().(sanitizedPrebuilt)
|
|
|
|
forceDisable = forceDisable || (android.InList("address", ctx.Config().SanitizeDevice()) && !sanitized.hasSanitizedSource("address"))
|
|
|
|
forceDisable = forceDisable || (android.InList("hwaddress", ctx.Config().SanitizeDevice()) && !sanitized.hasSanitizedSource("hwaddress"))
|
2020-07-16 14:38:56 +02:00
|
|
|
|
|
|
|
if forceDisable && p.prebuilt.SourceExists() {
|
|
|
|
p.properties.ForceDisable = true
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-11-18 03:16:27 +01:00
|
|
|
type Prebuilt struct {
|
|
|
|
android.ModuleBase
|
2020-07-16 14:38:56 +02:00
|
|
|
prebuiltCommon
|
2019-11-18 03:16:27 +01:00
|
|
|
|
|
|
|
properties PrebuiltProperties
|
|
|
|
|
|
|
|
inputApex android.Path
|
|
|
|
installDir android.InstallPath
|
|
|
|
installFilename string
|
|
|
|
outputApex android.WritablePath
|
2020-01-07 17:57:58 +01:00
|
|
|
|
|
|
|
// list of commands to create symlinks for backward compatibility.
|
|
|
|
// these commands will be attached as LOCAL_POST_INSTALL_CMD
|
|
|
|
compatSymlinks []string
|
2019-11-18 03:16:27 +01:00
|
|
|
}
|
|
|
|
|
2021-01-13 18:03:51 +01:00
|
|
|
type ApexFileProperties struct {
|
2019-11-18 03:16:27 +01:00
|
|
|
// the path to the prebuilt .apex file to import.
|
2020-07-16 14:38:56 +02:00
|
|
|
Source string `blueprint:"mutated"`
|
2019-11-18 03:16:27 +01:00
|
|
|
|
|
|
|
Src *string
|
|
|
|
Arch struct {
|
|
|
|
Arm struct {
|
|
|
|
Src *string
|
|
|
|
}
|
|
|
|
Arm64 struct {
|
|
|
|
Src *string
|
|
|
|
}
|
|
|
|
X86 struct {
|
|
|
|
Src *string
|
|
|
|
}
|
|
|
|
X86_64 struct {
|
|
|
|
Src *string
|
|
|
|
}
|
|
|
|
}
|
2021-01-13 18:03:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ApexFileProperties) selectSource(ctx android.BottomUpMutatorContext) error {
|
|
|
|
// This is called before prebuilt_select and prebuilt_postdeps mutators
|
|
|
|
// The mutators requires that src to be set correctly for each arch so that
|
|
|
|
// arch variants are disabled when src is not provided for the arch.
|
|
|
|
if len(ctx.MultiTargets()) != 1 {
|
|
|
|
return fmt.Errorf("compile_multilib shouldn't be \"both\" for prebuilt_apex")
|
|
|
|
}
|
|
|
|
var src string
|
|
|
|
switch ctx.MultiTargets()[0].Arch.ArchType {
|
|
|
|
case android.Arm:
|
|
|
|
src = String(p.Arch.Arm.Src)
|
|
|
|
case android.Arm64:
|
|
|
|
src = String(p.Arch.Arm64.Src)
|
|
|
|
case android.X86:
|
|
|
|
src = String(p.Arch.X86.Src)
|
|
|
|
case android.X86_64:
|
|
|
|
src = String(p.Arch.X86_64.Src)
|
|
|
|
default:
|
|
|
|
return fmt.Errorf("prebuilt_apex does not support %q", ctx.MultiTargets()[0].Arch.String())
|
|
|
|
}
|
|
|
|
if src == "" {
|
|
|
|
src = String(p.Src)
|
|
|
|
}
|
|
|
|
p.Source = src
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type PrebuiltProperties struct {
|
|
|
|
ApexFileProperties
|
2019-11-18 03:16:27 +01:00
|
|
|
|
|
|
|
Installable *bool
|
|
|
|
// Optional name for the installed apex. If unspecified, name of the
|
|
|
|
// module is used as the file name
|
|
|
|
Filename *string
|
|
|
|
|
|
|
|
// Names of modules to be overridden. Listed modules can only be other binaries
|
|
|
|
// (in Make or Soong).
|
|
|
|
// This does not completely prevent installation of the overridden binaries, but if both
|
|
|
|
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
|
|
|
|
// from PRODUCT_PACKAGES.
|
|
|
|
Overrides []string
|
|
|
|
}
|
|
|
|
|
2020-07-25 00:35:40 +02:00
|
|
|
func (a *Prebuilt) hasSanitizedSource(sanitizer string) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-11-18 03:16:27 +01:00
|
|
|
func (p *Prebuilt) installable() bool {
|
|
|
|
return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Prebuilt) OutputFiles(tag string) (android.Paths, error) {
|
|
|
|
switch tag {
|
|
|
|
case "":
|
|
|
|
return android.Paths{p.outputApex}, nil
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Prebuilt) InstallFilename() string {
|
|
|
|
return proptools.StringDefault(p.properties.Filename, p.BaseModuleName()+imageApexSuffix)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Prebuilt) Name() string {
|
2020-07-16 14:38:56 +02:00
|
|
|
return p.prebuiltCommon.prebuilt.Name(p.ModuleBase.Name())
|
2019-11-18 03:16:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// prebuilt_apex imports an `.apex` file into the build graph as if it was built with apex.
|
|
|
|
func PrebuiltFactory() android.Module {
|
|
|
|
module := &Prebuilt{}
|
|
|
|
module.AddProperties(&module.properties)
|
|
|
|
android.InitSingleSourcePrebuiltModule(module, &module.properties, "Source")
|
|
|
|
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
|
2021-01-13 18:03:51 +01:00
|
|
|
if err := p.properties.selectSource(ctx); err != nil {
|
|
|
|
ctx.ModuleErrorf("%s", err)
|
2019-11-18 03:16:27 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|
|
|
// TODO(jungjw): Check the key validity.
|
|
|
|
p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
|
|
|
|
p.installDir = android.PathForModuleInstall(ctx, "apex")
|
|
|
|
p.installFilename = p.InstallFilename()
|
|
|
|
if !strings.HasSuffix(p.installFilename, imageApexSuffix) {
|
|
|
|
ctx.ModuleErrorf("filename should end in %s for prebuilt_apex", imageApexSuffix)
|
|
|
|
}
|
|
|
|
p.outputApex = android.PathForModuleOut(ctx, p.installFilename)
|
|
|
|
ctx.Build(pctx, android.BuildParams{
|
|
|
|
Rule: android.Cp,
|
|
|
|
Input: p.inputApex,
|
|
|
|
Output: p.outputApex,
|
|
|
|
})
|
2020-07-16 14:38:56 +02:00
|
|
|
|
|
|
|
if p.prebuiltCommon.checkForceDisable(ctx) {
|
2020-12-16 19:20:23 +01:00
|
|
|
p.HideFromMake()
|
2020-07-16 14:38:56 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-18 03:16:27 +01:00
|
|
|
if p.installable() {
|
|
|
|
ctx.InstallFile(p.installDir, p.installFilename, p.inputApex)
|
|
|
|
}
|
|
|
|
|
2020-01-07 17:57:58 +01:00
|
|
|
// in case that prebuilt_apex replaces source apex (using prefer: prop)
|
|
|
|
p.compatSymlinks = makeCompatSymlinks(p.BaseModuleName(), ctx)
|
|
|
|
// or that prebuilt_apex overrides other apexes (using overrides: prop)
|
|
|
|
for _, overridden := range p.properties.Overrides {
|
|
|
|
p.compatSymlinks = append(p.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
|
|
|
|
}
|
2019-11-18 03:16:27 +01:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (p *Prebuilt) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-11-18 03:16:27 +01:00
|
|
|
Class: "ETC",
|
|
|
|
OutputFile: android.OptionalPathForPath(p.inputApex),
|
|
|
|
Include: "$(BUILD_PREBUILT)",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String())
|
|
|
|
entries.SetString("LOCAL_MODULE_STEM", p.installFilename)
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.installable())
|
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_MODULES", p.properties.Overrides...)
|
2020-01-07 17:57:58 +01:00
|
|
|
if len(p.compatSymlinks) > 0 {
|
|
|
|
entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(p.compatSymlinks, " && "))
|
|
|
|
}
|
2019-11-18 03:16:27 +01:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-11-18 03:16:27 +01:00
|
|
|
}
|
2020-05-14 23:15:24 +02:00
|
|
|
|
|
|
|
type ApexSet struct {
|
|
|
|
android.ModuleBase
|
2020-07-16 14:38:56 +02:00
|
|
|
prebuiltCommon
|
2020-05-14 23:15:24 +02:00
|
|
|
|
|
|
|
properties ApexSetProperties
|
|
|
|
|
|
|
|
installDir android.InstallPath
|
|
|
|
installFilename string
|
|
|
|
outputApex android.WritablePath
|
|
|
|
|
|
|
|
// list of commands to create symlinks for backward compatibility.
|
|
|
|
// these commands will be attached as LOCAL_POST_INSTALL_CMD
|
|
|
|
compatSymlinks []string
|
2020-06-29 23:34:23 +02:00
|
|
|
|
|
|
|
hostRequired []string
|
|
|
|
postInstallCommands []string
|
2020-05-14 23:15:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type ApexSetProperties struct {
|
|
|
|
// the .apks file path that contains prebuilt apex files to be extracted.
|
|
|
|
Set *string
|
|
|
|
|
2020-07-25 00:35:40 +02:00
|
|
|
Sanitized struct {
|
|
|
|
None struct {
|
|
|
|
Set *string
|
|
|
|
}
|
|
|
|
Address struct {
|
|
|
|
Set *string
|
|
|
|
}
|
|
|
|
Hwaddress struct {
|
|
|
|
Set *string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
// whether the extracted apex file installable.
|
|
|
|
Installable *bool
|
|
|
|
|
|
|
|
// optional name for the installed apex. If unspecified, name of the
|
|
|
|
// module is used as the file name
|
|
|
|
Filename *string
|
|
|
|
|
|
|
|
// names of modules to be overridden. Listed modules can only be other binaries
|
|
|
|
// (in Make or Soong).
|
|
|
|
// This does not completely prevent installation of the overridden binaries, but if both
|
|
|
|
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
|
|
|
|
// from PRODUCT_PACKAGES.
|
|
|
|
Overrides []string
|
|
|
|
|
|
|
|
// apexes in this set use prerelease SDK version
|
|
|
|
Prerelease *bool
|
|
|
|
}
|
|
|
|
|
2020-07-25 00:35:40 +02:00
|
|
|
func (a *ApexSet) prebuiltSrcs(ctx android.BaseModuleContext) []string {
|
|
|
|
var srcs []string
|
|
|
|
if a.properties.Set != nil {
|
|
|
|
srcs = append(srcs, *a.properties.Set)
|
|
|
|
}
|
|
|
|
|
|
|
|
var sanitizers []string
|
|
|
|
if ctx.Host() {
|
|
|
|
sanitizers = ctx.Config().SanitizeHost()
|
|
|
|
} else {
|
|
|
|
sanitizers = ctx.Config().SanitizeDevice()
|
|
|
|
}
|
|
|
|
|
|
|
|
if android.InList("address", sanitizers) && a.properties.Sanitized.Address.Set != nil {
|
|
|
|
srcs = append(srcs, *a.properties.Sanitized.Address.Set)
|
|
|
|
} else if android.InList("hwaddress", sanitizers) && a.properties.Sanitized.Hwaddress.Set != nil {
|
|
|
|
srcs = append(srcs, *a.properties.Sanitized.Hwaddress.Set)
|
|
|
|
} else if a.properties.Sanitized.None.Set != nil {
|
|
|
|
srcs = append(srcs, *a.properties.Sanitized.None.Set)
|
|
|
|
}
|
|
|
|
|
|
|
|
return srcs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *ApexSet) hasSanitizedSource(sanitizer string) bool {
|
|
|
|
if sanitizer == "address" {
|
|
|
|
return a.properties.Sanitized.Address.Set != nil
|
|
|
|
}
|
|
|
|
if sanitizer == "hwaddress" {
|
|
|
|
return a.properties.Sanitized.Hwaddress.Set != nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
func (a *ApexSet) installable() bool {
|
|
|
|
return a.properties.Installable == nil || proptools.Bool(a.properties.Installable)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *ApexSet) InstallFilename() string {
|
|
|
|
return proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+imageApexSuffix)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *ApexSet) Name() string {
|
2020-07-16 14:38:56 +02:00
|
|
|
return a.prebuiltCommon.prebuilt.Name(a.ModuleBase.Name())
|
2020-05-14 23:15:24 +02:00
|
|
|
}
|
|
|
|
|
2020-06-12 10:26:31 +02:00
|
|
|
func (a *ApexSet) Overrides() []string {
|
|
|
|
return a.properties.Overrides
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
// prebuilt_apex imports an `.apex` file into the build graph as if it was built with apex.
|
|
|
|
func apexSetFactory() android.Module {
|
|
|
|
module := &ApexSet{}
|
|
|
|
module.AddProperties(&module.properties)
|
2020-07-25 00:35:40 +02:00
|
|
|
|
|
|
|
srcsSupplier := func(ctx android.BaseModuleContext) []string {
|
|
|
|
return module.prebuiltSrcs(ctx)
|
|
|
|
}
|
|
|
|
|
|
|
|
android.InitPrebuiltModuleWithSrcSupplier(module, srcsSupplier, "set")
|
2020-05-14 23:15:24 +02:00
|
|
|
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|
|
|
a.installFilename = a.InstallFilename()
|
|
|
|
if !strings.HasSuffix(a.installFilename, imageApexSuffix) {
|
|
|
|
ctx.ModuleErrorf("filename should end in %s for apex_set", imageApexSuffix)
|
|
|
|
}
|
|
|
|
|
2020-07-16 14:38:56 +02:00
|
|
|
apexSet := a.prebuiltCommon.prebuilt.SingleSourcePath(ctx)
|
2020-05-14 23:15:24 +02:00
|
|
|
a.outputApex = android.PathForModuleOut(ctx, a.installFilename)
|
|
|
|
ctx.Build(pctx,
|
|
|
|
android.BuildParams{
|
|
|
|
Rule: extractMatchingApex,
|
|
|
|
Description: "Extract an apex from an apex set",
|
|
|
|
Inputs: android.Paths{apexSet},
|
|
|
|
Output: a.outputApex,
|
|
|
|
Args: map[string]string{
|
|
|
|
"abis": strings.Join(java.SupportedAbis(ctx), ","),
|
|
|
|
"allow-prereleased": strconv.FormatBool(proptools.Bool(a.properties.Prerelease)),
|
2020-07-24 02:32:15 +02:00
|
|
|
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
|
2020-05-14 23:15:24 +02:00
|
|
|
},
|
|
|
|
})
|
2020-07-16 14:38:56 +02:00
|
|
|
|
|
|
|
if a.prebuiltCommon.checkForceDisable(ctx) {
|
2020-12-16 19:20:23 +01:00
|
|
|
a.HideFromMake()
|
2020-07-16 14:38:56 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:15:24 +02:00
|
|
|
a.installDir = android.PathForModuleInstall(ctx, "apex")
|
|
|
|
if a.installable() {
|
|
|
|
ctx.InstallFile(a.installDir, a.installFilename, a.outputApex)
|
|
|
|
}
|
|
|
|
|
|
|
|
// in case that apex_set replaces source apex (using prefer: prop)
|
|
|
|
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
|
|
|
|
// or that apex_set overrides other apexes (using overrides: prop)
|
|
|
|
for _, overridden := range a.properties.Overrides {
|
|
|
|
a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
|
|
|
|
}
|
2020-06-29 23:34:23 +02:00
|
|
|
|
|
|
|
if ctx.Config().InstallExtraFlattenedApexes() {
|
|
|
|
// flattened apex should be in /system_ext/apex
|
|
|
|
flattenedApexDir := android.PathForModuleInstall(&systemExtContext{ctx}, "apex", a.BaseModuleName())
|
|
|
|
a.postInstallCommands = append(a.postInstallCommands,
|
|
|
|
fmt.Sprintf("$(HOST_OUT_EXECUTABLES)/deapexer --debugfs_path $(HOST_OUT_EXECUTABLES)/debugfs extract %s %s",
|
|
|
|
a.outputApex.String(),
|
|
|
|
flattenedApexDir.ToMakePath().String(),
|
|
|
|
))
|
|
|
|
a.hostRequired = []string{"deapexer", "debugfs"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type systemExtContext struct {
|
|
|
|
android.ModuleContext
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*systemExtContext) SystemExtSpecific() bool {
|
|
|
|
return true
|
2020-05-14 23:15:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *ApexSet) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2020-06-29 23:34:23 +02:00
|
|
|
Class: "ETC",
|
|
|
|
OutputFile: android.OptionalPathForPath(a.outputApex),
|
|
|
|
Include: "$(BUILD_PREBUILT)",
|
|
|
|
Host_required: a.hostRequired,
|
2020-05-14 23:15:24 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetString("LOCAL_MODULE_PATH", a.installDir.ToMakePath().String())
|
|
|
|
entries.SetString("LOCAL_MODULE_STEM", a.installFilename)
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !a.installable())
|
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_MODULES", a.properties.Overrides...)
|
2020-06-29 23:34:23 +02:00
|
|
|
postInstallCommands := append([]string{}, a.postInstallCommands...)
|
|
|
|
postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
|
|
|
|
if len(postInstallCommands) > 0 {
|
|
|
|
entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
|
2020-05-14 23:15:24 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
}
|