Merge "Expose module suffixes to Make" am: 8be0e0ffde

am: 909ff131ae

Change-Id: Ifda211c1cf868776022a1bc099e873def1516ded
This commit is contained in:
Dan Willemsen
2016-08-30 02:26:26 +00:00
committed by android-build-merger
2 changed files with 10 additions and 14 deletions

View File

@@ -100,8 +100,7 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DIRS :=", strings.Join(exportedIncludes, " ")) fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DIRS :=", strings.Join(exportedIncludes, " "))
} }
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+outputFile.Ext()) fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+outputFile.Ext())
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)")
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=") fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
@@ -141,12 +140,10 @@ func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Andr
func (benchmark *benchmarkDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { func (benchmark *benchmarkDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.subAndroidMk(ret, benchmark.binaryDecorator) ctx.subAndroidMk(ret, benchmark.binaryDecorator)
ctx.subAndroidMk(ret, benchmark.baseInstaller)
} }
func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.subAndroidMk(ret, test.binaryDecorator) ctx.subAndroidMk(ret, test.binaryDecorator)
ctx.subAndroidMk(ret, test.baseInstaller)
if Bool(test.Properties.Test_per_src) { if Bool(test.Properties.Test_per_src) {
ret.SubName = "_" + test.binaryDecorator.Properties.Stem ret.SubName = "_" + test.binaryDecorator.Properties.Stem
} }
@@ -191,6 +188,7 @@ func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.And
path := installer.path.RelPathString() path := installer.path.RelPathString()
dir, file := filepath.Split(path) dir, file := filepath.Split(path)
stem := strings.TrimSuffix(file, filepath.Ext(file)) stem := strings.TrimSuffix(file, filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir)) fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem) fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
if len(installer.Properties.Symlinks) > 0 { if len(installer.Properties.Symlinks) > 0 {

View File

@@ -181,7 +181,6 @@ type testBinary struct {
testDecorator testDecorator
*binaryDecorator *binaryDecorator
*baseCompiler *baseCompiler
*baseInstaller
Properties TestBinaryProperties Properties TestBinaryProperties
} }
@@ -209,14 +208,15 @@ func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
} }
func (test *testBinary) install(ctx ModuleContext, file android.Path) { func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName()) test.binaryDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
test.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName()) test.binaryDecorator.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName())
test.baseInstaller.install(ctx, file) test.binaryDecorator.baseInstaller.install(ctx, file)
} }
func NewTest(hod android.HostOrDeviceSupported) *Module { func NewTest(hod android.HostOrDeviceSupported) *Module {
module, binary := NewBinary(hod) module, binary := NewBinary(hod)
module.multilib = android.MultilibBoth module.multilib = android.MultilibBoth
binary.baseInstaller = NewTestInstaller()
test := &testBinary{ test := &testBinary{
testDecorator: testDecorator{ testDecorator: testDecorator{
@@ -224,7 +224,6 @@ func NewTest(hod android.HostOrDeviceSupported) *Module {
}, },
binaryDecorator: binary, binaryDecorator: binary,
baseCompiler: NewBaseCompiler(), baseCompiler: NewBaseCompiler(),
baseInstaller: NewTestInstaller(),
} }
test.testDecorator.Properties.Gtest = true test.testDecorator.Properties.Gtest = true
module.compiler = test module.compiler = test
@@ -275,7 +274,6 @@ func NewTestLibrary(hod android.HostOrDeviceSupported) *Module {
type benchmarkDecorator struct { type benchmarkDecorator struct {
*binaryDecorator *binaryDecorator
*baseInstaller
} }
func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) { func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) {
@@ -294,18 +292,18 @@ func (benchmark *benchmarkDecorator) linkerDeps(ctx BaseModuleContext, deps Deps
} }
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) { func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
benchmark.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName()) benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
benchmark.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName()) benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName())
benchmark.baseInstaller.install(ctx, file) benchmark.binaryDecorator.baseInstaller.install(ctx, file)
} }
func NewBenchmark(hod android.HostOrDeviceSupported) *Module { func NewBenchmark(hod android.HostOrDeviceSupported) *Module {
module, binary := NewBinary(hod) module, binary := NewBinary(hod)
module.multilib = android.MultilibBoth module.multilib = android.MultilibBoth
binary.baseInstaller = NewTestInstaller()
benchmark := &benchmarkDecorator{ benchmark := &benchmarkDecorator{
binaryDecorator: binary, binaryDecorator: binary,
baseInstaller: NewTestInstaller(),
} }
module.linker = benchmark module.linker = benchmark
module.installer = benchmark module.installer = benchmark