blob: 83184383290ac04265b2f4183b3009cf38bd482c [file] [log] [blame]
Nan Zhang5323f8e2017-05-10 13:37:54 -07001// Copyright 2017 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package python
16
17import (
18 "android/soong/android"
19 "path/filepath"
20
21 "github.com/google/blueprint"
22)
23
24// This file contains the module types for building Python test.
25
26func init() {
27 android.RegisterModuleType("python_test_host", PythonTestHostFactory)
28}
29
30type PythonTestHost struct {
31 pythonBinaryBase
32}
33
34var _ PythonSubModule = (*PythonTestHost)(nil)
35
36type pythonTestHostDecorator struct {
37 pythonDecorator
38}
39
40func (p *pythonTestHostDecorator) install(ctx android.ModuleContext, file android.Path) {
41 p.pythonDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
42 p.pythonDecorator.baseInstaller.install(ctx, file)
43}
44
45func PythonTestHostFactory() (blueprint.Module, []interface{}) {
46 decorator := &pythonTestHostDecorator{
47 pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("nativetest")}}
48
49 module := &PythonBinaryHost{}
50 module.pythonBaseModule.installer = decorator
51
52 return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
53 &module.pythonBinaryBase, android.HostSupportedNoCross, &module.binaryProperties)
54}