diff options
author | Colin Cross <ccross@android.com> | 2016-03-24 22:02:12 +0000 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-03-25 18:08:39 -0700 |
commit | d27a5c8fb9ac49763e363a93cb8f3cdd0388700f (patch) | |
tree | 2f66ea7e378b4109ddc2108191159a5729b68fb0 | |
parent | eea8e6c7e113d2090dfb684a66e4caaf4eddda59 (diff) | |
parent | a23446680ff2e0b17e4048b5ef258a4db420d12f (diff) | |
download | build_soong-d27a5c8fb9ac49763e363a93cb8f3cdd0388700f.tar.gz build_soong-d27a5c8fb9ac49763e363a93cb8f3cdd0388700f.tar.bz2 build_soong-d27a5c8fb9ac49763e363a93cb8f3cdd0388700f.zip |
Manual merge of AOSP into nyc-dev
Change-Id: I983bae75b69e63874b6f4dd32a760c23603992fd
-rw-r--r-- | cc/androidmk.go | 15 | ||||
-rw-r--r-- | cc/cc.go | 2 | ||||
-rw-r--r-- | common/androidmk.go | 5 | ||||
-rw-r--r-- | common/module.go | 8 | ||||
-rw-r--r-- | common/paths.go | 4 |
5 files changed, 28 insertions, 6 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go index aa5c4dcd..8b1b349c 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -17,6 +17,7 @@ package cc import ( "fmt" "io" + "path/filepath" "strings" "android/soong/common" @@ -105,5 +106,17 @@ func (binary *binaryLinker) AndroidMk(ret *common.AndroidMkData) { } func (test *testLinker) AndroidMk(ret *common.AndroidMkData) { - ret.Disabled = true + test.binaryLinker.AndroidMk(ret) + if Bool(test.Properties.Test_per_src) { + ret.SubName = test.binaryLinker.Properties.Stem + } +} + +func (installer *baseInstaller) AndroidMk(ret *common.AndroidMkData) { + ret.Extra = append(ret.Extra, func(w io.Writer, outputFile common.Path) error { + path := installer.path.RelPathString() + fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Dir(path)) + fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+filepath.Base(path)) + return nil + }) } @@ -1195,7 +1195,7 @@ type baseInstaller struct { dir64 string data bool - path common.Path + path common.OutputPath } var _ installer = (*baseInstaller)(nil) diff --git a/common/androidmk.go b/common/androidmk.go index 49380e05..a16a652d 100644 --- a/common/androidmk.go +++ b/common/androidmk.go @@ -38,6 +38,7 @@ type AndroidMkDataProvider interface { type AndroidMkData struct { Class string + SubName string OutputFile OptionalPath Disabled bool @@ -141,6 +142,10 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b return err } + if data.SubName != "" { + name += "_" + data.SubName + } + hostCross := false if amod.Host() && amod.HostType() != CurrentHostType() { hostCross = true diff --git a/common/module.go b/common/module.go index 8e459527..ee028da1 100644 --- a/common/module.go +++ b/common/module.go @@ -76,8 +76,8 @@ type AndroidModuleContext interface { ExpandSources(srcFiles, excludes []string) Paths Glob(outDir, globPattern string, excludes []string) Paths - InstallFile(installPath OutputPath, srcPath Path, deps ...Path) Path - InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) Path + InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath + InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath CheckbuildFile(srcPath Path) AddMissingDependencies(deps []string) @@ -531,7 +531,7 @@ func (a *androidBaseContextImpl) InstallInData() bool { } func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path, - deps ...Path) Path { + deps ...Path) OutputPath { fullInstallPath := installPath.Join(a, name) @@ -552,7 +552,7 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri return fullInstallPath } -func (a *androidModuleContext) InstallFile(installPath OutputPath, srcPath Path, deps ...Path) Path { +func (a *androidModuleContext) InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath { return a.InstallFileName(installPath, filepath.Base(srcPath.String()), srcPath, deps...) } diff --git a/common/paths.go b/common/paths.go index 93cad13c..554ce3fa 100644 --- a/common/paths.go +++ b/common/paths.go @@ -478,6 +478,10 @@ func (p OutputPath) String() string { return filepath.Join(p.config.buildDir, p.path) } +func (p OutputPath) RelPathString() string { + return p.path +} + // Join creates a new OutputPath with paths... joined with the current path. The // provided paths... may not use '..' to escape from the current path. func (p OutputPath) Join(ctx PathContext, paths ...string) OutputPath { |