diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-12-21 14:55:28 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-12-21 15:03:15 -0800 |
commit | 782a2d116a010d3cbc3ce26c43039b82ee579e55 (patch) | |
tree | 808234caba5a366940f834e335b3e665cdb184e0 /common | |
parent | 7b310eefb74fc93f80c359d0b0486fc242100946 (diff) | |
download | build_soong-782a2d116a010d3cbc3ce26c43039b82ee579e55.tar.gz build_soong-782a2d116a010d3cbc3ce26c43039b82ee579e55.tar.bz2 build_soong-782a2d116a010d3cbc3ce26c43039b82ee579e55.zip |
Refactor install paths
Explicitly allow installation into the data partition instead of using
"../data" for tests. At the same time, pipe through the information
required for vendor modules.
Change-Id: I6baf9d828c285e1080e43074beef8aebdbb38875
Diffstat (limited to 'common')
-rw-r--r-- | common/module.go | 50 | ||||
-rw-r--r-- | common/paths.go | 12 |
2 files changed, 47 insertions, 15 deletions
diff --git a/common/module.go b/common/module.go index a2b2efa3..0f6ecb5a 100644 --- a/common/module.go +++ b/common/module.go @@ -56,6 +56,8 @@ type androidBaseContext interface { Darwin() bool Debug() bool AConfig() Config + Proprietary() bool + InstallInData() bool } type AndroidBaseContext interface { @@ -74,8 +76,8 @@ type AndroidModuleContext interface { ExpandSources(srcFiles, excludes []string) Paths Glob(outDir, globPattern string, excludes []string) Paths - InstallFile(installPath string, srcPath Path, deps ...Path) Path - InstallFileName(installPath, name string, srcPath Path, deps ...Path) Path + InstallFile(installPath OutputPath, srcPath Path, deps ...Path) Path + InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) Path CheckbuildFile(srcPath Path) } @@ -87,6 +89,7 @@ type AndroidModule interface { base() *AndroidModuleBase Enabled() bool HostOrDevice() HostOrDevice + InstallInData() bool } type commonProperties struct { @@ -103,6 +106,9 @@ type commonProperties struct { // platform Compile_multilib string + // whether this is a proprietary vendor module, and should be installed into /vendor + Proprietary bool + // Set by HostOrDeviceMutator CompileHostOrDevice HostOrDevice `blueprint:"mutated"` @@ -294,6 +300,10 @@ func (p *AndroidModuleBase) NoAddressSanitizer() bool { return p.noAddressSanitizer } +func (p *AndroidModuleBase) InstallInData() bool { + return false +} + func (a *AndroidModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) { if a != ctx.FinalModule().(AndroidModule).base() { return @@ -352,10 +362,12 @@ func (a *AndroidModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) { func (a *AndroidModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext) androidBaseContextImpl { return androidBaseContextImpl{ - arch: a.commonProperties.CompileArch, - hod: a.commonProperties.CompileHostOrDevice, - ht: a.commonProperties.CompileHostType, - config: ctx.Config().(Config), + arch: a.commonProperties.CompileArch, + hod: a.commonProperties.CompileHostOrDevice, + ht: a.commonProperties.CompileHostType, + proprietary: a.commonProperties.Proprietary, + config: ctx.Config().(Config), + installInData: a.module.InstallInData(), } } @@ -387,11 +399,13 @@ func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) { } type androidBaseContextImpl struct { - arch Arch - hod HostOrDevice - ht HostType - debug bool - config Config + arch Arch + hod HostOrDevice + ht HostType + debug bool + config Config + proprietary bool + installInData bool } type androidModuleContext struct { @@ -492,10 +506,18 @@ func (a *androidBaseContextImpl) AConfig() Config { return a.config } -func (a *androidModuleContext) InstallFileName(installPath, name string, srcPath Path, +func (a *androidBaseContextImpl) Proprietary() bool { + return a.proprietary +} + +func (a *androidBaseContextImpl) InstallInData() bool { + return a.installInData +} + +func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) Path { - fullInstallPath := PathForModuleInstall(a, installPath, name) + fullInstallPath := installPath.Join(a, name) deps = append(deps, a.installDeps...) @@ -512,7 +534,7 @@ func (a *androidModuleContext) InstallFileName(installPath, name string, srcPath return fullInstallPath } -func (a *androidModuleContext) InstallFile(installPath string, srcPath Path, deps ...Path) Path { +func (a *androidModuleContext) InstallFile(installPath OutputPath, srcPath Path, deps ...Path) Path { return a.InstallFileName(installPath, filepath.Base(srcPath.String()), srcPath, deps...) } diff --git a/common/paths.go b/common/paths.go index e0d4914d..2bbb72c4 100644 --- a/common/paths.go +++ b/common/paths.go @@ -601,10 +601,20 @@ func PathForModuleRes(ctx AndroidModuleContext, paths ...string) ModuleResPath { func PathForModuleInstall(ctx AndroidModuleContext, paths ...string) OutputPath { var outPaths []string if ctx.Device() { - outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), "system"} + partition := "system" + if ctx.Proprietary() { + partition = "vendor" + } + if ctx.InstallInData() { + partition = "data" + } + outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), partition} } else { outPaths = []string{"host", ctx.HostType().String() + "-x86"} } + if ctx.Debug() { + outPaths = append([]string{"debug"}, outPaths...) + } outPaths = append(outPaths, paths...) return PathForOutput(ctx, outPaths...) } |