Add new AndroidModuleContext helper functions
Add Host(), Device(), and Debug() to AndroidModuleContext to allow build rule generators to easily determine build options. Change-Id: Ib93a462cb45189399063f641b3a8df175db0592e
This commit is contained in:
55
cc/cc.go
55
cc/cc.go
@@ -367,9 +367,6 @@ func (c *ccBase) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerMod
|
|||||||
// Create a ccFlags struct that collects the compile flags from global values,
|
// Create a ccFlags struct that collects the compile flags from global values,
|
||||||
// per-target values, module type values, and per-module Blueprints properties
|
// per-target values, module type values, and per-module Blueprints properties
|
||||||
func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCFlags {
|
func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCFlags {
|
||||||
|
|
||||||
arch := ctx.Arch()
|
|
||||||
|
|
||||||
flags := CCFlags{
|
flags := CCFlags{
|
||||||
CFlags: c.properties.Cflags,
|
CFlags: c.properties.Cflags,
|
||||||
CppFlags: c.properties.Cppflags,
|
CppFlags: c.properties.Cppflags,
|
||||||
@@ -389,7 +386,7 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
// TODO: debug
|
// TODO: debug
|
||||||
flags.CFlags = append(flags.CFlags, c.properties.Release.Cflags...)
|
flags.CFlags = append(flags.CFlags, c.properties.Release.Cflags...)
|
||||||
|
|
||||||
if arch.HostOrDevice.Host() {
|
if ctx.Host() {
|
||||||
// TODO: allow per-module clang disable for host
|
// TODO: allow per-module clang disable for host
|
||||||
flags.Clang = true
|
flags.Clang = true
|
||||||
}
|
}
|
||||||
@@ -404,7 +401,7 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
|
|
||||||
flags.CFlags = append(flags.CFlags, "${clangExtraCflags}")
|
flags.CFlags = append(flags.CFlags, "${clangExtraCflags}")
|
||||||
flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
|
flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
|
||||||
if arch.HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
flags.CFlags = append(flags.CFlags, "${clangExtraTargetCflags}")
|
flags.CFlags = append(flags.CFlags, "${clangExtraTargetCflags}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +412,7 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
||||||
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
||||||
|
|
||||||
if arch.HostOrDevice.Host() {
|
if ctx.Host() {
|
||||||
gccToolchain := "--gcc-toolchain=" + toolchain.GccRoot()
|
gccToolchain := "--gcc-toolchain=" + toolchain.GccRoot()
|
||||||
sysroot := "--sysroot=" + filepath.Join(toolchain.GccRoot(), "sysroot")
|
sysroot := "--sysroot=" + filepath.Join(toolchain.GccRoot(), "sysroot")
|
||||||
|
|
||||||
@@ -441,7 +438,7 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/libnativehelper/include/nativehelper")
|
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/libnativehelper/include/nativehelper")
|
||||||
}
|
}
|
||||||
|
|
||||||
if arch.HostOrDevice.Device() && !c.properties.Allow_undefined_symbols {
|
if ctx.Device() && !c.properties.Allow_undefined_symbols {
|
||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +450,7 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
instructionSetFlags,
|
instructionSetFlags,
|
||||||
toolchain.ClangCflags(),
|
toolchain.ClangCflags(),
|
||||||
"${commonClangGlobalCflags}",
|
"${commonClangGlobalCflags}",
|
||||||
fmt.Sprintf("${%sClangGlobalCflags}", arch.HostOrDevice),
|
fmt.Sprintf("${%sClangGlobalCflags}", ctx.Arch().HostOrDevice),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
flags.CppFlags = append(flags.CppFlags, "${commonGlobalCppflags}")
|
flags.CppFlags = append(flags.CppFlags, "${commonGlobalCppflags}")
|
||||||
@@ -463,15 +460,15 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
instructionSetFlags,
|
instructionSetFlags,
|
||||||
toolchain.Cflags(),
|
toolchain.Cflags(),
|
||||||
"${commonGlobalCflags}",
|
"${commonGlobalCflags}",
|
||||||
fmt.Sprintf("${%sGlobalCflags}", arch.HostOrDevice),
|
fmt.Sprintf("${%sGlobalCflags}", ctx.Arch().HostOrDevice),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if arch.HostOrDevice.Host() {
|
if ctx.Host() {
|
||||||
flags.LdFlags = append(flags.LdFlags, c.properties.Host_ldlibs...)
|
flags.LdFlags = append(flags.LdFlags, c.properties.Host_ldlibs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if arch.HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
if c.properties.Rtti {
|
if c.properties.Rtti {
|
||||||
flags.CppFlags = append(flags.CppFlags, "-frtti")
|
flags.CppFlags = append(flags.CppFlags, "-frtti")
|
||||||
} else {
|
} else {
|
||||||
@@ -507,7 +504,6 @@ func (c *ccBase) flags(ctx common.AndroidModuleContext, toolchain Toolchain) CCF
|
|||||||
// Modify ccFlags structs with STL library info
|
// Modify ccFlags structs with STL library info
|
||||||
func (c *ccBase) addStlFlags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags {
|
func (c *ccBase) addStlFlags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags {
|
||||||
if !c.properties.No_default_compiler_flags {
|
if !c.properties.No_default_compiler_flags {
|
||||||
arch := ctx.Arch()
|
|
||||||
stl := "libc++" // TODO: mingw needs libstdc++
|
stl := "libc++" // TODO: mingw needs libstdc++
|
||||||
if c.properties.Stl != "" {
|
if c.properties.Stl != "" {
|
||||||
stl = c.properties.Stl
|
stl = c.properties.Stl
|
||||||
@@ -522,7 +518,7 @@ func (c *ccBase) addStlFlags(ctx common.AndroidModuleContext, flags CCFlags) CCF
|
|||||||
case "libc++", "libc++_static":
|
case "libc++", "libc++_static":
|
||||||
flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
|
flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
|
||||||
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/external/libcxx/include")
|
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/external/libcxx/include")
|
||||||
if arch.HostOrDevice.Host() {
|
if ctx.Host() {
|
||||||
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
||||||
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
||||||
flags.LdLibs = append(flags.LdLibs, "-lc", "-lm", "-lpthread")
|
flags.LdLibs = append(flags.LdLibs, "-lc", "-lm", "-lpthread")
|
||||||
@@ -533,7 +529,7 @@ func (c *ccBase) addStlFlags(ctx common.AndroidModuleContext, flags CCFlags) CCF
|
|||||||
flags.ExtraSharedLibs = append(flags.ExtraSharedLibs, "libc++")
|
flags.ExtraSharedLibs = append(flags.ExtraSharedLibs, "libc++")
|
||||||
}
|
}
|
||||||
case "stlport", "stlport_static":
|
case "stlport", "stlport_static":
|
||||||
if arch.HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
flags.IncludeDirs = append(flags.IncludeDirs,
|
flags.IncludeDirs = append(flags.IncludeDirs,
|
||||||
"${SrcDir}/external/stlport/stlport",
|
"${SrcDir}/external/stlport/stlport",
|
||||||
"${SrcDir}/bionic/libstdc++/include",
|
"${SrcDir}/bionic/libstdc++/include",
|
||||||
@@ -550,12 +546,12 @@ func (c *ccBase) addStlFlags(ctx common.AndroidModuleContext, flags CCFlags) CCF
|
|||||||
// Using bionic's basic libstdc++. Not actually an STL. Only around until the
|
// Using bionic's basic libstdc++. Not actually an STL. Only around until the
|
||||||
// tree is in good enough shape to not need it.
|
// tree is in good enough shape to not need it.
|
||||||
// Host builds will use GNU libstdc++.
|
// Host builds will use GNU libstdc++.
|
||||||
if arch.HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/bionic/libstdc++/include")
|
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/bionic/libstdc++/include")
|
||||||
flags.ExtraSharedLibs = append(flags.ExtraSharedLibs, "libstdc++")
|
flags.ExtraSharedLibs = append(flags.ExtraSharedLibs, "libstdc++")
|
||||||
}
|
}
|
||||||
case "none":
|
case "none":
|
||||||
if arch.HostOrDevice.Host() {
|
if ctx.Host() {
|
||||||
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
||||||
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
||||||
flags.LdLibs = append(flags.LdLibs, "-lc", "-lm")
|
flags.LdLibs = append(flags.LdLibs, "-lc", "-lm")
|
||||||
@@ -701,12 +697,11 @@ func newCCDynamic(dynamic *ccDynamic, module CCModuleType, hod common.HostOrDevi
|
|||||||
|
|
||||||
const defaultSystemSharedLibraries = "__default__"
|
const defaultSystemSharedLibraries = "__default__"
|
||||||
|
|
||||||
func (c *ccDynamic) systemSharedLibs() []string {
|
func (c *ccDynamic) systemSharedLibs(ctx common.AndroidBaseContext) []string {
|
||||||
|
|
||||||
if len(c.properties.System_shared_libs) == 1 &&
|
if len(c.properties.System_shared_libs) == 1 &&
|
||||||
c.properties.System_shared_libs[0] == defaultSystemSharedLibraries {
|
c.properties.System_shared_libs[0] == defaultSystemSharedLibraries {
|
||||||
|
|
||||||
if c.HostOrDevice().Host() {
|
if ctx.Host() {
|
||||||
return []string{}
|
return []string{}
|
||||||
} else {
|
} else {
|
||||||
return []string{"libc", "libm"}
|
return []string{"libc", "libm"}
|
||||||
@@ -725,8 +720,8 @@ var (
|
|||||||
func (c *ccDynamic) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
func (c *ccDynamic) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
||||||
deps := c.ccBase.AndroidDynamicDependencies(ctx)
|
deps := c.ccBase.AndroidDynamicDependencies(ctx)
|
||||||
|
|
||||||
if c.HostOrDevice().Device() {
|
if ctx.Device() {
|
||||||
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, c.systemSharedLibs()...)
|
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, c.systemSharedLibs(ctx)...)
|
||||||
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}},
|
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}},
|
||||||
"libcompiler_rt-extras",
|
"libcompiler_rt-extras",
|
||||||
"libgcov",
|
"libgcov",
|
||||||
@@ -752,7 +747,7 @@ func (c *ccDynamic) collectDeps(ctx common.AndroidModuleContext, flags CCFlags)
|
|||||||
|
|
||||||
deps, flags := c.ccBase.collectDeps(ctx, flags)
|
deps, flags := c.ccBase.collectDeps(ctx, flags)
|
||||||
|
|
||||||
systemSharedLibs := c.systemSharedLibs()
|
systemSharedLibs := c.systemSharedLibs(ctx)
|
||||||
sharedLibNames := make([]string, 0, len(c.properties.Shared_libs)+len(systemSharedLibs)+
|
sharedLibNames := make([]string, 0, len(c.properties.Shared_libs)+len(systemSharedLibs)+
|
||||||
len(flags.ExtraSharedLibs))
|
len(flags.ExtraSharedLibs))
|
||||||
sharedLibNames = append(sharedLibNames, c.properties.Shared_libs...)
|
sharedLibNames = append(sharedLibNames, c.properties.Shared_libs...)
|
||||||
@@ -761,7 +756,7 @@ func (c *ccDynamic) collectDeps(ctx common.AndroidModuleContext, flags CCFlags)
|
|||||||
_, deps.SharedLibs, newIncludeDirs = c.collectDepsFromList(ctx, sharedLibNames)
|
_, deps.SharedLibs, newIncludeDirs = c.collectDepsFromList(ctx, sharedLibNames)
|
||||||
deps.IncludeDirs = append(deps.IncludeDirs, newIncludeDirs...)
|
deps.IncludeDirs = append(deps.IncludeDirs, newIncludeDirs...)
|
||||||
|
|
||||||
if ctx.Arch().HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
var staticLibs []string
|
var staticLibs []string
|
||||||
staticLibNames := []string{"libcompiler_rt-extras"}
|
staticLibNames := []string{"libcompiler_rt-extras"}
|
||||||
_, staticLibs, newIncludeDirs = c.collectDepsFromList(ctx, staticLibNames)
|
_, staticLibs, newIncludeDirs = c.collectDepsFromList(ctx, staticLibNames)
|
||||||
@@ -868,7 +863,7 @@ func CCLibraryFactory() (blueprint.Module, []interface{}) {
|
|||||||
func (c *CCLibrary) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
func (c *CCLibrary) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
||||||
if c.LibraryProperties.IsShared {
|
if c.LibraryProperties.IsShared {
|
||||||
deps := c.ccDynamic.AndroidDynamicDependencies(ctx)
|
deps := c.ccDynamic.AndroidDynamicDependencies(ctx)
|
||||||
if c.HostOrDevice().Device() {
|
if ctx.Device() {
|
||||||
deps = append(deps, "crtbegin_so", "crtend_so")
|
deps = append(deps, "crtbegin_so", "crtend_so")
|
||||||
}
|
}
|
||||||
return deps
|
return deps
|
||||||
@@ -923,10 +918,10 @@ func (c *CCLibrary) ModuleTypeFlags(ctx common.AndroidModuleContext, flags CCFla
|
|||||||
libName := ctx.ModuleName()
|
libName := ctx.ModuleName()
|
||||||
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
|
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
|
||||||
sharedFlag := "-Wl,-shared"
|
sharedFlag := "-Wl,-shared"
|
||||||
if c.properties.Clang || ctx.Arch().HostOrDevice.Host() {
|
if c.properties.Clang || ctx.Host() {
|
||||||
sharedFlag = "-shared"
|
sharedFlag = "-shared"
|
||||||
}
|
}
|
||||||
if ctx.Arch().HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
flags.LdFlags = append(flags.LdFlags, "-nostdlib")
|
flags.LdFlags = append(flags.LdFlags, "-nostdlib")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,7 +1130,7 @@ func (c *CCBinary) getStem(ctx common.AndroidModuleContext) string {
|
|||||||
|
|
||||||
func (c *CCBinary) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
func (c *CCBinary) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerModuleContext) []string {
|
||||||
deps := c.ccDynamic.AndroidDynamicDependencies(ctx)
|
deps := c.ccDynamic.AndroidDynamicDependencies(ctx)
|
||||||
if c.HostOrDevice().Device() {
|
if ctx.Device() {
|
||||||
if c.BinaryProperties.Static_executable {
|
if c.BinaryProperties.Static_executable {
|
||||||
deps = append(deps, "crtbegin_static", "crtend_android")
|
deps = append(deps, "crtbegin_static", "crtend_android")
|
||||||
} else {
|
} else {
|
||||||
@@ -1161,7 +1156,7 @@ func CCBinaryFactory() (blueprint.Module, []interface{}) {
|
|||||||
func (c *CCBinary) ModuleTypeFlags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags {
|
func (c *CCBinary) ModuleTypeFlags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags {
|
||||||
flags.CFlags = append(flags.CFlags, "-fpie")
|
flags.CFlags = append(flags.CFlags, "-fpie")
|
||||||
|
|
||||||
if ctx.Arch().HostOrDevice.Device() {
|
if ctx.Device() {
|
||||||
linker := "/system/bin/linker"
|
linker := "/system/bin/linker"
|
||||||
if flags.Toolchain.Is64Bit() {
|
if flags.Toolchain.Is64Bit() {
|
||||||
linker = "/system/bin/linker64"
|
linker = "/system/bin/linker64"
|
||||||
@@ -1217,7 +1212,7 @@ func (c *ccTest) collectDeps(ctx common.AndroidModuleContext, flags CCFlags) (CC
|
|||||||
deps, flags := c.CCBinary.collectDeps(ctx, flags)
|
deps, flags := c.CCBinary.collectDeps(ctx, flags)
|
||||||
|
|
||||||
flags.CFlags = append(flags.CFlags, "-DGTEST_HAS_STD_STRING")
|
flags.CFlags = append(flags.CFlags, "-DGTEST_HAS_STD_STRING")
|
||||||
if c.HostOrDevice().Host() {
|
if ctx.Host() {
|
||||||
flags.CFlags = append(flags.CFlags, "-O0", "-g")
|
flags.CFlags = append(flags.CFlags, "-O0", "-g")
|
||||||
flags.LdLibs = append(flags.LdLibs, "-lpthread")
|
flags.LdLibs = append(flags.LdLibs, "-lpthread")
|
||||||
}
|
}
|
||||||
@@ -1239,7 +1234,7 @@ func (c *ccTest) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ccTest) installModule(ctx common.AndroidModuleContext, flags CCFlags) {
|
func (c *ccTest) installModule(ctx common.AndroidModuleContext, flags CCFlags) {
|
||||||
if c.HostOrDevice().Device() {
|
if ctx.Device() {
|
||||||
ctx.InstallFile("../data/nativetest/"+ctx.ModuleName(), c.out)
|
ctx.InstallFile("../data/nativetest/"+ctx.ModuleName(), c.out)
|
||||||
} else {
|
} else {
|
||||||
c.CCBinary.installModule(ctx, flags)
|
c.CCBinary.installModule(ctx, flags)
|
||||||
|
@@ -15,12 +15,13 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -15,8 +15,9 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -28,10 +29,22 @@ var (
|
|||||||
HostExecutable = "host_executable"
|
HostExecutable = "host_executable"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type androidBaseContext interface {
|
||||||
|
Arch() Arch
|
||||||
|
Host() bool
|
||||||
|
Device() bool
|
||||||
|
Debug() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type AndroidBaseContext interface {
|
||||||
|
blueprint.BaseModuleContext
|
||||||
|
androidBaseContext
|
||||||
|
}
|
||||||
|
|
||||||
type AndroidModuleContext interface {
|
type AndroidModuleContext interface {
|
||||||
blueprint.ModuleContext
|
blueprint.ModuleContext
|
||||||
|
androidBaseContext
|
||||||
|
|
||||||
Arch() Arch
|
|
||||||
InstallFile(installPath, srcPath string)
|
InstallFile(installPath, srcPath string)
|
||||||
CheckbuildFile(srcPath string)
|
CheckbuildFile(srcPath string)
|
||||||
}
|
}
|
||||||
@@ -52,6 +65,7 @@ type AndroidDynamicDepender interface {
|
|||||||
|
|
||||||
type AndroidDynamicDependerModuleContext interface {
|
type AndroidDynamicDependerModuleContext interface {
|
||||||
blueprint.DynamicDependerModuleContext
|
blueprint.DynamicDependerModuleContext
|
||||||
|
androidBaseContext
|
||||||
}
|
}
|
||||||
|
|
||||||
type commonProperties struct {
|
type commonProperties struct {
|
||||||
@@ -277,7 +291,9 @@ func (a *AndroidModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) {
|
|||||||
func (a *AndroidModuleBase) DynamicDependencies(ctx blueprint.DynamicDependerModuleContext) []string {
|
func (a *AndroidModuleBase) DynamicDependencies(ctx blueprint.DynamicDependerModuleContext) []string {
|
||||||
actx := &androidDynamicDependerContext{
|
actx := &androidDynamicDependerContext{
|
||||||
DynamicDependerModuleContext: ctx,
|
DynamicDependerModuleContext: ctx,
|
||||||
module: a,
|
androidBaseContextImpl: androidBaseContextImpl{
|
||||||
|
arch: a.commonProperties.CompileArch,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if dynamic, ok := a.module.(AndroidDynamicDepender); ok {
|
if dynamic, ok := a.module.(AndroidDynamicDepender); ok {
|
||||||
@@ -290,9 +306,11 @@ func (a *AndroidModuleBase) DynamicDependencies(ctx blueprint.DynamicDependerMod
|
|||||||
func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
|
func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
|
||||||
androidCtx := &androidModuleContext{
|
androidCtx := &androidModuleContext{
|
||||||
ModuleContext: ctx,
|
ModuleContext: ctx,
|
||||||
installDeps: a.computeInstallDeps(ctx),
|
androidBaseContextImpl: androidBaseContextImpl{
|
||||||
installFiles: a.installFiles,
|
arch: a.commonProperties.CompileArch,
|
||||||
arch: a.commonProperties.CompileArch,
|
},
|
||||||
|
installDeps: a.computeInstallDeps(ctx),
|
||||||
|
installFiles: a.installFiles,
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.commonProperties.Disabled {
|
if a.commonProperties.Disabled {
|
||||||
@@ -313,9 +331,14 @@ func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
|
|||||||
a.checkbuildFiles = append(a.checkbuildFiles, androidCtx.checkbuildFiles...)
|
a.checkbuildFiles = append(a.checkbuildFiles, androidCtx.checkbuildFiles...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type androidBaseContextImpl struct {
|
||||||
|
arch Arch
|
||||||
|
debug bool
|
||||||
|
}
|
||||||
|
|
||||||
type androidModuleContext struct {
|
type androidModuleContext struct {
|
||||||
blueprint.ModuleContext
|
blueprint.ModuleContext
|
||||||
arch Arch
|
androidBaseContextImpl
|
||||||
installDeps []string
|
installDeps []string
|
||||||
installFiles []string
|
installFiles []string
|
||||||
checkbuildFiles []string
|
checkbuildFiles []string
|
||||||
@@ -326,10 +349,22 @@ func (a *androidModuleContext) Build(pctx *blueprint.PackageContext, params blue
|
|||||||
a.ModuleContext.Build(pctx, params)
|
a.ModuleContext.Build(pctx, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) Arch() Arch {
|
func (a *androidBaseContextImpl) Arch() Arch {
|
||||||
return a.arch
|
return a.arch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *androidBaseContextImpl) Host() bool {
|
||||||
|
return a.arch.HostOrDevice.Host()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidBaseContextImpl) Device() bool {
|
||||||
|
return a.arch.HostOrDevice.Device()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidBaseContextImpl) Debug() bool {
|
||||||
|
return a.debug
|
||||||
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallFile(installPath, srcPath string) {
|
func (a *androidModuleContext) InstallFile(installPath, srcPath string) {
|
||||||
var fullInstallPath string
|
var fullInstallPath string
|
||||||
if a.arch.HostOrDevice.Device() {
|
if a.arch.HostOrDevice.Device() {
|
||||||
@@ -357,7 +392,7 @@ func (a *androidModuleContext) CheckbuildFile(srcPath string) {
|
|||||||
|
|
||||||
type androidDynamicDependerContext struct {
|
type androidDynamicDependerContext struct {
|
||||||
blueprint.DynamicDependerModuleContext
|
blueprint.DynamicDependerModuleContext
|
||||||
module *AndroidModuleBase
|
androidBaseContextImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
type fileInstaller interface {
|
type fileInstaller interface {
|
||||||
|
Reference in New Issue
Block a user